1 #pragma once
2 /*	Quantum Minigolf, a computer game illustrating quantum mechanics
3 	Copyright (C) 2007 Friedemann Reinhard <friedemann.reinhard@gmail.com>
4 
5 	This program is free software; you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation; either version 2 of the License, or
8 	(at your option) any later version.
9 
10 	This program is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with this program; if not, write to the Free Software
17 	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19 
20 
21 // TrackSelector -- a class to preload several tracks and have the user choose one of them
22 // It is responsible for the keyboard handling while the user navigates through the menu
23 
24 #include "Renderer.h"
25 #include "ClassicSimulator.h"
26 #include <SDL.h>
27 #include <iostream>
28 #include <vector>
29 #include <list>
30 #include <string>
31 
32 using namespace std;
33 
34 typedef struct{
35 	SDL_Surface *V;
36 	SDL_Surface *hard;
37 	SDL_Surface *soft;
38 }trackrecord;
39 
40 class TrackSelector
41 {
42 public:
43 	TrackSelector(Renderer *renderer, ClassicSimulator *csimulator);
44 	~TrackSelector(void);
45 
46 	// handle the user input in the menu phase (i.e. cycle the
47 	// tracks and then quit or start a new game)
48 	int GetTrack(bool *quantum);
49 
50 private:
51 	SDL_Surface *BlackTrack(void);
52 
53 	Renderer *renderer;  // pointer to the renderer
54 	ClassicSimulator *csimulator; // pointer to the simulator -
55 								 // used to reset csimulator.hard
56 								 // and csimulator.soft
57 	int width; int height;
58 
59 	bool help;  // display help menu
60 
61 	// tracks - a list containing all the pre-loaded tracks
62 	// when the user cycles through the tracks, they are fetched
63 	// from 'tracks' by 'trackiterator'
64 	list<trackrecord *> tracks;
65 	list<trackrecord *>::iterator trackiterator;
66 };
67