summary refs log tree commit diff stats
path: root/hslist.h
blob: c1db137ff87fc2a4c23674787eb4da028f9dd40f (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <SDL.h>
#include <vector>
#include "highscore.h"
#include "state.h"

#ifndef HSLIST_H
#define HSLIST_H

typedef std::vector<Highscore*> hslist_t;

void resetRanks(hslist_t in);

class HighscoreList
{
	public:
		SDL_Surface* render();

	protected:
		hslist_t getLocalHighscores();
		hslist_t getGlobalHighscores();

		hslist_t hslist;
};

class LocalHighscoreList : public HighscoreList {
	public:
		LocalHighscoreList();
		int addHighscore(Highscore* h);
		void writeHighscores();
};

class GlobalHighscoreList : public HighscoreList {
	public:
		GlobalHighscoreList();
		SDL_Surface* render();

	private:
		typedef HighscoreList super;

	protected:
		bool fail;
};

class ChooseHighscoreListState : public State {
	public:
		State* operator() (SDL_Renderer* renderer);
};

class DisplayLocalHighscoreListState : public State {
	public:
		State* operator() (SDL_Renderer* renderer);
};

class DisplayAndReturnLocalHighscoreListState : public State {
	public:
		State* operator() (SDL_Renderer* renderer);
};

class DisplayGlobalHighscoreListState : public State {
	public:
		State* operator() (SDL_Renderer* renderer);
		
	protected:
		SDL_Surface* list_s;
		SDL_Texture* list;
		GlobalHighscoreList* lhl;
		SDL_mutex* m;
		
	private:
		static int LoadHighscoreList(void* pParam);
};

class EnterHighscoreState : public State {
	public:
		EnterHighscoreState(int level);
		State* operator() (SDL_Renderer* renderer);
		
	private:
		int level;
		int lp;
		char* hsname;
		SDL_Texture* newName;
};

class NewHighscoreState : public State {
	public:
		NewHighscoreState(Highscore* h);
		State* operator() (SDL_Renderer* renderer);
		
	private:
		Highscore* h;
};

#endif