diff --git a/src/PuzzleSingleImageState.cpp b/src/PuzzleSingleImageState.cpp index 54c2df2..5ee8cc7 100644 --- a/src/PuzzleSingleImageState.cpp +++ b/src/PuzzleSingleImageState.cpp @@ -24,6 +24,7 @@ https://github.com/sago007/saland #include "PuzzleSingleImageState.hpp" #include "SDL_image.h" #include +#include "globals.hpp" PuzzleSingleImageState::PuzzleSingleImageState() { @@ -43,11 +44,11 @@ void PuzzleSingleImageState::ProcessInput(const SDL_Event& event, bool &processe void PuzzleSingleImageState::Draw(SDL_Renderer* target) { SDL_Rect rect; - rect.x = 0; - rect.y = 0; + rect.x = globalData.xsize/2-resized_image_width/2; + rect.y = globalData.ysize/2-resized_image_height/2;; rect.h = resized_image_height; rect.w = resized_image_width; - SDL_RenderCopy(target, this->pictureTex, &rect, NULL); + SDL_RenderCopy(target, this->pictureTex, NULL, &rect); } diff --git a/src/globals.hpp b/src/globals.hpp index c22b234..9e926a5 100644 --- a/src/globals.hpp +++ b/src/globals.hpp @@ -41,7 +41,7 @@ struct GlobalData { int verboseLevel = 0; int mousex = 0; int mousey = 0; - int xsize = 1024; + int xsize = 1366; int ysize = 768; }; diff --git a/src/sago_common.cpp b/src/sago_common.cpp index 6efcddf..4232d57 100644 --- a/src/sago_common.cpp +++ b/src/sago_common.cpp @@ -100,7 +100,7 @@ sago::SagoDataHolder dataHolder; static SDL_Window* win = nullptr; void InitGame() { - int width = 1280, height = 720; + int width = globalData.xsize, height = globalData.ysize; SDL_Init(SDL_INIT_VIDEO); IMG_Init(IMG_INIT_PNG); TTF_Init();