Changeset 3226 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Dec 20, 2004, 12:27:51 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/orxonox.cc
r3220 r3226 47 47 Orxonox::~Orxonox () 48 48 { 49 Orxonox::singleton _ref = NULL;49 Orxonox::singletonRef = NULL; 50 50 if( world != NULL) delete world; 51 51 if( localinput != NULL) delete world; … … 56 56 57 57 /* this is a singleton class to prevent duplicates */ 58 Orxonox* Orxonox::singleton _ref = 0;58 Orxonox* Orxonox::singletonRef = 0; 59 59 60 60 Orxonox* Orxonox::getInstance (void) 61 61 { 62 if (singleton _ref == NULL)63 singleton _ref = new Orxonox();64 return singleton _ref;62 if (singletonRef == NULL) 63 singletonRef = new Orxonox(); 64 return singletonRef; 65 65 } 66 66 … … 72 72 it's path and name into configfilename 73 73 */ 74 void Orxonox::get _config_file (int argc, char** argv)74 void Orxonox::getConfigFile (int argc, char** argv) 75 75 { 76 76 strcpy (configfilename, "orxonox.conf"); … … 85 85 // config file 86 86 87 get _config_file (argc, argv);87 getConfigFile (argc, argv); 88 88 SDL_Init (SDL_INIT_TIMER); 89 89 // initialize everything 90 if( init _video() == -1) return -1;91 if( init _sound() == -1) return -1;90 if( initVideo() == -1) return -1; 91 if( initSound() == -1) return -1; 92 92 printf("> Initializing input\n"); 93 if( init _input() == -1) return -1;93 if( initInput() == -1) return -1; 94 94 printf("> Initializing networking\n"); 95 if( init _networking () == -1) return -1;95 if( initNetworking () == -1) return -1; 96 96 printf("> Initializing resources\n"); 97 if( init _resources () == -1) return -1;97 if( initResources () == -1) return -1; 98 98 //printf("> Initializing world\n"); 99 99 //if( init_world () == -1) return -1; PB: world will be initialized when started … … 105 105 \brief initializes SDL and OpenGL 106 106 */ 107 int Orxonox::init _video()107 int Orxonox::initVideo() 108 108 { 109 109 printf("> Initializing video\n"); 110 if (SDL_Init 110 if (SDL_Init(SDL_INIT_VIDEO) == -1) 111 111 { 112 112 printf ("could not initialize SDL Video\n"); … … 115 115 // Set video mode 116 116 // TO DO: parse arguments for settings 117 SDL_GL_SetAttribute 118 SDL_GL_SetAttribute 119 SDL_GL_SetAttribute 120 SDL_GL_SetAttribute 117 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 118 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 119 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 120 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 121 121 122 122 int bpp = 16; … … 125 125 Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; 126 126 127 if( 127 if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL) 128 128 { 129 printf 129 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError()); 130 130 SDL_Quit(); 131 131 return -1; … … 133 133 134 134 // Set window labeling 135 SDL_WM_SetCaption( 135 SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 136 136 137 137 // TO DO: Create a cool icon and use it here … … 169 169 \brief initializes the sound engine 170 170 */ 171 int Orxonox::init _sound()171 int Orxonox::initSound() 172 172 { 173 173 printf("> Initializing sound\n"); 174 // SDL_Init 174 // SDL_Init(SDL_INIT_AUDIO); 175 175 printf("Not yet implemented\n"); 176 176 return 0; … … 181 181 \brief initializes input functions 182 182 */ 183 int Orxonox::init _input()183 int Orxonox::initInput() 184 184 { 185 185 // create localinput … … 193 193 \brief initializes network system 194 194 */ 195 int Orxonox::init _networking()195 int Orxonox::initNetworking() 196 196 { 197 197 printf("Not yet implemented\n"); … … 203 203 \brief initializes and loads resource files 204 204 */ 205 int Orxonox::init _resources()205 int Orxonox::initResources() 206 206 { 207 207 printf("Not yet implemented\n"); … … 213 213 \brief initializes the world 214 214 */ 215 int Orxonox::init _world()215 int Orxonox::initWorld() 216 216 { 217 217 //world = new World(); … … 256 256 \param event: an event not handled by the CommandNode 257 257 */ 258 void Orxonox::event _handler(SDL_Event* event)258 void Orxonox::eventHandler(SDL_Event* event) 259 259 { 260 260 // Handle special events such as reshape, quit, focus changes … … 267 267 \return true if the command was handled by the system or false if it may be passed to the WorldEntities 268 268 */ 269 bool Orxonox::system _command(Command* cmd)269 bool Orxonox::systemCommand(Command* cmd) 270 270 { 271 271 /* … … 285 285 \return a pointer to localcamera 286 286 */ 287 Camera* Orxonox::get _camera()287 Camera* Orxonox::getCamera() 288 288 { 289 289 return localcamera; … … 295 295 \return a pointer to localinput 296 296 */ 297 CommandNode* Orxonox::get _localinput()297 CommandNode* Orxonox::getLocalInput() 298 298 { 299 299 return localinput; … … 305 305 \return a pointer to world 306 306 */ 307 World* Orxonox::get _world()307 World* Orxonox::getWorld() 308 308 { 309 309 return world; … … 313 313 314 314 315 int main 315 int main(int argc, char** argv) 316 316 { 317 317 printf(">>> Starting Orxonox <<<\n"); 318 318 Orxonox *orx = Orxonox::getInstance(); 319 319 320 if( 320 if((*orx).init(argc, argv) == -1) 321 321 { 322 322 printf("! Orxonox initialization failed\n"); -
orxonox/trunk/src/orxonox.h
r3224 r3226 22 22 23 23 private: 24 static Orxonox* singleton _ref;24 static Orxonox* singletonRef; 25 25 Orxonox (); 26 26 ~Orxonox (); … … 38 38 Uint32 lastframe; 39 39 40 void get _config_file (int argc, char** argv);40 void getConfigFile (int argc, char** argv); 41 41 42 42 // main loop functions … … 48 48 49 49 // subsystem initialization 50 int init _video ();51 int init _sound ();52 int init _input ();53 int init _networking ();54 int init _resources ();55 int init _world ();50 int initVideo (); 51 int initSound (); 52 int initInput (); 53 int initNetworking (); 54 int initResources (); 55 int initWorld (); 56 56 57 57 public: … … 60 60 void quitGame(); 61 61 62 void event _handler (SDL_Event* event);63 bool system _command (Command* cmd);62 void eventHandler (SDL_Event* event); 63 bool systemCommand (Command* cmd); 64 64 65 65 int init (int argc, char** argv); 66 66 67 CommandNode* get _localinput();68 Camera* get _camera();69 World* get _world();67 CommandNode* getLocalInput(); 68 Camera* getCamera(); 69 World* getWorld(); 70 70 71 71 //void mainLoop(); -
orxonox/trunk/src/player.cc
r3210 r3226 26 26 { 27 27 28 this->obj = new Object 28 this->obj = new Object("reaplow.obj"); 29 29 /* 30 30 objectList = glGenLists(1); … … 54 54 } 55 55 56 Player::~Player ()56 Player::~Player() 57 57 { 58 58 delete this->obj; 59 59 } 60 60 61 void Player::post _spawn()61 void Player::postSpawn() 62 62 { 63 63 travel_speed = 15.0; … … 66 66 bFire = false; 67 67 acceleration = 10.0; 68 set _collision (new CollisionCluster(1.0, Vector(0,0,0)));68 setSollision(new CollisionCluster(1.0, Vector(0,0,0))); 69 69 } 70 70 71 void Player::tick 71 void Player::tick(float time) 72 72 { 73 73 // movement … … 75 75 } 76 76 77 void Player::hit 77 void Player::hit(WorldEntity* weapon, Vector loc) 78 78 { 79 79 } 80 80 81 void Player::destroy 81 void Player::destroy() 82 82 { 83 83 } 84 84 85 void Player::collide (WorldEntity* other,Uint32 ownhitflags, Uint32 otherhitflags)85 void Player::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) 86 86 { 87 87 } 88 88 89 void Player::command 89 void Player::command(Command* cmd) 90 90 { 91 91 //printf("Player|recieved command [%s]\n", cmd->cmd); … … 97 97 } 98 98 99 void Player::draw 99 void Player::draw() 100 100 { 101 101 glMatrixMode(GL_MODELVIEW); … … 103 103 float matrix[4][4]; 104 104 105 glTranslatef(get_placement()->r.x, get_placement()->r.y,get_placement()->r.z);105 glTranslatef(get_placement()->r.x, get_placement()->r.y, get_placement()->r.z); 106 106 get_placement()->w.matrix (matrix); 107 glMultMatrixf 107 glMultMatrixf((float*)matrix); 108 108 109 glMatrixMode 110 glRotatef 109 glMatrixMode(GL_MODELVIEW); 110 glRotatef(-90, 0,1,0); 111 111 obj->draw(); 112 // glCallList 112 // glCallList(objectList); 113 113 114 114 … … 117 117 } 118 118 119 void Player::get _lookat(Location* locbuf)119 void Player::getLookat(Location* locbuf) 120 120 { 121 121 *locbuf = *get_location(); … … 123 123 } 124 124 125 void Player::left _world()125 void Player::leftWorld() 126 126 { 127 127 } 128 128 129 void Player::move 129 void Player::move(float time) 130 130 { 131 131 Vector accel(0.0, 0.0, 0.0); … … 158 158 l->pos = l->pos + accel*time; 159 159 } 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 -
orxonox/trunk/src/player.h
r3224 r3226 16 16 17 17 public: 18 Player 19 ~Player 18 Player(bool isFree = false); 19 ~Player(); 20 20 21 virtual void post_spawn 22 virtual void tick 23 virtual void hit 24 virtual void destroy 25 virtual void collide (WorldEntity* other,Uint32 ownhitflags, Uint32 otherhitflags);26 virtual void command 21 virtual void post_spawn(); 22 virtual void tick(float time); 23 virtual void hit(WorldEntity* weapon, Vector loc); 24 virtual void destroy(); 25 virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 26 virtual void command(Command* cmd); 27 27 28 virtual void draw 29 virtual void get _lookat(Location* locbuf);28 virtual void draw(); 29 virtual void getLookat(Location* locbuf); 30 30 31 virtual void left _world();31 virtual void leftWorld(); 32 32 33 33 private: … … 40 40 Object* obj; 41 41 42 void move 42 void move(float time); 43 43 44 44 }; -
orxonox/trunk/src/world.cc
r3225 r3226 52 52 { 53 53 printf("World::~World() - deleting current world\n"); 54 CommandNode* cn = Orxonox::getInstance()->get _localinput();54 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 55 55 cn->unbind(this->localPlayer); 56 56 cn->reset(); … … 75 75 { 76 76 this->bPause = false; 77 CommandNode* cn = Orxonox::getInstance()->get _localinput();77 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 78 78 cn->addToWorld(this); 79 79 cn->enable(true); … … 148 148 // bind input 149 149 Orxonox *orx = Orxonox::getInstance(); 150 orx->get _localinput()->bind (myPlayer);150 orx->getLocalInput()->bind (myPlayer); 151 151 152 152 // bind camera … … 188 188 // bind input 189 189 Orxonox *orx = Orxonox::getInstance(); 190 orx->get _localinput()->bind (myPlayer);190 orx->getLocalInput()->bind (myPlayer); 191 191 192 192 // bind camera … … 601 601 synchronize(); 602 602 // Process input 603 handle _input();603 handleInput(); 604 604 if( this->bQuitCurrentGame || this->bQuitOrxonox) 605 605 { -
orxonox/trunk/src/world.h
r3225 r3226 78 78 void mainLoop (); 79 79 void synchronize (); 80 void handle _input ();80 void handleInput (); 81 81 void timeSlice (); 82 82 void collision ();
Note: See TracChangeset
for help on using the changeset viewer.