-
Notifications
You must be signed in to change notification settings - Fork 5
Add facilities to manage scenes #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WIP and not ready.
This prevents circular dependency when including them in Game.h
This prevents the program from continuously allocating memory, resulting in increased memory usage as time passes.
The class dtor would take care of it.
Also fix a build error in which an attempts to use `unload()` was made.
These functions will also set `m_sceneLoaded` to `true`
This change allows `Scene`s to be swapped out while retaining their state. (Something like suspend) Of course something would need to store the Scene or it'll just simply unload.
as it's stable and doesnэt use extra memory
Don't sort the `renderQueue` every frame. Instead, sort the whole GO list on every new `GameObject`. This should provide the same effect, while improving performance.
I'm not quite clear on how the registry sorting works, so I'm playing safe here.
This reverts commit 88c4f94.
This doesn't check whether the arguments provided are valid though
Protect eardrums and reduce scares XD.
`SDL_RenderClear()` caused the texture to be the set render color and it'll blend onto whatever that is underneath the scene. (Didn't happen with all colors, but still a problem.
|
I'm considering dumping this PR in favor of the pure ECS model.. That is for GameObjects and Systems. Right now the alternative I'm thinking of is to use |
This PR adds the facilities needed to manage Scenes properly.
Instead of placing GameObject, Registries, and Systems right in
main()and "trying to" manage them,Scenesare object which contains everything needed for a particular scenario and blackboards are also easily created.SceneManagerhandles the switching, update and rendering of aScene.Other changes:
GameObjects can be assigned priorities, which makes them render on the top,bottom or in between other objects.GameObjects can be assigned tags, which let's individual objects easy to access.Spritescan also be rotated.TODO:
initfunction, instead the user should be able to provide their own.