summary refs log tree commit diff stats
path: root/hsglobal.cpp
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2013-08-27 11:39:37 -0400
committerStarla Insigna <starla4444@gmail.com>2013-08-27 11:39:37 -0400
commitffd335aca284c286030e2b26f1a02a0441748f46 (patch)
treebcc1c241621fe159ae7ef178122fb41c5f23eb00 /hsglobal.cpp
parentd47da18958b5214def5127e201f60668c566d9bb (diff)
downloadmazeoflife-ffd335aca284c286030e2b26f1a02a0441748f46.tar.gz
mazeoflife-ffd335aca284c286030e2b26f1a02a0441748f46.tar.bz2
mazeoflife-ffd335aca284c286030e2b26f1a02a0441748f46.zip
Started rewriting game from scratch with SDL2
Only the title screen is currently implemented
Diffstat (limited to 'hsglobal.cpp')
-rw-r--r--hsglobal.cpp63
1 files changed, 0 insertions, 63 deletions
diff --git a/hsglobal.cpp b/hsglobal.cpp deleted file mode 100644 index 3076403..0000000 --- a/hsglobal.cpp +++ /dev/null
@@ -1,63 +0,0 @@
1#include "includes.h"
2
3GlobalHighscoreListState::GlobalHighscoreListState()
4{
5 options = SDL_LoadBMP("resources/hlo_rtm.bmp");
6 pointer = SDL_LoadBMP("resources/pointer.bmp");
7
8 list = SDL_CreateRGBSurface(SDL_SWSURFACE || SDL_SRCCOLORKEY, 480, 480, 32, 0,0,0,0);
9 Uint32 bgColor = SDL_MapRGB(list->format, 255, 255, 255);
10 SDL_FillRect(list, NULL, bgColor);
11 SDL_SetColorKey(list, SDL_SRCCOLORKEY, bgColor);
12 TTF_Font* dataFont = loadFont(25);
13 SDL_Color fontColor = {0, 0, 0, 0};
14 SDL_Surface* text = TTF_RenderText_Blended(dataFont, "Fetching highscores....", fontColor);
15 SDL_Rect aSpace = {240-(text->w/2), 240-(text->h/2), text->w, text->h};
16 SDL_BlitSurface(text, NULL, list, &aSpace);
17
18 SDL_Surface* title = TTF_RenderText_Blended(loadFont(40), "Highscore List", fontColor);
19 SDL_Rect tSpace = {240-(title->w/2), 0, title->w, title->h};
20 SDL_BlitSurface(title, NULL, list, &tSpace);
21
22 SDL_Rect oSpace = {0, 440, options->w, options->h};
23 SDL_BlitSurface(options, NULL, list, &oSpace);
24
25 SDL_CreateThread(&LoadHighscoreList, this);
26}
27
28int GlobalHighscoreListState::LoadHighscoreList(void* pParam)
29{
30 GlobalHighscoreList* lhl = new GlobalHighscoreList();
31 ((GlobalHighscoreListState*)pParam)->list = lhl->render();
32
33 SDL_Color fontColor = {0, 0, 0, 0};
34 SDL_Surface* title = TTF_RenderText_Blended(loadFont(40), "Highscore List", fontColor);
35 SDL_Rect tSpace = {240-(title->w/2), 0, title->w, title->h};
36 SDL_BlitSurface(title, NULL, ((GlobalHighscoreListState*)pParam)->list, &tSpace);
37
38 SDL_Rect oSpace = {0, 440, ((GlobalHighscoreListState*)pParam)->options->w, ((GlobalHighscoreListState*)pParam)->options->h};
39 SDL_BlitSurface(((GlobalHighscoreListState*)pParam)->options, NULL, ((GlobalHighscoreListState*)pParam)->list, &oSpace);
40}
41
42void GlobalHighscoreListState::input(SDL_keysym key)
43{
44 if (key.sym == SDLK_RETURN)
45 {
46 changeState(new ChooseHighscoreListState());
47 }
48}
49
50void GlobalHighscoreListState::render(SDL_Surface* screen)
51{
52 SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));
53
54 SDL_BlitSurface(list, NULL, screen, NULL);
55
56 SDL_Rect pSpace;
57 pSpace.x = 137;
58 pSpace.y = 449;
59 pSpace.w = pointer->w;
60 pSpace.h = pointer->h;
61
62 SDL_BlitSurface(pointer, NULL, screen, &pSpace);
63}