-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGames.cc
81 lines (69 loc) · 1.99 KB
/
Games.cc
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
// -*- c++ -*-
// Copyright 2009 Isis Innovation Limited
//
//
// Add your games to the functions below
//
//
#include "Games.h"
#include <gvars3/instances.h>
namespace PTAMM {
using namespace GVars3;
/**
* This function is called by the MapSerializer to load a game based on the name found in a map file.
* It is also caller by the ARDriver to load a game when the user selects it from the GUI menu.
* The path is only used when loading from disk and is the path to the saved data file.
* @param sName Game name
* @param sGameDataFileName saved game data file name
* @return pointer to the loaded game
*/
Game * LoadAGame( std::string sName, std::string sGameDataFileName)
{
Game * pGame = NULL;
if( sName == "None" )
{
cout << "No game to load." << endl;
return NULL;
}
if( sName == "Eyes" ) {
pGame = new EyeGame();
}
else if( sName == "Shooter" ) {
pGame = new ShooterGame();
}
#ifdef ENABLE_MODELS_GAME
else if( sName == "Models" ) {
pGame = new ModelsGame();
}
#endif
///@TODO Add your games here.
// else if( sName == "MY_AR_GAME" ) {
// pGame = new MyARGame();
// }
else
{
cout << "ERROR Unknown game: " << sName << endl;
return NULL;
}
// Load the game data
if( !sGameDataFileName.empty() ) {
pGame->Load(sGameDataFileName);
}
return pGame;
}
/**
* Create the game menu buttons for each game
* Add your games to this list so that they appear in the menu
*/
void InitializeGameMenu()
{
GUI.ParseLine("Menu.AddMenuButton Demos None \"LoadGame None\" Root");
GUI.ParseLine("Menu.AddMenuButton Demos Eyes \"LoadGame Eyes\" Root");
GUI.ParseLine("Menu.AddMenuButton Demos Shooter \"LoadGame Shooter\" Root");
GUI.ParseLine("Menu.AddMenuButton Demos Models \"LoadGame Models\" Root");
///@TODO Add you games here using this template:
// GUI.ParseLine("Menu.AddMenuButton Demos BUTTONLABEL \"LoadGame MY_AR_GAME\" Root");
// change BUTTONLABEL to the text you want
// change MY_AR_GAME to the name used above.
}
}