From 354cd9ff21e878c9a34866b0c3916e42e226d105 Mon Sep 17 00:00:00 2001 From: Reimar Date: Sat, 12 Dec 2015 16:20:42 +0100 Subject: Now taking env variable RCADE_DATA and RCADE_SAVE. Default: data/ and save/ . also old saves are not compatible --- GUI.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'GUI.cpp') diff --git a/GUI.cpp b/GUI.cpp index 7dabac9..45a5d5d 100644 --- a/GUI.cpp +++ b/GUI.cpp @@ -61,7 +61,7 @@ int Label::setCaption(string ncaption) int Label::render() { - TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",pos.h); + TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),pos.h); image = NULL; image = TTF_RenderText_Solid(font, caption.c_str(),textColor); if(caption.size() == 0) @@ -299,7 +299,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) bool done = false; while(!done && textSize) { - TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize); + TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),textSize); normal = NULL; normal = TTF_RenderText_Solid(font, message.c_str(),textColor); if(normal == NULL) @@ -323,7 +323,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) done = false; while(!done && textSize) { - TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Bold.ttf",textSize); + TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Bold.ttf").c_str(),textSize); mouseOver = NULL; mouseOver = TTF_RenderText_Solid(font, message.c_str(),textColor); if(mouseOver == NULL) @@ -348,7 +348,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) textColor.b = 17; textColor.g = 200; textColor.r = 250; - TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize); + TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),textSize); pressed = NULL; pressed = TTF_RenderText_Solid(font, message.c_str(),textColor); if(pressed == NULL) @@ -537,34 +537,34 @@ Button::Button(SDL_Rect npos, SDL_Surface* content, bool fancy) int size = 48; SDL_Surface* norm = NULL; - norm = IMG_Load("data/images/fancy_button.bmp"); + norm = IMG_Load((get_data_path() + "images/fancy_button.bmp").c_str()); if(norm == NULL) { cout << "Error loading bmp while creating fancy button!" << endl; } SDL_Surface* inac = NULL; - inac = IMG_Load("data/images/fancy_button_unavailable.bmp"); + inac = IMG_Load((get_data_path() + "images/fancy_button_unavailable.bmp").c_str()); if(inac == NULL) { cout << "Error loading bmp while creating fancy button!" << endl; } SDL_Surface* pres = NULL; - pres = IMG_Load("data/images/fancy_button_clicked.bmp"); + pres = IMG_Load((get_data_path() + "images/fancy_button_clicked.bmp").c_str()); if(pres == NULL) { cout << "Error loading bmp while creating fancy button!" << endl; } SDL_Surface* mous = NULL; - mous = IMG_Load("data/images/fancy_button_selected.bmp"); + mous = IMG_Load((get_data_path() + "images/fancy_button_selected.bmp").c_str()); if(mous == NULL) { cout << "Error loading bmp while creating fancy button!" << endl; } - pressed = IMG_Load("data/images/fancy_button_clicked.bmp"); - inactive = IMG_Load("data/images/fancy_button_unavailable.bmp"); - mouseOver = IMG_Load("data/images/fancy_button_selected.bmp"); - normal = IMG_Load("data/images/fancy_button.bmp"); + pressed = IMG_Load((get_data_path() + "images/fancy_button_clicked.bmp").c_str()); + inactive = IMG_Load((get_data_path() + "images/fancy_button_unavailable.bmp").c_str()); + mouseOver = IMG_Load((get_data_path() + "images/fancy_button_selected.bmp").c_str()); + normal = IMG_Load((get_data_path() + "images/fancy_button.bmp").c_str()); SDL_Rect dest; dest.x = size/2 - content->w/2; dest.y = size/2 - content->h/2; @@ -603,7 +603,7 @@ Scrollbar::Scrollbar(SDL_Rect npos) else horizontal = false; dot = NULL; - dot = IMG_Load("data/images/glowing_dot.png"); + dot = IMG_Load((get_data_path() + "images/glowing_dot.png").c_str()); if(!dot) { cout << "Error loading dot for scrollbar!" << endl; @@ -623,13 +623,13 @@ Scrollbar::Scrollbar(SDL_Rect npos) SDL_Surface* barEnd2 = NULL; if(horizontal) { - barEnd1 = IMG_Load("data/images/scrollbar_end_h1.png"); - barEnd2 = IMG_Load("data/images/scrollbar_end_h2.png"); + barEnd1 = IMG_Load((get_data_path() + "images/scrollbar_end_h1.png").c_str()); + barEnd2 = IMG_Load((get_data_path() + "images/scrollbar_end_h2.png").c_str()); } else { - barEnd1 = IMG_Load("data/images/scrollbar_end_v1.png"); - barEnd2 = IMG_Load("data/images/scrollbar_end_v2.png"); + barEnd1 = IMG_Load((get_data_path() + "images/scrollbar_end_v1.png").c_str()); + barEnd2 = IMG_Load((get_data_path() + "images/scrollbar_end_v2.png").c_str()); } if(!barEnd1 || !barEnd2) { @@ -654,9 +654,9 @@ Scrollbar::Scrollbar(SDL_Rect npos) } SDL_Surface* barMiddle = NULL; if(horizontal) - barMiddle = IMG_Load("data/images/scrollbar_h.png"); + barMiddle = IMG_Load((get_data_path() + "images/scrollbar_h.png").c_str()); else - barMiddle = IMG_Load("data/images/scrollbar_v.png"); + barMiddle = IMG_Load((get_data_path() + "images/scrollbar_v.png").c_str()); if(!barMiddle) { cout << "Error in middle of bar!" << endl; -- cgit v1.2.3