Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4334 in orxonox.OLD


Ignore:
Timestamp:
May 27, 2005, 7:53:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/braches/physics: more modular, with eventHandler

Location:
orxonox/branches/physics/src/subprojects/particles
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/subprojects/particles/framework.cc

    r4333 r4334  
    3838
    3939      // keyhandler returns false if sdl gets quit by some event
    40       framework->keyHandler();
     40      framework->eventHandler();
    4141
    4242      // tick the scene
     
    7676
    7777
    78 bool Framework::keyHandler()
     78bool Framework::eventHandler()
    7979{
    8080  // This is the main loop for the entire program and it will run until done==TRUE
     
    8484    while(SDL_PollEvent(&event))
    8585    {
     86      moduleEventHandler(&event);
     87
    8688      switch (event.type) {
    8789      case SDL_MOUSEMOTION:
     
    141143            quitGui(NULL, NULL);
    142144            break;
    143           case SDLK_c:
    144 
    145             break;
    146           case SDLK_i:
    147             //      ParticleEngine::getInstance()->debug();
    148             break;
    149145          case SDLK_a:
    150146            camera->setRelCoor(camera->getRelCoor() + (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1);
  • orxonox/branches/physics/src/subprojects/particles/framework.h

    r4333 r4334  
    44#include "vector.h"
    55#include "glincl.h"
     6#include "SDL_events.h"
    67
    78#include "gui_gtk.h"
     
    3738
    3839  void moduleInit();
    39   void* moduleInitGui(void);
    40 
     40  void moduleInitGui(void);
     41  void moduleEventHandler(SDL_Event* event);
     42  void moduleTick(float dt);
    4143  void moduleDraw(float dt);
    42   void moduleTick(float dt);
    4344 
    4445  void moduleHelp(void) const;
     
    4950  bool draw(float dt);
    5051  float tick();
    51   bool keyHandler();
     52  bool eventHandler();
    5253  void quit();
    5354
  • orxonox/branches/physics/src/subprojects/particles/particle_fun.cc

    r4333 r4334  
    1818#include "framework.h"
    1919
    20 #include "gui_gtk.h"
    2120#include "physics_engine.h"
    2221#include "particle_engine.h"
     
    3433}
    3534
     35void Framework::moduleEventHandler(SDL_Event* event)
     36{
     37  switch (event->type)
     38    {
     39    case SDL_KEYDOWN:
     40      switch (event->key.keysym.sym)
     41        {
     42        case SDLK_i:
     43          ParticleEngine::getInstance()->debug();
     44          break;
     45        }
     46
     47    }
     48 
     49}
     50
     51void Framework::moduleTick(float dt)
     52{
     53  ParticleEngine::getInstance()->tick(dt);
     54}
    3655
    3756void Framework::moduleDraw(float dt)
    3857{
    3958  ParticleEngine::getInstance()->draw(dt);
    40 }
    41 
    42 
    43 void Framework::moduleTick(float dt)
    44 {
    45   ParticleEngine::getInstance()->tick(dt);
    4659}
    4760
     
    161174
    162175
    163 void* Framework::moduleInitGui(void)
     176void Framework::moduleInitGui(void)
    164177{
    165178  Window* guiMainWindow = NULL;
Note: See TracChangeset for help on using the changeset viewer.