From 036fec62e586a02ea7a34a879ed063a32f2da6f1 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 8 Feb 2014 20:25:30 +0100 Subject: [PATCH] Taking the width and height from the config file. --- src/CloonelJumpConfig.h.in | 3 +++ src/main.cpp | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/CloonelJumpConfig.h.in b/src/CloonelJumpConfig.h.in index 944c582..634f127 100644 --- a/src/CloonelJumpConfig.h.in +++ b/src/CloonelJumpConfig.h.in @@ -5,4 +5,7 @@ #define GameVersionMinor 1 #define GameVersionMajor 0 +#define DEF_WIN_WIDTH 800 +#define DEF_WIN_HEIGHT 600 + #endif diff --git a/src/main.cpp b/src/main.cpp index d79af39..dbd869b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,8 +10,8 @@ namespace { bool initialized; }; - ///------------------------------------------------------------------------- - ///------------------------------------------------------------------------- + ///------------------------------------------------------------------------ + ///------------------------------------------------------------------------ void InitSDL (InitSDLStuff& parInitSDL) { parInitSDL.window = nullptr; parInitSDL.renderer = nullptr; @@ -21,7 +21,7 @@ namespace { throw std::runtime_error(SDL_GetError()); parInitSDL.initialized = true; - SDL_Window* const win = SDL_CreateWindow(GameName, 100, 100, 640, 480, SDL_WINDOW_SHOWN); + SDL_Window* const win = SDL_CreateWindow(GameName, 100, 100, DEF_WIN_WIDTH, DEF_WIN_HEIGHT, SDL_WINDOW_SHOWN); if (!win) throw std::runtime_error(SDL_GetError()); parInitSDL.window = win; @@ -32,8 +32,8 @@ namespace { parInitSDL.renderer = renderer; } - ///------------------------------------------------------------------------- - ///------------------------------------------------------------------------- + ///------------------------------------------------------------------------ + ///------------------------------------------------------------------------ void ClearIFN (InitSDLStuff& parInitSDL) { if (parInitSDL.renderer) SDL_DestroyRenderer(parInitSDL.renderer); @@ -44,7 +44,9 @@ namespace { } } //unnamed namespace -//following http://twinklebeardev.blogspot.co.uk/2012/07/lesson-1-hello-world.html +///---------------------------------------------------------------------------- +///following http://twinklebeardev.blogspot.co.uk/2012/07/lesson-1-hello-world.html +///---------------------------------------------------------------------------- int main() { std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;