Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 18, 2006, 1:57:58 AM (18 years ago)
Author:
patrick
Message:

network: the background of the menu is now rotating (or the other way around :D )

File:
1 edited

Legend:

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

    r6520 r6521  
    2626#include "factory.h"
    2727
     28#include "p_node.h"
    2829#include "world_entity.h"
    2930#include "image_entity.h"
    3031#include "terrain.h"
     32#include "camera.h"
    3133
    3234#include "event_handler.h"
     
    5052
    5153  this->dataTank = new SimpleGameMenuData();
     54
     55  this->cameraVector = Vector(50.0, 0.0, 0.0);
    5256
    5357  this->loadParams(root);
     
    98102  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN);
    99103  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE);
    100 }
    101 
    102 
    103 
    104 bool SimpleGameMenu::start()
    105 {
    106   EventHandler::getInstance()->pushState(ES_MENU);
    107 
    108 
    109 //   const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    110 //   assert(playableList != NULL);
    111 //   std::list<BaseObject*>::const_iterator entity;
     104
     105  this->dataTank->localCamera->setRelCoor(this->cameraVector);
     106}
     107
     108
     109ErrorMessage SimpleGameMenu::loadData()
     110{
     111  GameWorld::loadData();
    112112
    113113  /* get the menu list */
     
    144144  this->menuSelected = this->menuList[this->menuSelectedIndex];
    145145  this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
     146}
     147
     148
     149
     150bool SimpleGameMenu::start()
     151{
     152  EventHandler::getInstance()->pushState(ES_MENU);
    146153
    147154  /* now call the underlying*/
     
    160167
    161168
    162 
    163 /**
    164  * no collision detection in the menu
     169/**
     170 *  override the standard tick for more functionality
     171 */
     172void SimpleGameMenu::tick()
     173{
     174  GameWorld::tick();
     175
     176  this->animateScene(this->dt);
     177}
     178
     179
     180/**
     181 *  no collision detection in the menu
    165182 */
    166183void SimpleGameMenu::collide()
    167 {}
     184{
     185//   this->dataTank->localCamera->
     186}
     187
     188
     189/**
     190 *  animate the scene
     191 */
     192void SimpleGameMenu::animateScene(float dt)
     193{
     194  Quaternion q(0.00005*dt, Vector(0.0, 1.0, 0.0));
     195  this->cameraVector = q.apply(this->cameraVector);
     196  this->dataTank->localCamera->setRelCoor(this->cameraVector);
     197  this->dataTank->localCamera->getTarget()->setRelCoorSoft(0,0,0);
     198}
    168199
    169200
     
    174205void SimpleGameMenu::process(const Event &event)
    175206{
    176   PRINTF(0)("Got Event: %i\n", event.type);
    177 
    178207  if( event.type == SDLK_RETURN)
    179208  {
    180209    if( this->menuSelected == this->menuQuitGame)
    181210    {
    182       this->setNextStoryID(999);
     211      this->setNextStoryID(WORLD_ID_GAMEEND);
    183212      this->stop();
    184213    }
Note: See TracChangeset for help on using the changeset viewer.