aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.h
diff options
context:
space:
mode:
authorheavydemon21 <48092678+heavydemon21@users.noreply.github.com>2024-12-11 19:57:04 +0100
committerGitHub <noreply@github.com>2024-12-11 19:57:04 +0100
commit194ee3f192c3343c3ccc28dfa97fed180503ffd4 (patch)
treea717b19dde13c131aa6ddaebd5e23567b9c18de0 /src/crepe/facade/SDLContext.h
parent59954bfc14cdb32997a3fb09e6ee1b393a4dc027 (diff)
parent942fd5adcd3e7f73404601933359d22587843f25 (diff)
Merge pull request #71 from lonkaars/niels/UI
pixel to game units for input system
Diffstat (limited to 'src/crepe/facade/SDLContext.h')
-rw-r--r--src/crepe/facade/SDLContext.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index 46b779f..bcadf87 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -24,7 +24,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
@@ -33,7 +32,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;
@@ -64,7 +63,6 @@ public:
struct RenderContext {
const Sprite & sprite;
const Texture & texture;
- const CameraValues & cam;
const vec2 & pos;
const double & angle;
const double & scale;
@@ -193,18 +191,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;
};
@@ -233,6 +233,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