Skyscraper 2.0
SBS::Control Class Reference

#include <control.h>

Inheritance diagram for SBS::Control:
Collaboration diagram for SBS::Control:

Public Member Functions

 Control (Object *parent, const std::string &name, bool permanent, const std::string &sound, const std::vector< std::string > &action_names, const std::vector< Action * > &actions, std::vector< std::string > &textures, const std::string &direction, Real width, Real height, bool center, int selection_position)
 
 ~Control ()
 
void Enabled (bool value)
 
bool SetSelectPosition (int position)
 
bool ChangeSelectPosition (int position)
 
bool NextSelectPosition (bool check_state=true)
 
bool PreviousSelectPosition (bool check_state=true)
 
int GetSelectPosition ()
 
std::string GetPositionAction (int position)
 
std::string GetSelectPositionAction ()
 
int GetNextSelectPosition ()
 
int GetPreviousSelectPosition ()
 
int GetPositions ()
 
void PlaySound ()
 
void SetTexture (int position, const std::string &texture)
 
std::string GetTexture (int position)
 
int FindActionPosition (const std::string &name)
 
int FindNumericActionPosition ()
 
bool DoAction ()
 
bool Press (bool reverse=false)
 
void ChangeFloorLight (int floor, bool value)
 
void ChangeLight (bool value)
 
void RemoveAction (Action *action)
 
bool IsEnabled ()
 
bool GetLightStatus ()
 
void OnClick (Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
 
void OnUnclick (bool right)
 
void Report (const std::string &message)
 
bool ReportError (const std::string &message)
 
- Public Member Functions inherited from SBS::Object
 Object (Object *parent)
 
virtual ~Object ()
 
void SetValues (const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
 
bool IsPermanent ()
 
bool IsMovable ()
 
const std::string & GetType ()
 
int GetNumber ()
 
void AddChild (Object *object)
 
ObjectGetChild (int index)
 
int GetChildrenCount ()
 
void RemoveChild (Object *object)
 
SceneNodeGetSceneNode ()
 
void ShowBoundingBox (bool value)
 
virtual void Move (const Vector3 &vector, Real speed=1.0)
 
virtual void Move (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetPosition (const Vector3 &position)
 
void SetPositionRelative (const Vector3 &position)
 
virtual void SetPosition (Real X, Real Y, Real Z)
 
void SetPositionRelative (Real X, Real Y, Real Z)
 
virtual void SetPositionY (Real value)
 
virtual Vector3 GetPosition (bool relative=false)
 
virtual void Rotate (const Vector3 &vector, Real speed=1.0)
 
virtual void Rotate (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetRotation (const Vector3 &rotation)
 
virtual void SetRotation (Real X, Real Y, Real Z)
 
virtual Vector3 GetRotation ()
 
Quaternion GetOrientation (bool relative=false)
 
void SetOrientation (const Quaternion &q, bool relative=false)
 
virtual void OnMove (bool parent)
 
virtual void OnRotate (bool parent)
 
virtual void OnHit ()
 
void NotifyMove (bool parent=false)
 
void NotifyRotate (bool parent=false)
 
virtual void ResetState ()
 
void ChangeParent (Object *new_parent)
 
bool IsGlobal ()
 
void Init (bool children=true)
 
virtual void OnInit ()
 
virtual void Loop ()
 
void RegisterLoop (Object *object)
 
void UnregisterLoop (Object *object)
 
std::string GetNameBase ()
 
template<typename T >
bool IsType ()
 
template<typename T >
T * ConvertTo ()
 
- Public Member Functions inherited from SBS::ObjectBase
 ObjectBase (Object *parent)
 
virtual ~ObjectBase ()
 
ObjectGetParent ()
 
SBSGetRoot ()
 
void SetName (const std::string &name)
 
const std::string & GetName ()
 
std::string GetNameBase ()
 
- Public Member Functions inherited from SBS::Lock
 Lock (Object *parent)
 
virtual ~Lock ()
 
void SetLocked (bool value, int keyid)
 
bool IsLocked ()
 
bool ToggleLock (bool force=false)
 
int GetKeyID ()
 

Public Attributes

std::string Direction
 
- Public Attributes inherited from SBS::Object
std::string command
 
std::string command_processed
 
std::string context
 
int linenum
 
std::string includefile
 
bool parent_deleting
 

Private Attributes

MeshObjectControlMesh
 
int current_position
 
std::vector< std::string > TextureArray
 
std::vector< std::string > ActionNames
 
std::vector< Action * > Actions
 
Soundsound
 
bool light_status
 
bool is_enabled
 
bool action_hold
 
bool action_result
 

Additional Inherited Members

- Protected Member Functions inherited from SBS::Object
void EnableLoop (bool value)
 
void LoopChildren ()
 
bool SelfDestruct ()
 
- Protected Attributes inherited from SBS::ObjectBase
SBSsbs
 

Detailed Description

Definition at line 31 of file control.h.

Constructor & Destructor Documentation

◆ Control()

SBS::Control::Control ( Object * parent,
const std::string & name,
bool permanent,
const std::string & sound,
const std::vector< std::string > & action_names,
const std::vector< Action * > & actions,
std::vector< std::string > & textures,
const std::string & direction,
Real width,
Real height,
bool center,
int selection_position )

◆ ~Control()

Member Function Documentation

◆ ChangeFloorLight()

void SBS::Control::ChangeFloorLight ( int floor,
bool value )

Definition at line 432 of file control.cpp.

References ChangeSelectPosition(), FindActionPosition(), light_status, and SBS::ToString().

Here is the call graph for this function:

◆ ChangeLight()

void SBS::Control::ChangeLight ( bool value)

Definition at line 453 of file control.cpp.

References ChangeSelectPosition(), FindActionPosition(), FindNumericActionPosition(), and light_status.

Here is the call graph for this function:

◆ ChangeSelectPosition()

bool SBS::Control::ChangeSelectPosition ( int position)

Definition at line 202 of file control.cpp.

References current_position, and SetSelectPosition().

Referenced by ChangeFloorLight(), ChangeLight(), NextSelectPosition(), and PreviousSelectPosition().

Here is the call graph for this function:

◆ DoAction()

bool SBS::Control::DoAction ( )

Definition at line 358 of file control.cpp.

References action_hold, ActionNames, Actions, current_position, SBS::SBS::GetAction(), ReportError(), and SBS::ObjectBase::sbs.

Referenced by Press().

Here is the call graph for this function:

◆ Enabled()

void SBS::Control::Enabled ( bool value)
virtual

Reimplemented from SBS::Object.

Definition at line 179 of file control.cpp.

References ControlMesh, SBS::MeshObject::Enabled(), and is_enabled.

Here is the call graph for this function:

◆ FindActionPosition()

int SBS::Control::FindActionPosition ( const std::string & name)

Definition at line 330 of file control.cpp.

References GetPositionAction(), and GetPositions().

Referenced by ChangeFloorLight(), ChangeLight(), and SBS::ButtonPanel::SetControls().

Here is the call graph for this function:

◆ FindNumericActionPosition()

int SBS::Control::FindNumericActionPosition ( )

Definition at line 344 of file control.cpp.

References GetPositionAction(), GetPositions(), and SBS::IsNumeric().

Referenced by ChangeLight().

Here is the call graph for this function:

◆ GetLightStatus()

bool SBS::Control::GetLightStatus ( )
inline

Definition at line 61 of file control.h.

Referenced by SBS::Elevator::CancelHallCall().

◆ GetNextSelectPosition()

int SBS::Control::GetNextSelectPosition ( )

Definition at line 224 of file control.cpp.

References current_position, and GetPositions().

Referenced by NextSelectPosition(), and Press().

Here is the call graph for this function:

◆ GetPositionAction()

std::string SBS::Control::GetPositionAction ( int position)

Definition at line 273 of file control.cpp.

References ActionNames, Actions, SBS::SBS::GetAction(), and SBS::ObjectBase::sbs.

Referenced by FindActionPosition(), FindNumericActionPosition(), GetSelectPositionAction(), and Press().

Here is the call graph for this function:

◆ GetPositions()

int SBS::Control::GetPositions ( )

◆ GetPreviousSelectPosition()

int SBS::Control::GetPreviousSelectPosition ( )

Definition at line 246 of file control.cpp.

References current_position, and GetPositions().

Referenced by Press(), and PreviousSelectPosition().

Here is the call graph for this function:

◆ GetSelectPosition()

int SBS::Control::GetSelectPosition ( )

Definition at line 267 of file control.cpp.

References current_position.

◆ GetSelectPositionAction()

std::string SBS::Control::GetSelectPositionAction ( )

Definition at line 295 of file control.cpp.

References current_position, and GetPositionAction().

Referenced by Press().

Here is the call graph for this function:

◆ GetTexture()

std::string SBS::Control::GetTexture ( int position)

Definition at line 311 of file control.cpp.

References GetPositions(), and TextureArray.

Referenced by Control(), and SetSelectPosition().

Here is the call graph for this function:

◆ IsEnabled()

bool SBS::Control::IsEnabled ( )
inline

Definition at line 60 of file control.h.

◆ NextSelectPosition()

bool SBS::Control::NextSelectPosition ( bool check_state = true)

Definition at line 212 of file control.cpp.

References ChangeSelectPosition(), GetNextSelectPosition(), and SetSelectPosition().

Referenced by OnUnclick(), and Press().

Here is the call graph for this function:

◆ OnClick()

void SBS::Control::OnClick ( Vector3 & position,
bool shift,
bool ctrl,
bool alt,
bool right )
virtual

Reimplemented from SBS::Object.

Definition at line 484 of file control.cpp.

References Press(), and SBS::Lock::ToggleLock().

Here is the call graph for this function:

◆ OnUnclick()

void SBS::Control::OnUnclick ( bool right)
virtual

Reimplemented from SBS::Object.

Definition at line 493 of file control.cpp.

References action_hold, action_result, NextSelectPosition(), and PreviousSelectPosition().

Here is the call graph for this function:

◆ PlaySound()

void SBS::Control::PlaySound ( )

Definition at line 256 of file control.cpp.

References SBS::Sound::Play(), SBS::Sound::SetLoopState(), and sound.

Referenced by Press().

Here is the call graph for this function:

◆ Press()

◆ PreviousSelectPosition()

bool SBS::Control::PreviousSelectPosition ( bool check_state = true)

Definition at line 234 of file control.cpp.

References ChangeSelectPosition(), GetPreviousSelectPosition(), and SetSelectPosition().

Referenced by OnUnclick(), and Press().

Here is the call graph for this function:

◆ RemoveAction()

void SBS::Control::RemoveAction ( Action * action)

Definition at line 472 of file control.cpp.

References Actions.

◆ Report()

void SBS::Control::Report ( const std::string & message)
virtual

Reimplemented from SBS::ObjectBase.

Definition at line 511 of file control.cpp.

References SBS::ObjectBase::GetName(), and SBS::ObjectBase::Report().

Here is the call graph for this function:

◆ ReportError()

bool SBS::Control::ReportError ( const std::string & message)
virtual

Reimplemented from SBS::ObjectBase.

Definition at line 517 of file control.cpp.

References SBS::ObjectBase::GetName(), and SBS::ObjectBase::ReportError().

Referenced by DoAction(), and Press().

Here is the call graph for this function:

◆ SetSelectPosition()

bool SBS::Control::SetSelectPosition ( int position)

◆ SetTexture()

void SBS::Control::SetTexture ( int position,
const std::string & texture )

Definition at line 301 of file control.cpp.

References GetPositions(), and TextureArray.

Here is the call graph for this function:

Member Data Documentation

◆ action_hold

bool SBS::Control::action_hold
private

Definition at line 77 of file control.h.

Referenced by Control(), DoAction(), and OnUnclick().

◆ action_result

bool SBS::Control::action_result
private

Definition at line 78 of file control.h.

Referenced by OnUnclick(), and Press().

◆ ActionNames

std::vector<std::string> SBS::Control::ActionNames
private

Definition at line 71 of file control.h.

Referenced by Control(), DoAction(), GetPositionAction(), and GetPositions().

◆ Actions

std::vector<Action*> SBS::Control::Actions
private

Definition at line 72 of file control.h.

Referenced by Control(), DoAction(), GetPositionAction(), GetPositions(), and RemoveAction().

◆ ControlMesh

MeshObject* SBS::Control::ControlMesh
private

Definition at line 68 of file control.h.

Referenced by Control(), Enabled(), SetSelectPosition(), and ~Control().

◆ current_position

int SBS::Control::current_position
private

◆ Direction

std::string SBS::Control::Direction

Definition at line 34 of file control.h.

Referenced by Control().

◆ is_enabled

bool SBS::Control::is_enabled
private

Definition at line 76 of file control.h.

Referenced by Control(), and Enabled().

◆ light_status

bool SBS::Control::light_status
private

Definition at line 75 of file control.h.

Referenced by ChangeFloorLight(), ChangeLight(), and Control().

◆ sound

Sound* SBS::Control::sound
private

Definition at line 74 of file control.h.

Referenced by Control(), PlaySound(), and ~Control().

◆ TextureArray

std::vector<std::string> SBS::Control::TextureArray
private

Definition at line 70 of file control.h.

Referenced by Control(), GetTexture(), and SetTexture().


The documentation for this class was generated from the following files: