feat: add a resource manager for loading textures#15
Conversation
adds a resource manager for loading and unloading assets, as well as for lazily creating textures
adds a test including sprite rendering showcasing the enderable transformations as well as the layer interactions
| @@ -0,0 +1,180 @@ | |||
| #include <SDL3/SDL_keycode.h> | |||
There was a problem hiding this comment.
well written code, but i would like it if tests have no direct usage of SDL, because these are meant to serve as test examples, of what a user using the game engine would be writing with our framework and the engine itself, it would be nice if we minimize SDL usage directly, and provide abstractions and bindings to whatever the user would need as much as possible.
this would entail a well featured library/package abstracting over SDL or binding to SDL and other libraries to provide nicer easier framework to work with while coding a game using this project.
note, this is only a comment and views to where the project should go.
There was a problem hiding this comment.
I'll continue updating the tests over time with the abstraction we add. At this point, there are a few SDL deps that we can't remove yet but are fairly important for a workable test. Will work on it.
for parity with main.cpp
with logging and sprite loading
054cac0 to
4207b47
Compare
5feb641 to
5d45fdd
Compare
|
If required can add a video of the new example later. |
Yes that would be preferred |
upload.mp4Hope the video is clear. When the object is unable to move due to collision, there is a log output shown in the left terminal window in the recording. At times, during the recording, the log output wasn't updating as frequently leading to some small issues in clarity of the demo. Hope it is clear regardless. |
Which issue(s) does this PR address?
We until this PR were not able to load textures, and were unable to use sprites in any way due to this.
Why do we need this PR?
This PR makes it possible for us to load images for textures, allowing us to have sprites rendered. Loading assets is an integral part of a Game Engine, and this allows us to start implementing an Asset Manager.
What logical changes are present in this PR?
This PR adds Sprite loading using a ResourceManager object. This object has an interface for importing files, and lazily loading them when required. This currently only supports images for Textures and Sprites.
How did you test the changes in this PR?
This PR was tested using the code in tests/sprite_layer.cpp
See the following screen recording for a demonstration.
demo.mp4
Are there any breaking changes in this PR?
This PR adds the breaking change of introducing the ResourceManager object into the Engine class.
Is there some additional work to be done later that is NOT covered in this PR?
Additional work to be done later is for audio and font loading to be included with this object.