Skip to content

Conversation

@LumpBloom7
Copy link
Contributor

@LumpBloom7 LumpBloom7 commented Mar 11, 2019

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, Scenes are object which contains everything needed for a particular scenario and blackboards are also easily created.

SceneManager handles the switching, update and rendering of a Scene.

Other changes:

  • Scenes render to it's own texture, before game renders that texture onto the rendering area.
  • Scenes can be rotated.
  • 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.
  • Sprites can also be rotated.

TODO:

  • Don't force a specific init function, instead the user should be able to provide their own.

LumpBloom7 and others added 30 commits October 5, 2018 20:33
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.
LumpBloom7 and others added 29 commits January 15, 2019 21:47
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 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.
@LumpBloom7
Copy link
Contributor Author

LumpBloom7 commented Sep 25, 2019

I'm considering dumping this PR in favor of the pure ECS model..
OOP for each entity is a pain in the ass to maintain, making sure they stay in scope so they don't destroy, implementing OOP alternatives to EnTT registry functions. Even if OOP is required, EnTT already provides a helper class for it. (https://github.com/skypjack/entt/wiki/Crash-Course:-entity-component-system#actor)

That is for GameObjects and Systems. Right now the alternative I'm thinking of is to use spawn functions to create entities, and convert system classes into functions instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants