diff --git a/rsc/startup.lua b/rsc/startup.lua index 2798731..ecea939 100644 --- a/rsc/startup.lua +++ b/rsc/startup.lua @@ -24,7 +24,7 @@ end) --]] -generator, msg = loadfile("rsc/roguegenerator.lua") +generator, msg = loadfile("../rsc/roguegenerator.lua") if generator == nil then print("error: ", msg) diff --git a/rsc/terrain.bmp b/rsc/terrain.bmp deleted file mode 100644 index 0a39c74..0000000 Binary files a/rsc/terrain.bmp and /dev/null differ diff --git a/rsc/terrain.png b/rsc/terrain.png new file mode 100644 index 0000000..3966d5e Binary files /dev/null and b/rsc/terrain.png differ diff --git a/src/application.cpp b/src/application.cpp index bc6b43d..cf0f5a5 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -22,6 +22,7 @@ #include "application.hpp" #include +#include #include #include @@ -40,6 +41,9 @@ void Application::Init(int argc, char* argv[]) { msg << "Failed to create the window: " << SDL_GetError(); throw(std::runtime_error(msg.str())); } + else { + std::cout << "Created the window" << std::endl; + } //create and check the renderer renderer = SDL_CreateRenderer(window, -1, 0); @@ -49,20 +53,28 @@ void Application::Init(int argc, char* argv[]) { msg << "Failed to create the renderer: " << SDL_GetError(); throw(std::runtime_error(msg.str())); } + else { + std::cout << "Created the renderer" << std::endl; + } //screen scaling SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); - SDL_RenderSetLogicalSize(renderer, 800, 600); + SDL_RenderSetLogicalSize(renderer, screenWidth, screenHeight); //set the hook for the renderer BaseScene::SetRenderer(renderer); + std::cout << "Initialized screen scaling" << std::endl; + //setting up SDL2_ttf if (TTF_Init()) { std::ostringstream msg; msg << "Failed to initialize SDL2_ttf: " << SDL_GetError(); throw(std::runtime_error(msg.str())); } + else { + std::cout << "Initialized SDL2_ttf" << std::endl; + } //setup lua lua = luaL_newstate(); @@ -71,8 +83,13 @@ void Application::Init(int argc, char* argv[]) { msg << "Failed to create the lua state"; throw(std::runtime_error(msg.str())); } + else { + std::cout << "Initialized lua" << std::endl; + } luaL_openlibs(lua); + + std::cout << "Initialization sucessful" << std::endl; } void Application::Proc() { @@ -124,6 +141,7 @@ void Application::Proc() { } void Application::Quit() { + std::cout << "Closing the APIs" << std::endl; lua_close(lua); TTF_Quit(); diff --git a/src/example_scene.cpp b/src/example_scene.cpp index 4c0aa65..56acf2d 100644 --- a/src/example_scene.cpp +++ b/src/example_scene.cpp @@ -29,13 +29,13 @@ ExampleScene::ExampleScene(lua_State* L) { lua = L; //TODO: non-hardcoded source - tileSheet.Load(GetRenderer(), "./rsc/terrain.bmp", 32, 32); + tileSheet.Load(GetRenderer(), "../rsc/terrain.png", 32, 32); //set the pager's hook regionPager.SetLuaState(lua); //load the file as a chunk - luaL_loadfile(lua, "./rsc/startup.lua"); + luaL_loadfile(lua, "../rsc/startup.lua"); //push the pager as an arg lua_pushlightuserdata(lua, static_cast(®ionPager)); @@ -49,8 +49,10 @@ ExampleScene::ExampleScene(lua_State* L) { camera.scale = 0.25; //DEBUG: testing buttons - buttonBG.Load(GetRenderer(), "./rsc/button.png"); - font = TTF_OpenFont("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 12); + buttonBG.Load(GetRenderer(), "../rsc/button.png"); + //Ubuntu: "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" + + font = TTF_OpenFont("C:\\Windows\\Fonts\\Arial.ttf", 12); if (!font) { std::ostringstream msg; msg << "Failed to load a font: " << SDL_GetError(); @@ -70,6 +72,9 @@ ExampleScene::ExampleScene(lua_State* L) { // blankImage.Create(GetRenderer(), 256, 256); + + // + std::cout << "Scene setup finished" << std::endl; } ExampleScene::~ExampleScene() {