News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

Zap::Barrier class Reference

Zap::Barrier Class Reference

#include <barrier.h>

Inheritance diagram for Zap::Barrier:

Zap::GameObject TNL::NetObject TNL::Object

Detailed Description

The Barrier class represents rectangular barriers that player controlled Ship instances cannot pass through.

Barrier objects, once created, never change state, simplifying the pack/unpack update methods. Barriers are constructed as an expanded line segment.


Public Types

enum  { BarrierWidth = 50 }

Public Member Functions

 Barrier (Point st=Point(), Point e=Point(), F32 width=BarrierWidth)
 Barrier constructor.

void onAddedToGame (Game *theGame)
 Adds the server object to the net interface's scope always list.

void render (U32 layer)
 renders this barrier by drawing the render line segments,

S32 getRenderSortValue ()
 returns a sorting key for the object. Barriers should sort behind other objects

bool getCollisionPoly (Vector< Point > &polyPoints)
 returns the collision polygon of this barrier, which is the boundary extruded from the start,end line segment.

bool collide (GameObject *otherObject)
 collide always returns true for Barrier objects.

void clipRenderLinesToPoly (Vector< Point > &polyPoints)
 clips the current set of render lines against the polygon passed as polyPoints.

 TNL_DECLARE_CLASS (Barrier)

Data Fields

Point start
 The start point of the barrier.

Point end
 The end point of the barrier.

F32 mWidth
U32 mLastBarrierChangeIndex
 Index to check against the global counter - if it is different, then this barrier's polygon outline will be clipped against all adjacent barriers.

Vector< PointmRenderLineSegments
 The clipped line segments representing this barrier.


Static Public Attributes

U32 mBarrierChangeIndex
 Global counter that is incremented every time a new barrier is added on the client.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
BarrierWidth  The width, in game units of the barrier.


Constructor & Destructor Documentation

Zap::Barrier::Barrier Point  st = Point(),
Point  e = Point(),
F32  width = BarrierWidth
 

Barrier constructor.


Member Function Documentation

void Zap::Barrier::onAddedToGame Game theGame  )  [virtual]
 

Adds the server object to the net interface's scope always list.

Reimplemented from Zap::GameObject.

void Zap::Barrier::render U32  layer  )  [virtual]
 

renders this barrier by drawing the render line segments,

Reimplemented from Zap::GameObject.

S32 Zap::Barrier::getRenderSortValue  )  [inline, virtual]
 

returns a sorting key for the object. Barriers should sort behind other objects

Reimplemented from Zap::GameObject.

bool Zap::Barrier::getCollisionPoly Vector< Point > &  polyPoints  )  [virtual]
 

returns the collision polygon of this barrier, which is the boundary extruded from the start,end line segment.

Reimplemented from Zap::GameObject.

bool Zap::Barrier::collide GameObject otherObject  )  [inline, virtual]
 

collide always returns true for Barrier objects.

Reimplemented from Zap::GameObject.

void Zap::Barrier::clipRenderLinesToPoly Vector< Point > &  polyPoints  ) 
 

clips the current set of render lines against the polygon passed as polyPoints.

Zap::Barrier::TNL_DECLARE_CLASS Barrier   ) 
 


Field Documentation

Point Zap::Barrier::start
 

The start point of the barrier.

Point Zap::Barrier::end
 

The end point of the barrier.

F32 Zap::Barrier::mWidth
 

U32 Zap::Barrier::mBarrierChangeIndex [static]
 

Global counter that is incremented every time a new barrier is added on the client.

U32 Zap::Barrier::mLastBarrierChangeIndex
 

Index to check against the global counter - if it is different, then this barrier's polygon outline will be clipped against all adjacent barriers.

Vector<Point> Zap::Barrier::mRenderLineSegments
 

The clipped line segments representing this barrier.