00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _MENU_H
00026
00027 #include <stdio.h>
00028 #include <GL/gl.h>
00029 #include <GL/glu.h>
00030 #include <SDL/SDL.h>
00031 #ifdef __APPLE__
00032 #include <SDL_image/SDL_image.h>
00033 #else
00034 #include <SDL/SDL_image.h>
00035 #endif
00036 #include <string>
00037 #include <iostream>
00038 #include <fstream>
00039 #include <cmath>
00040 #include <cassert>
00041 #include <list>
00042 #include <vector>
00043
00044 using namespace std;
00045
00046 #include "quat.h"
00047 #include "utility.h"
00048 #include "textures.h"
00049 #include "font.h"
00050 #include "controls.h"
00051 #include "keyman.h"
00052 #include "timer.h"
00053 #include "replay.h"
00054 #include "vamosworld.h"
00055 #include "gamestate.h"
00056 #include "multiplay.h"
00057
00058 #include <vamos/world/World.h>
00059 #include <vamos/body/Wheel.h>
00060 #include <vamos/body/Fuel_Tank.h>
00061
00062 #include "globals.h"
00063
00064 #define NUM_CONTROL_MAPPING 4
00065
00066 class MENU_CONTROLS
00067 {
00068 public:
00069 string * desc;
00070 string * token;
00071 int num_tokens;
00072 int xsel;
00073 };
00074
00075 class MENU_DISPLAY
00076 {
00077 public:
00078 SDL_Rect * modes;
00079 int num_modes;
00080
00081 bool bpp32;
00082 bool fullscreen;
00083
00084 int sel;
00085 };
00086
00087 class MENU_ITEM
00088 {
00089 public:
00090 string name;
00091 float r, g, b;
00092 bool selectable;
00093 int size;
00094 float spaceafter;
00095 string go_to;
00096 };
00097
00098 class MENU_PAGE
00099 {
00100 public:
00101 MENU_PAGE();
00102 string name;
00103 int numitems;
00104 MENU_ITEM * item;
00105 float x, y;
00106 };
00107
00108 class MENU
00109 {
00110 private:
00111 bool in_menu;
00112 bool in_display;
00113 GLuint backbox;
00114 GLuint logo;
00115
00116 int sel;
00117 int subsel;
00118
00119 string curmenu;
00120 list<string> lastmenu;
00121
00122 void Draw2D();
00123
00124 MENU_DISPLAY disp_data;
00125
00126 MENU_PAGE * page;
00127
00128 int numpages;
00129 int pageslot;
00130
00131 ofstream error_log;
00132
00133 void DrawDisplay();
00134 void DrawAutomatic();
00135 MENU_PAGE * curp();
00136
00137 MENU_CONTROLS controlinfo;
00138 void DrawControlSetup();
00139 bool controlwait;
00140 string controlwaittype;
00141 void AssignKey(int kcode);
00142 void BuildControls();
00143 void ToggleControlOpts();
00144 int togglemode;
00145
00146 void DrawSelectCar();
00147 string * cflist;
00148 string * cfabout;
00149 string * cfnames;
00150 int numcf;
00151 void BuildCFList();
00152 void ClearCFList();
00153 float rotation;
00154 GLint last_t;
00155 GLuint sphere_reflection;
00156 void WriteCarSelection();
00157
00158 Vamos_Body::Gl_Car * car;
00159 void LoadCar(string cfile);
00160 void ClearCar();
00161 string selectedcar;
00162
00163 void DrawCalibrate();
00164
00165 void DrawSelectTrack();
00166 void BuildTSList();
00167 void ClearTSList();
00168 string * tslist;
00169 string * tsabout;
00170 int numts;
00171
00172 void DrawNetSetup();
00173 bool net_host;
00174 string net_ip;
00175 string port_input;
00176 bool ip_or_port;
00177
00178 void DrawCustomizeCar();
00179 vector<string> parts;
00180 vector<string> parts_names;
00181 vector<bool> parts_enabled;
00182 unsigned int part_selected;
00183 void ReloadCarParts();
00184
00185 bool loaded;
00186
00187 public:
00188 MENU();
00189 ~MENU();
00190
00191 void Load();
00192 void LoadPage(string pagename);
00193
00194 bool InMenu();
00195 void InMenu(bool new_in_menu);
00196
00197
00198
00199
00200 bool In(string menuname);
00201 void Go(string menuname);
00202
00203 void MenuKey(SDLKey key);
00204 void MenuDraw();
00205
00206 void Draw2D(float x1, float y1, float x2, float y2, GLuint texid, float rotation);
00207
00208 void MainMenu();
00209
00210 void AssignJoyButton(int joynum, int butnum);
00211 void AssignJoyAxis(int joynum, int joyaxis, float val);
00212
00213 void UnbindSlot();
00214 };
00215
00216 #define _MENU_H
00217 #endif