Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10642 in orxonox.OLD


Ignore:
Timestamp:
Apr 27, 2007, 12:03:26 AM (17 years ago)
Author:
rennerc
Message:

implemented action box

Location:
branches/vs-enhencements/src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/util/Makefile.am

    r10618 r10642  
    2626                        animation/animation_player.cc \
    2727                        \
    28                         track/track.cc
     28                        track/track.cc \
     29                        track/action_box.cc
    2930
    3031noinst_HEADERS =        \
     
    4950                        animation/t_animation.h \
    5051                        \
    51                         track/track.h
     52                        track/track.h \
     53                        track/action_box.h
  • branches/vs-enhencements/src/util/state.cc

    r10618 r10642  
    5555int State::menuID = -1;
    5656
     57ActionBox* State::actionBox = NULL;
    5758
    5859/**
  • branches/vs-enhencements/src/util/state.h

    r10379 r10642  
    2020class CameraMan;
    2121class ScriptManager;
     22class ActionBox;
    2223
    2324
     
    126127  /** @returns the scroller-travelnode (center of the screen) */
    127128  static PNode* getTravelNode() { return State::travelNode; }
     129 
     130  /** sets the action box (this is where the fighting takes place) */
     131  static void setActionBox( ActionBox* ab ){ State::actionBox = ab; }
     132  /** @returns the action box (this is where the fighting takes place) */
     133  static ActionBox* getActionBox(){ return State::actionBox; }
    128134
    129135
     
    142148  static Player*                player;             //!< A reference to the Player
    143149  static PNode*                 travelNode;         //!< A reference to the scroller-travelnode
     150  static ActionBox*             actionBox;          //!< A reference to the action box
    144151
    145152  static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
  • branches/vs-enhencements/src/util/track/track.cc

    r10641 r10642  
    2929
    3030#include "debug.h"
     31#include "action_box.h"
    3132
    3233ObjectListDefinition(Track);
     
    7475  this->localTime = 0;
    7576  this->pause = false;
     77 
     78  this->actionBox = NULL;
    7679}
    7780
     
    97100     }
    98101     LOAD_PARAM_END_CYCLE(element);
     102     
     103     LoadParam(root, "ActionBox", this, Track, addActionBox );
    99104}
    100105
     
    335340}
    336341
    337 void Track::drawBox() const
    338 {
    339     glMatrixMode(GL_MODELVIEW);
    340     glPushMatrix();
    341 
    342     glPushAttrib(GL_ENABLE_BIT);
    343 
    344     glDisable(GL_LIGHTING);
    345     glDisable(GL_TEXTURE_2D);
    346     glDisable(GL_BLEND);
    347     glLineWidth(2.0);
    348 
    349     glTranslatef (trackNode->getAbsCoor ().x,
    350                   trackNode->getAbsCoor ().y,
    351                   trackNode->getAbsCoor ().z);
    352     Vector tmpRot = trackNode->getAbsDir().getSpacialAxis();
    353     glRotatef (trackNode->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    354 
    355 
    356     glColor3f(1.0, 1.0, 0.0);
    357     glBegin(GL_LINE_STRIP);
    358       glVertex3f(0, height, width);
    359       glVertex3f(0, -height, width);
    360       glVertex3f(0, -height, -width);
    361       glVertex3f(0, height, -width);
    362       glVertex3f(0, height, width);
    363     glEnd();
    364 
    365     glBegin(GL_LINE_STRIP);
    366       glVertex3f(depth, height * stretch, width * stretch);
    367       glVertex3f(depth, -height * stretch, width * stretch);
    368       glVertex3f(depth, -height * stretch, -width * stretch);
    369       glVertex3f(depth, height * stretch, -width * stretch);
    370       glVertex3f(depth, height * stretch, width * stretch);
    371     glEnd();
    372 
    373     glBegin(GL_LINE_STRIP);
    374       glVertex3f(depth, height * stretch, width * stretch);
    375       glVertex3f(0, height, width);
    376       glVertex3f(0, -height, width);
    377       glVertex3f(depth, -height * stretch, width * stretch);
    378     glEnd();
    379 
    380     glBegin(GL_LINE_STRIP);
    381       glVertex3f(depth, height * stretch, -width * stretch);
    382       glVertex3f(0, height, -width);
    383       glVertex3f(0, -height, -width);
    384       glVertex3f(depth, -height * stretch, -width * stretch);
    385     glEnd();
    386 
    387     glPopMatrix();
    388 }
     342/**
     343 * creates new action box and assignes it to this track
     344 * @param width_2 width/2 of near end
     345 * @param height_2 height/2 of near end
     346 * @param depth depth
     347 * @param stretch far end will be stretched with this factor
     348 */
     349void Track::addActionBox( float width_2, float height_2, float depth, float stretch )
     350{
     351  actionBox = new ActionBox( this, width_2, height_2, depth, stretch );
     352}
     353
     354
     355
  • branches/vs-enhencements/src/util/track/track.h

    r10641 r10642  
    1212class PNode;
    1313class TiXmlElement;
     14class ActionBox;
    1415
    1516class Track : public BaseObject
     
    3738
    3839   void drawGraph(float dt = 0.01) const;
    39    void drawBox() const;
    4040
    4141   //float                 startingTime;         //!< The time at which this Track begins.
     
    5353 private:
    5454   void init();
    55 
    56 
     55   
    5756 private:
    5857   CurveType            curveType;              //!< The CurveType the entire TrackSystem will have.
     
    6160   int                  mode;                   //!< Defines the behaviour of the Track.
    6261   bool                 pause;                  //!< Defines if the track runs (false) or not (true)
     62   
     63   ActionBox*           actionBox;
     64   
     65   void addActionBox( float width_2, float height_2, float depth, float stretch );
     66   
     67
    6368};
    6469
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc

    r10641 r10642  
    490490  if( this->entityTrack != NULL && this->isDrawTrack())
    491491    this->entityTrack->drawGraph();
    492   this->entityTrack->drawBox();
    493492
    494493  WorldEntity::draw();
  • branches/vs-enhencements/src/world_entities/spectator.cc

    r10618 r10642  
    2828
    2929#include "player.h"
     30
     31#include "util/track/action_box.h"
    3032
    3133
     
    298300  else if( event.type == KeyMapper::PEV_BACKWARD)
    299301    this->bBackward = event.bPressed; //this->shiftCoor(0,-.1,0);
     302  else if ( event.type == KeyMapper::PEV_JUMP )
     303  {
     304    if ( State::getActionBox() && State::getActionBox()->isPointInBox( this->getAbsCoor() ) )
     305    {
     306      PRINTF(0)("IN BOX\n");
     307    }
     308    else
     309    {
     310      PRINTF(0)("NOT IN BOX\n");
     311    }
     312  }
    300313  else if( event.type == EV_MOUSE_MOTION)
    301314  {
Note: See TracChangeset for help on using the changeset viewer.