diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-12 21:21:33 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-12 21:21:33 +0100 |
commit | 7f895cda48e180630a3920293a4349b19d1905f9 (patch) | |
tree | 757ec566d44de76eb5e509aafece4e86aa812856 /src/crepe/facade/SDLContext.h | |
parent | 2eaebb2a79ef71589a0be89cfe419f874fbadd09 (diff) | |
parent | fd403d038b017ec8976023471073329896035e36 (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/text-component
Diffstat (limited to 'src/crepe/facade/SDLContext.h')
-rw-r--r-- | src/crepe/facade/SDLContext.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index 957ee32..554880f 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -25,7 +25,6 @@ class Texture; class Mediator; /** - * \class SDLContext * \brief Facade for the SDL library * * SDLContext is a singleton that handles the SDL window and renderer, provides methods for @@ -34,7 +33,7 @@ class Mediator; class SDLContext { public: //! data that the camera component cannot hold - struct CameraValues { + struct CameraAuxiliaryData { //! zoomed in viewport in game_units vec2 zoomed_viewport; @@ -65,7 +64,6 @@ public: struct RenderContext { const Sprite & sprite; const Texture & texture; - const CameraValues & cam; const vec2 & pos; const double & angle; const double & scale; @@ -194,18 +192,20 @@ public: void present_screen(); /** - * \brief sets the background of the camera (will be adjusted in future PR) - * \param camera Reference to the Camera object. - * \return camera data the component cannot store + * \brief calculates camera view settings. such as black_bars, zoomed_viewport, scaling and + * adjusting window size. + * + * \note only supports windowed mode. + * \param camera Reference to the current Camera object in the scene. + * \param new_pos new camera position from transform and offset */ - CameraValues set_camera(const Camera & camera); + void update_camera_view(const Camera & camera, const vec2 & new_pos); public: //! the data needed to construct a sdl dst rectangle struct DestinationRectangleData { const Sprite & sprite; const Texture & texture; - const CameraValues & cam; const vec2 & pos; const double & img_scale; }; @@ -235,6 +235,13 @@ private: //! black bars rectangle to draw SDL_FRect black_bars[2] = {}; + + /** + * \cam_aux_data extra data that the component cannot hold. + * + * - this is defined in this class because get_events() needs this information aswell + */ + CameraAuxiliaryData cam_aux_data; }; } // namespace crepe |