Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 12, 2006, 1:13:20 AM (18 years ago)
Author:
patrick
Message:

network: some more menu work. There is no menu visible yet (only for your info)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/simple_game_menu.cc

    r6502 r6504  
    2929#include "terrain.h"
    3030
     31#include "event_handler.h"
     32
    3133#include "cd_engine.h"
    3234
     
    7476{
    7577  /* skip the GameWorld, since it does not define any useful loadParams for this class */
    76   static_cast<StoryEntity*>(this)->loadParams(root);
     78  static_cast<GameWorld*>(this)->loadParams(root);
    7779
    7880  PRINTF(4)("Loaded SimpleGameMenu specific stuff\n");
    7981}
     82
     83
     84/**
     85 * this is executed just before load
     86 *
     87 * since the load function sometimes needs data, that has been initialized
     88 * before the load and after the proceeding storyentity has finished
     89 */
     90ErrorMessage SimpleGameMenu::init()
     91{
     92  /* call underlying init funciton */
     93  GameWorld::init();
     94
     95  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_UP);
     96  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_DOWN);
     97  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN);
     98  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE);
     99}
     100
     101
     102
     103bool SimpleGameMenu::start()
     104{
     105  EventHandler::getInstance()->pushState(ES_MENU);
     106
     107  /* now call the underlying*/
     108  GameWorld::start();
     109}
     110
     111
     112
     113bool SimpleGameMenu::stop()
     114{
     115  EventHandler::getInstance()->popState();
     116
     117  /* now call the underlying*/
     118  GameWorld::stop();
     119}
     120
    80121
    81122
     
    87128
    88129
    89 
     130/**
     131 * event dispatcher funciton
     132 * @param event the incoming event
     133 */
     134void SimpleGameMenu::process(const Event &event)
     135{
     136  PRINTF(0)("Got Event: %i\n", event.type);
     137
     138  if( event.type == SDLK_RETURN)
     139  {
     140    this->stop();
     141  }
     142}
    90143
    91144
     
    164217        this->sky = dynamic_cast<WorldEntity*>(created);
    165218      if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    166       {
    167219        this->terrain = dynamic_cast<Terrain*>(created);
    168         CDEngine::getInstance()->setTerrain(terrain);
    169       }
    170220      element = element->NextSiblingElement();
    171221    }
Note: See TracChangeset for help on using the changeset viewer.