From a07d588c94f68cdc559ceb016c031c9199f0b868 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 20 Mar 2022 11:52:09 -0400 Subject: we can now build a mac bundle! --- src/renderer.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/renderer.cpp') diff --git a/src/renderer.cpp b/src/renderer.cpp index 724e297..09bddc9 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -1,6 +1,7 @@ #include "renderer.h" #include #include "game.h" +#include "runtime.h" Renderer::Renderer() { @@ -33,7 +34,7 @@ Renderer::Renderer() } texture_ptr origFade; - loadTextureFromFile("../res/lighting.png", origFade); + loadTextureFromFile("lighting.png", origFade); playerFade_ = texture_ptr( SDL_CreateTexture( @@ -105,22 +106,22 @@ Renderer::Renderer() SDL_SetRenderDrawColor(ren_.get(), 100, 100, 100, 255); SDL_RenderFillRect(ren_.get(), nullptr); - loadTextureFromFile("../res/player.png", playerSheet_); - loadTextureFromFile("../res/runninbloods.png", tileset_); - loadTextureFromFile("../res/lamp.png", lamp_); - loadTextureFromFile("../res/read_instruction.png", readInstruction_); - loadTextureFromFile("../res/menu.png", menuBg_); + loadTextureFromFile("player.png", playerSheet_); + loadTextureFromFile("runninbloods.png", tileset_); + loadTextureFromFile("lamp.png", lamp_); + loadTextureFromFile("read_instruction.png", readInstruction_); + loadTextureFromFile("menu.png", menuBg_); - loadTextureFromFile("../res/title0.png", titles_[0]); + loadTextureFromFile("title0.png", titles_[0]); SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); - loadTextureFromFile("../res/title1.png", titles_[1]); + loadTextureFromFile("title1.png", titles_[1]); SDL_QueryTexture(titles_[1].get(), nullptr, nullptr, &titleWidths_[1], &titleHeights_[1]); - loadTextureFromFile("../res/title3.png", titles_[2]); + loadTextureFromFile("title3.png", titles_[2]); SDL_QueryTexture(titles_[2].get(), nullptr, nullptr, &titleWidths_[2], &titleHeights_[2]); - font_ = font_ptr(TTF_OpenFont("../res/softsquare.ttf", 45)); + font_ = font_ptr(TTF_OpenFont(Runtime::getResourcePath("softsquare.ttf").c_str(), 45)); if (!font_) { throw ttf_error(); } @@ -553,7 +554,7 @@ void Renderer::renderTitle(int num, double fade) { } void Renderer::loadTextureFromFile(std::string_view path, texture_ptr& texture) { - surface_ptr pfs(IMG_Load(path.data())); + surface_ptr pfs(IMG_Load(Runtime::getResourcePath(path).c_str())); if (!pfs) { throw img_error(); -- cgit 1.4.1