mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 13:43:41 +00:00
Added and implemented some more config options in the GameInternal.cpp. Also removed GameInternal::init() parameters as they are no longer needed
This commit is contained in:
parent
acdbf29896
commit
691ea06eb0
@ -1,3 +1,7 @@
|
||||
{
|
||||
"fullscreen": false
|
||||
"fullscreen": false,
|
||||
"title": "VGG (Very Good Game)",
|
||||
"height": 100,
|
||||
"width": 100,
|
||||
"icon": "./engine/internalAssets/iconImage.bmp"
|
||||
}
|
||||
@ -27,7 +27,7 @@ public:
|
||||
GameInternal();
|
||||
~GameInternal();
|
||||
|
||||
SDL_AppResult init(const char* title, int xpos, int ypos, int width, int height, bool fullscreen);
|
||||
SDL_AppResult init();
|
||||
|
||||
void handleEvents();
|
||||
void update(Uint64 frameTime);
|
||||
|
||||
@ -29,7 +29,7 @@ GameInternal::GameInternal() :
|
||||
|
||||
GameInternal::~GameInternal() = default;
|
||||
|
||||
SDL_AppResult GameInternal::init(const char* title, int xpos, int ypos, int width, int height, bool fullscreen)
|
||||
SDL_AppResult GameInternal::init()
|
||||
{
|
||||
this->gameInstance = GameFactory::instance().create(this);
|
||||
ConfigLoader().setCustomConfig(this->gameInstance->getConfigFilePath());
|
||||
@ -60,7 +60,7 @@ SDL_AppResult GameInternal::init(const char* title, int xpos, int ypos, int widt
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(title, width, height, flags);
|
||||
window = SDL_CreateWindow(config.at("title").get<std::string>().c_str(), config.at("width"), config.at("height"), flags);
|
||||
if (!window)
|
||||
{
|
||||
std::cout << "ERROR: Window couldnt be created! " << SDL_GetError() << std::endl;
|
||||
@ -70,7 +70,7 @@ SDL_AppResult GameInternal::init(const char* title, int xpos, int ypos, int widt
|
||||
|
||||
// bad
|
||||
SDL_Surface* icon;
|
||||
if((icon = SDL_LoadBMP("assets/iconImage.bmp")))
|
||||
if((icon = SDL_LoadBMP(config.at("icon").get<std::string>().c_str())))
|
||||
{
|
||||
SDL_SetWindowIcon(window, icon);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user