1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#include "includes.h"
GlobalHighscoreListState::GlobalHighscoreListState()
{
LOADIMAGE(options,hlo_rtm)
LOADIMAGE(pointer,pointer)
list = SDL_CreateRGBSurface(SDL_SWSURFACE || SDL_SRCCOLORKEY, 480, 480, 32, 0,0,0,0);
Uint32 bgColor = SDL_MapRGB(list->format, 255, 255, 255);
SDL_FillRect(list, NULL, bgColor);
SDL_SetColorKey(list, SDL_SRCCOLORKEY, bgColor);
TTF_Font* dataFont = loadFont(25);
SDL_Color fontColor = {0, 0, 0, 0};
SDL_Surface* text = TTF_RenderText_Blended(dataFont, "Fetching highscores....", fontColor);
SDL_Rect aSpace = {240-(text->w/2), 240-(text->h/2), text->w, text->h};
SDL_BlitSurface(text, NULL, list, &aSpace);
SDL_Surface* title = TTF_RenderText_Blended(loadFont(40), "Highscore List", fontColor);
SDL_Rect tSpace = {240-(title->w/2), 0, title->w, title->h};
SDL_BlitSurface(title, NULL, list, &tSpace);
SDL_Rect oSpace = {0, 440, options->w, options->h};
SDL_BlitSurface(options, NULL, list, &oSpace);
SDL_CreateThread(&LoadHighscoreList, this);
}
int GlobalHighscoreListState::LoadHighscoreList(void* pParam)
{
GlobalHighscoreList* lhl = new GlobalHighscoreList();
((GlobalHighscoreListState*)pParam)->list = lhl->render();
SDL_Color fontColor = {0, 0, 0, 0};
SDL_Surface* title = TTF_RenderText_Blended(loadFont(40), "Highscore List", fontColor);
SDL_Rect tSpace = {240-(title->w/2), 0, title->w, title->h};
SDL_BlitSurface(title, NULL, ((GlobalHighscoreListState*)pParam)->list, &tSpace);
SDL_Rect oSpace = {0, 440, ((GlobalHighscoreListState*)pParam)->options->w, ((GlobalHighscoreListState*)pParam)->options->h};
SDL_BlitSurface(((GlobalHighscoreListState*)pParam)->options, NULL, ((GlobalHighscoreListState*)pParam)->list, &oSpace);
}
void GlobalHighscoreListState::input(SDL_keysym key)
{
if (key.sym == SDLK_RETURN)
{
changeState(new ChooseHighscoreListState());
}
}
void GlobalHighscoreListState::render(SDL_Surface* screen)
{
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));
SDL_BlitSurface(list, NULL, screen, NULL);
SDL_Rect pSpace;
pSpace.x = 137;
pSpace.y = 449;
pSpace.w = pointer->w;
pSpace.h = pointer->h;
SDL_BlitSurface(pointer, NULL, screen, &pSpace);
}
|