holesome/src/main.cpp

44 lines
878 B
C++

#include "logging/easylogging++.h"
#include "game/game_factory.hpp"
#include "sprites/texture_manager.hpp"
#include "texture_config.h"
#include "game/level/level_loader.hpp"
#include "levels.hpp"
void loadAllTextures();
void runGame();
INITIALIZE_EASYLOGGINGPP
int main(int argc, char *argv[])
{
START_EASYLOGGINGPP(argc, argv);
loadAllTextures();
runGame();
}
void runGame()
{
LOG(INFO) << "Starting game ...";
auto game = GameFactory::createWindowed("Holesome");
// Load initial level
LevelLoader::loadLevel(INITIAL_LEVEL);
game->run();
InputMapper::getInstance().reset();
game.reset();
}
void loadAllTextures()
{
LOG(INFO) << "Loading textures...";
for (auto const &[key, path]: all_textures)
{
TextureManager::getInstance()->loadTexture(key, path);
}
LOG(INFO) << "Finished loading textures.";
}