Taking the width and height from the config file.
This commit is contained in:
parent
ef3a4c1ef6
commit
036fec62e5
2 changed files with 11 additions and 6 deletions
|
@ -5,4 +5,7 @@
|
||||||
#define GameVersionMinor 1
|
#define GameVersionMinor 1
|
||||||
#define GameVersionMajor 0
|
#define GameVersionMajor 0
|
||||||
|
|
||||||
|
#define DEF_WIN_WIDTH 800
|
||||||
|
#define DEF_WIN_HEIGHT 600
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -10,8 +10,8 @@ namespace {
|
||||||
bool initialized;
|
bool initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
void InitSDL (InitSDLStuff& parInitSDL) {
|
void InitSDL (InitSDLStuff& parInitSDL) {
|
||||||
parInitSDL.window = nullptr;
|
parInitSDL.window = nullptr;
|
||||||
parInitSDL.renderer = nullptr;
|
parInitSDL.renderer = nullptr;
|
||||||
|
@ -21,7 +21,7 @@ namespace {
|
||||||
throw std::runtime_error(SDL_GetError());
|
throw std::runtime_error(SDL_GetError());
|
||||||
parInitSDL.initialized = true;
|
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)
|
if (!win)
|
||||||
throw std::runtime_error(SDL_GetError());
|
throw std::runtime_error(SDL_GetError());
|
||||||
parInitSDL.window = win;
|
parInitSDL.window = win;
|
||||||
|
@ -32,8 +32,8 @@ namespace {
|
||||||
parInitSDL.renderer = renderer;
|
parInitSDL.renderer = renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
///-------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
///-------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
void ClearIFN (InitSDLStuff& parInitSDL) {
|
void ClearIFN (InitSDLStuff& parInitSDL) {
|
||||||
if (parInitSDL.renderer)
|
if (parInitSDL.renderer)
|
||||||
SDL_DestroyRenderer(parInitSDL.renderer);
|
SDL_DestroyRenderer(parInitSDL.renderer);
|
||||||
|
@ -44,7 +44,9 @@ namespace {
|
||||||
}
|
}
|
||||||
} //unnamed 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() {
|
int main() {
|
||||||
std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;
|
std::cout << GameName << " v" << GameVersionMajor << "." << GameVersionMinor << std::endl;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue