forked from barak/quantumminigolf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrackSelector.h
68 lines (54 loc) · 2.04 KB
/
TrackSelector.h
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
#pragma once
/* Quantum Minigolf, a computer game illustrating quantum mechanics
Copyright (C) 2007 Friedemann Reinhard <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// TrackSelector -- a class to preload several tracks and have the user choose one of them
// It is responsible for the keyboard handling while the user navigates through the menu
#include "Renderer.h"
#include "ClassicSimulator.h"
#include <SDL.h>
#include <iostream>
#include <vector>
#include <list>
#include <string>
using namespace std;
typedef struct
{
SDL_Surface *V;
SDL_Surface *hard;
SDL_Surface *soft;
} trackrecord;
class TrackSelector
{
public:
TrackSelector (Renderer * renderer, ClassicSimulator * csimulator);
~TrackSelector (void);
// handle the user input in the menu phase (i.e. cycle the
// tracks and then quit or start a new game)
int GetTrack (bool * quantum);
private:
SDL_Surface * BlackTrack (void);
Renderer *renderer; // pointer to the renderer
ClassicSimulator *csimulator; // pointer to the simulator -
// used to reset csimulator.hard
// and csimulator.soft
int width;
int height;
bool help; // display help menu
// tracks - a list containing all the pre-loaded tracks
// when the user cycles through the tracks, they are fetched
// from 'tracks' by 'trackiterator'
list < trackrecord * >tracks;
list < trackrecord * >::iterator trackiterator;
};