diff options
author | Reimar <Reimar@Leike.name> | 2015-12-12 16:20:42 +0100 |
---|---|---|
committer | Reimar <Reimar@Leike.name> | 2015-12-12 16:20:42 +0100 |
commit | 354cd9ff21e878c9a34866b0c3916e42e226d105 (patch) | |
tree | 8e6f2123e503c2f32eed35e629c6c0b9c01352d8 /GUI.cpp | |
parent | 8c66c87d920340b116c539a56505b32629275b6a (diff) | |
download | RCade-master.tar RCade-master.tar.gz RCade-master.tar.bz2 RCade-master.tar.xz RCade-master.zip |
Now taking env variable RCADE_DATA and RCADE_SAVE. Default: data/ and save/ . also old saves are not compatibleHEADmaster
Diffstat (limited to 'GUI.cpp')
-rw-r--r-- | GUI.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -61,7 +61,7 @@ int Label::setCaption(string ncaption) | |||
61 | 61 | ||
62 | int Label::render() | 62 | int Label::render() |
63 | { | 63 | { |
64 | TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",pos.h); | 64 | TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),pos.h); |
65 | image = NULL; | 65 | image = NULL; |
66 | image = TTF_RenderText_Solid(font, caption.c_str(),textColor); | 66 | image = TTF_RenderText_Solid(font, caption.c_str(),textColor); |
67 | if(caption.size() == 0) | 67 | if(caption.size() == 0) |
@@ -299,7 +299,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) | |||
299 | bool done = false; | 299 | bool done = false; |
300 | while(!done && textSize) | 300 | while(!done && textSize) |
301 | { | 301 | { |
302 | TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize); | 302 | TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),textSize); |
303 | normal = NULL; | 303 | normal = NULL; |
304 | normal = TTF_RenderText_Solid(font, message.c_str(),textColor); | 304 | normal = TTF_RenderText_Solid(font, message.c_str(),textColor); |
305 | if(normal == NULL) | 305 | if(normal == NULL) |
@@ -323,7 +323,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) | |||
323 | done = false; | 323 | done = false; |
324 | while(!done && textSize) | 324 | while(!done && textSize) |
325 | { | 325 | { |
326 | TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Bold.ttf",textSize); | 326 | TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Bold.ttf").c_str(),textSize); |
327 | mouseOver = NULL; | 327 | mouseOver = NULL; |
328 | mouseOver = TTF_RenderText_Solid(font, message.c_str(),textColor); | 328 | mouseOver = TTF_RenderText_Solid(font, message.c_str(),textColor); |
329 | if(mouseOver == NULL) | 329 | if(mouseOver == NULL) |
@@ -348,7 +348,7 @@ Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize) | |||
348 | textColor.b = 17; | 348 | textColor.b = 17; |
349 | textColor.g = 200; | 349 | textColor.g = 200; |
350 | textColor.r = 250; | 350 | textColor.r = 250; |
351 | TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize); | 351 | TTF_Font *font = TTF_OpenFont((get_data_path() + "fonts/OpenSans-Semibold.ttf").c_str(),textSize); |
352 | pressed = NULL; | 352 | pressed = NULL; |
353 | pressed = TTF_RenderText_Solid(font, message.c_str(),textColor); | 353 | pressed = TTF_RenderText_Solid(font, message.c_str(),textColor); |
354 | if(pressed == NULL) | 354 | if(pressed == NULL) |
@@ -537,34 +537,34 @@ Button::Button(SDL_Rect npos, SDL_Surface* content, bool fancy) | |||
537 | int size = 48; | 537 | int size = 48; |
538 | 538 | ||
539 | SDL_Surface* norm = NULL; | 539 | SDL_Surface* norm = NULL; |
540 | norm = IMG_Load("data/images/fancy_button.bmp"); | 540 | norm = IMG_Load((get_data_path() + "images/fancy_button.bmp").c_str()); |
541 | if(norm == NULL) | 541 | if(norm == NULL) |
542 | { | 542 | { |
543 | cout << "Error loading bmp while creating fancy button!" << endl; | 543 | cout << "Error loading bmp while creating fancy button!" << endl; |
544 | } | 544 | } |
545 | SDL_Surface* inac = NULL; | 545 | SDL_Surface* inac = NULL; |
546 | inac = IMG_Load("data/images/fancy_button_unavailable.bmp"); | 546 | inac = IMG_Load((get_data_path() + "images/fancy_button_unavailable.bmp").c_str()); |
547 | if(inac == NULL) | 547 | if(inac == NULL) |
548 | { | 548 | { |
549 | cout << "Error loading bmp while creating fancy button!" << endl; | 549 | cout << "Error loading bmp while creating fancy button!" << endl; |
550 | } | 550 | } |
551 | SDL_Surface* pres = NULL; | 551 | SDL_Surface* pres = NULL; |
552 | pres = IMG_Load("data/images/fancy_button_clicked.bmp"); | 552 | pres = IMG_Load((get_data_path() + "images/fancy_button_clicked.bmp").c_str()); |
553 | if(pres == NULL) | 553 | if(pres == NULL) |
554 | { | 554 | { |
555 | cout << "Error loading bmp while creating fancy button!" << endl; | 555 | cout << "Error loading bmp while creating fancy button!" << endl; |
556 | } | 556 | } |
557 | SDL_Surface* mous = NULL; | 557 | SDL_Surface* mous = NULL; |
558 | mous = IMG_Load("data/images/fancy_button_selected.bmp"); | 558 | mous = IMG_Load((get_data_path() + "images/fancy_button_selected.bmp").c_str()); |
559 | if(mous == NULL) | 559 | if(mous == NULL) |
560 | { | 560 | { |
561 | cout << "Error loading bmp while creating fancy button!" << endl; | 561 | cout << "Error loading bmp while creating fancy button!" << endl; |
562 | } | 562 | } |
563 | 563 | ||
564 | pressed = IMG_Load("data/images/fancy_button_clicked.bmp"); | 564 | pressed = IMG_Load((get_data_path() + "images/fancy_button_clicked.bmp").c_str()); |
565 | inactive = IMG_Load("data/images/fancy_button_unavailable.bmp"); | 565 | inactive = IMG_Load((get_data_path() + "images/fancy_button_unavailable.bmp").c_str()); |
566 | mouseOver = IMG_Load("data/images/fancy_button_selected.bmp"); | 566 | mouseOver = IMG_Load((get_data_path() + "images/fancy_button_selected.bmp").c_str()); |
567 | normal = IMG_Load("data/images/fancy_button.bmp"); | 567 | normal = IMG_Load((get_data_path() + "images/fancy_button.bmp").c_str()); |
568 | SDL_Rect dest; | 568 | SDL_Rect dest; |
569 | dest.x = size/2 - content->w/2; | 569 | dest.x = size/2 - content->w/2; |
570 | dest.y = size/2 - content->h/2; | 570 | dest.y = size/2 - content->h/2; |
@@ -603,7 +603,7 @@ Scrollbar::Scrollbar(SDL_Rect npos) | |||
603 | else | 603 | else |
604 | horizontal = false; | 604 | horizontal = false; |
605 | dot = NULL; | 605 | dot = NULL; |
606 | dot = IMG_Load("data/images/glowing_dot.png"); | 606 | dot = IMG_Load((get_data_path() + "images/glowing_dot.png").c_str()); |
607 | if(!dot) | 607 | if(!dot) |
608 | { | 608 | { |
609 | cout << "Error loading dot for scrollbar!" << endl; | 609 | cout << "Error loading dot for scrollbar!" << endl; |
@@ -623,13 +623,13 @@ Scrollbar::Scrollbar(SDL_Rect npos) | |||
623 | SDL_Surface* barEnd2 = NULL; | 623 | SDL_Surface* barEnd2 = NULL; |
624 | if(horizontal) | 624 | if(horizontal) |
625 | { | 625 | { |
626 | barEnd1 = IMG_Load("data/images/scrollbar_end_h1.png"); | 626 | barEnd1 = IMG_Load((get_data_path() + "images/scrollbar_end_h1.png").c_str()); |
627 | barEnd2 = IMG_Load("data/images/scrollbar_end_h2.png"); | 627 | barEnd2 = IMG_Load((get_data_path() + "images/scrollbar_end_h2.png").c_str()); |
628 | } | 628 | } |
629 | else | 629 | else |
630 | { | 630 | { |
631 | barEnd1 = IMG_Load("data/images/scrollbar_end_v1.png"); | 631 | barEnd1 = IMG_Load((get_data_path() + "images/scrollbar_end_v1.png").c_str()); |
632 | barEnd2 = IMG_Load("data/images/scrollbar_end_v2.png"); | 632 | barEnd2 = IMG_Load((get_data_path() + "images/scrollbar_end_v2.png").c_str()); |
633 | } | 633 | } |
634 | if(!barEnd1 || !barEnd2) | 634 | if(!barEnd1 || !barEnd2) |
635 | { | 635 | { |
@@ -654,9 +654,9 @@ Scrollbar::Scrollbar(SDL_Rect npos) | |||
654 | } | 654 | } |
655 | SDL_Surface* barMiddle = NULL; | 655 | SDL_Surface* barMiddle = NULL; |
656 | if(horizontal) | 656 | if(horizontal) |
657 | barMiddle = IMG_Load("data/images/scrollbar_h.png"); | 657 | barMiddle = IMG_Load((get_data_path() + "images/scrollbar_h.png").c_str()); |
658 | else | 658 | else |
659 | barMiddle = IMG_Load("data/images/scrollbar_v.png"); | 659 | barMiddle = IMG_Load((get_data_path() + "images/scrollbar_v.png").c_str()); |
660 | if(!barMiddle) | 660 | if(!barMiddle) |
661 | { | 661 | { |
662 | cout << "Error in middle of bar!" << endl; | 662 | cout << "Error in middle of bar!" << endl; |