Comments (5)
Btw, if one could just pass a sprite to the save function, they could just pass a pre-made asset to the save function instead for that specific game area. In theory one could even pass the room background but I don't think it is accessible currently as a sprite directly - one needs to get it as a drawing surface and then draw it in another drawing surface of a dynamic sprite to be able to then get that sprite.
from ags.
Btw, if one could just pass a sprite to the save function,
Hm, that's actually a very good idea, might be done on its own, regardless of the screenshot feature.
EDIT: so like
SaveGameSlot (int slot, const string description, DynamicSprite *image);
or
SaveGameSlot (int slot, const string description, int sprite);
The issue here will be to "lock" or copy this dynamic sprite into some temp storage, because save is done after function exits, and if sprite is a local variable, then it may get disposed.
from ags.
Ah things that sounds easy in my head and become hell to implement...
I may try the second approach, and use a sprite slot and some static bitmap object that holds a copy of whatever it was in the slot and frees it after writing.
But not sure how do deal with existing behavior, maybe it's better to give a new function name like SaveGameSlotWithGraphic?
The other approach is to have a global dynamic sprite that you set and then the SaveGameSlot uses it if it's set, and then holding the memory becomes part of this global holding this reference. Something like Game.SaveGameSlotSprite. I think this is uglier but just thought to mention.
from ags.
I do not think it's overly hard, there may be only 1 scheduled Save call in a function, but indeed the sprite has to be scheduled along somehow.
The function may remain same, the new argument will be optional and have a default value 0, in which case the screenshot is made if global settings tell to.
Well, that's the first thought, I might need to investigate this closer in order to find any potential problems.
from ags.
So, apparently, there are following changes involved here:
- Creating a screenshot with only selected layers (with DynamicSprite.CreateFromScreenShot);
- Passing an arbitrary sprite to SaveGameSlot.
- Telling how to make a automatic screenshot for the save (same settings are in p1).
I suppose that being able to pass any sprite to SaveGameSlot is a more suitable for individual function parameter than a screenshot layer selection, which is better set as a game option once (i.e. using SetGameOption).
Screenshot layers may be a combination of flags. For starters these could be only "cursor", "gui layer" and "room layer". More may be added later if there will be a need to filter specific sublayers (like make a screenshot of room background without objects), but these seem less useful (?).
In regards to implementation, graphic renderers already support tagging batches with a "layer" constant, and then filtering them out when redrawing last frame. Currently this is done for the purpose of fade-in and out effects, where mouse cursor should not be present.
As seen here, for example:
Lines 2806 to 2807 in 203a76d
from ags.
Related Issues (20)
- Debugger: support step-over and step-out commands HOT 3
- Engine: Rendering graphical glitch HOT 9
- AGS 4: Script API: add "split options" for String.Split method HOT 6
- Deprecate 'function' keyword HOT 4
- Expand on_mouse_click callback parameters with click position
- Editor: having multiple project folders which names are different only in letter case breaks the item drag-n-drop HOT 1
- Editor: an option that disables panel dragging and un-docking
- Editor: restore document panes when resetting a layout
- Preprocessor gets infinite loop meeting a non-latin unicode char in script HOT 3
- Typos in DistanceBetween routine cause wrong calculation HOT 3
- Engine: Windows freezes on Alt+Tab for a specific player HOT 17
- Script API: add "startIndex" parameter to String.IndexOf HOT 26
- Editor: Ctrl+C / Ctrl+V key shortcuts do not work in GUI editor HOT 1
- Editor and Engine: Make it easier to use the project prerequisites (SDL, Ogg, etc) HOT 7
- Feat. req. Pre 2.5 version games support (DOS, 3.11) for Windows runtime engine HOT 1
- AGS 4: remove 16-bit game color depth HOT 2
- Editor: batch-resave all project rooms in the latest format HOT 1
- AGS 4: in Script API change default values of "caseSensitive" parameters to "true"
- [AGS 4.00.00.07] Sierra style template and Tumbleweed template don't work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ags.