Skip to content

Conversation

@ivucica
Copy link
Member

@ivucica ivucica commented May 30, 2025

Untested, incomplete. This was the idea:

Across the codebase, move from SDLSurface* as storage for RGBA data to an abstract RGBA storage class which can be subclassed to either contain an SDLSurface or an OpenGL texture, while also containing the RGBA data. Move Sprite* and other classes to use that.


Update the codebase to use an abstract RGBA storage class instead of SDL_Surface* for RGBA data storage.

  • Add rgba_storage.h to define an abstract class RGBAStorage with subclasses SDLSurfaceStorage and OpenGLTextureStorage.
  • Modify sprite.h and sprite.cpp to replace SDL_Surface* with std::shared_ptr<RGBAStorage> and update methods accordingly.
  • Modify spritesdl.cpp to use RGBAStorage methods for accessing RGBA data.
  • Modify spritegl.h and spritegl.cpp to use std::shared_ptr<RGBAStorage> for RGBA data storage.
  • Modify automap.cpp to use std::shared_ptr<RGBAStorage> for RGBA data storage.
  • Modify engine.cpp to use std::shared_ptr<RGBAStorage> for RGBA data storage.

For more details, open the Copilot Workspace session.

Untested, incomplete. This was the idea:

> Across the codebase, move from SDLSurface* as storage for RGBA data to an abstract RGBA storage class which can be subclassed to either contain an SDLSurface or an OpenGL texture, while also containing the RGBA data. Move Sprite* and other classes to use that.

---

Update the codebase to use an abstract RGBA storage class instead of SDL_Surface* for RGBA data storage.

* Add `rgba_storage.h` to define an abstract class `RGBAStorage` with subclasses `SDLSurfaceStorage` and `OpenGLTextureStorage`.
* Modify `sprite.h` and `sprite.cpp` to replace `SDL_Surface*` with `std::shared_ptr<RGBAStorage>` and update methods accordingly.
* Modify `spritesdl.cpp` to use `RGBAStorage` methods for accessing RGBA data.
* Modify `spritegl.h` and `spritegl.cpp` to use `std::shared_ptr<RGBAStorage>` for RGBA data storage.
* Modify `automap.cpp` to use `std::shared_ptr<RGBAStorage>` for RGBA data storage.
* Modify `engine.cpp` to use `std::shared_ptr<RGBAStorage>` for RGBA data storage.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/opentibia/yatc?shareId=XXXX-XXXX-XXXX-XXXX).
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