Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

main.h

00001 /***************************************************************************
00002                           main.h  -  description
00003           $Id: main.h 74 2006-11-01 11:33:53Z neoneurone $
00004                              -------------------
00005     begin                : mer mai 28 2003
00006     copyright            : (C) 2003-2005 by Duong-Khang NGUYEN
00007     email                : neoneurone @ users sourceforge net
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   any later version.                                                    *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 
00020 #if !defined(_OPENCITY_MAIN_H_)
00021 #define _OPENCITY_MAIN_H_ 1
00022 
00023 #include "header.h"                 // Checks for headers generated by configure
00024 
00025 /* for reference, included by "SDL_opengl.h"
00026     #include <GL/gl.h>                  // OpenGL
00027     #include <GL/glu.h>
00028    *---
00029     Under Windows, OpenGL 1.2 & 1.3 functionalities are not defined.
00030     They are treated as extensions, that's why we have the following lines
00031     Without this, glEnable( GL_RESCALE_NORMAL ) doesn't work under win32
00032    ----*
00033     #ifdef __WIN32__
00034         #include <GL/glext.h>
00035     #endif
00036 */
00037 
00038 /* for reference, included by GCC's option "-ansi"
00039     #ifndef __STRICT_ANSI__
00040         #define __STRICT_ANSI__ 1       // Let's stay with the standard
00041                                         // This avoids "long long" from SDL.h
00042     #endif
00043 */
00044 #include "SDL.h"                // Simple Directmedia Library
00045 #include "SDL_thread.h"         // thread
00046 #include "SDL_opengl.h"         // portable OpenGL headers
00047 
00048 #include <string>               // New standard not something.h ok ?
00049 using std::string;
00050 
00051 #include "macros.h"             // Our macros
00052 #include "enum.h"               // Our enums
00053 
00054 class UI;
00055 
00056 
00057 // OpenCity's types --> for future releases and porting work
00058     #define OC_LINT long int
00059     #define OC_ULINT unsigned long int
00060     #define OC_SUINT short unsigned int
00061     #define OC_FLOAT float
00062     #define OC_CHAR char
00063     #define OC_BYTE char
00064     #define OC_UBYTE unsigned char
00065 
00066     #define OC_DATE int
00067 
00068 // game default parameters
00069     #define OC_FUND_START 15000
00070     #define OC_R_INCOME_TAX 8
00071     #define OC_C_INCOME_TAX 8
00072     #define OC_I_INCOME_TAX 9
00073     #define OC_INCOME_HELP 10       // let's say this is government help ;)
00074 
00075     #define OC_MAP_HEIGHT_MAX 10
00076     #define OC_MAP_HEIGHT_MIN -10
00077 
00078     #define OC_CITY_W 100       // Watch out ! if you change this you must change
00079     #define OC_CITY_L 100       // the value of OC_SIMULATOR_LAG* too,
00080                                 // It's dangerous !
00081                                 // Don't touch it if you don't know what you do
00082 
00083     #define OC_CHANCE_COUNTER_MAX 300   // help the random method to find a structure
00084                                         // should be equal to 3% of city surface
00085 
00086 // Sound & Music list file's name
00087     #define OC_MUSIC_LIST_FILENAME "music/music.m3u"
00088     #define OC_SOUND_LIST_FILENAME "sound/sound.m3u"
00089 
00090 // OpenCity's config file
00091     #define OC_GRAPHISM_FILE_FILENAME "config/graphism.conf"
00092 
00093 // Simulators' defines.
00094 // Bad values can block your system, don't change them !
00095     #define OC_MS_PER_FRAME 10              // milliseconds delay per frame
00096     #define OC_MS_PER_DAY   1750            // Milliseconds delay per day
00097     #define OC_MS_GLOBAL_LOG_FACTOR     500
00098     #define OC_MS_STRUCTURE_LOG_FACTOR  400
00099 
00100 // OpenGL default view parameters
00101     #define OC_EYE_X_START 200.0            // used for gluLookAt();
00102     #define OC_EYE_Y_START 100.0
00103     #define OC_EYE_Z_START 200.0
00104 
00105     #define OC_DELTA_X_START 0.0            // used for the translation
00106     #define OC_DELTA_Z_START 0.0
00107     #define OC_DELTA_X_STEP  2.0
00108     #define OC_DELTA_Z_STEP  2.0
00109 
00110     #define OC_Y_ROTATE_ANGLE 0.0           // used for the rotation
00111     #define OC_Y_ROTATE_STEP 10.0
00112 
00113     #define OC_CLEAR_COLOR      .0, .0, 0.25, 1.0
00114     #define OC_RED_COLOR        255, 0, 0
00115     #define OC_GREEN_COLOR      0, 255, 0
00116     #define OC_BLUE_COLOR       0, 0, 255
00117     #define OC_YELLOW_COLOR     255, 255, 0
00118     #define OC_PINK_COLOR       255,   0, 255
00119     #define OC_WHITE_COLOR      255, 255, 255
00120     #define OC_BLACK_COLOR      0, 0, 0
00121 
00122     #define OC_LIGHT_MODEL_AMBIENT  0.7, 0.7, 0.7, 1.0
00123 
00124 
00125 
00126    /*=====================================================================*/
00127    /*                       GLOBAL       FUNCTIONS                        */
00128    /*=====================================================================*/
00129 
00130 //========================================================================
00135     string ocHomeDirPrefix( const string & s );
00136 
00137 
00138 //========================================================================
00143     string ocSaveDirPrefix( const string & s );
00144 
00145 
00146    /*=====================================================================*/
00147    /*                         MAIN      FUNCTIONS                         */
00148    /*=====================================================================*/
00149 // Just a routine to print out the error message from the error code.
00150     void ocPerror( const OPENCITY_ERR_CODE & err_code );
00151 
00152 //SDL event treatment call-back functions
00153     void ocKeyboard( const SDL_KeyboardEvent & );
00154     void ocMouseButton( const SDL_MouseButtonEvent & );
00155     void ocMouseMotion( const SDL_MouseMotionEvent & );
00156     void ocResize( const SDL_ResizeEvent & );
00157     void ocExpose( const SDL_ExposeEvent & );
00158     void ocQuit( const int & = 0 );
00159     void ocProcessSDLEvents( void );
00160     void ocSetNewUI( UI* );
00161 
00162 #endif
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 

Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2