Blender V2.61 - r43446
|
#include <SCA_ISensor.h>
Interface Class for all logic Sensors. Implements pulsemode,pulsefrequency Use of SG_DList element: link sensors to their respective event manager Head: SCA_EventManager::m_sensors Use of SG_QList element: not used
Definition at line 48 of file SCA_ISensor.h.
Definition at line 97 of file SCA_ISensor.h.
SCA_ISensor::SCA_ISensor | ( | SCA_IObject * | gameobj, |
class SCA_EventManager * | eventmgr | ||
) |
Definition at line 56 of file SCA_ISensor.cpp.
References m_eventmgr, m_invert, m_level, m_links, m_neg_pulsemode, m_neg_ticks, m_pos_pulsemode, m_pos_ticks, m_prev_state, m_pulse_frequency, m_reset, m_state, m_suspended, and m_tap.
SCA_ISensor::~SCA_ISensor | ( | ) |
Definition at line 78 of file SCA_ISensor.cpp.
void SCA_ISensor::Activate | ( | class SCA_LogicManager * | logicmgr | ) |
Because we want sensors to share some behaviour, the Activate has
Definition at line 237 of file SCA_ISensor.cpp.
References ActivateControllers(), SCA_LogicManager::AddTriggeredController(), Evaluate(), SCA_IController::IsJustActivated(), IsPositiveTrigger(), m_level, m_linkedcontrollers, m_links, m_neg_pulsemode, m_neg_ticks, m_pos_pulsemode, m_pos_ticks, m_prev_state, m_pulse_frequency, m_state, m_suspended, and m_tap.
Referenced by SCA_MouseManager::NextFrame(), and SCA_JoystickManager::NextFrame().
void SCA_ISensor::ActivateControllers | ( | class SCA_LogicManager * | logicmgr | ) |
Definition at line 226 of file SCA_ISensor.cpp.
References SCA_LogicManager::AddTriggeredController(), SCA_ILogicBrick::IsActive(), and m_linkedcontrollers.
Referenced by Activate().
void SCA_ISensor::ClrLink | ( | ) | [inline] |
Definition at line 187 of file SCA_ISensor.h.
References m_links.
Referenced by SCA_IObject::ReParentLogic().
void SCA_ISensor::DecLink | ( | ) |
Definition at line 152 of file SCA_ISensor.cpp.
References m_links, SCA_ILogicBrick::m_name, STR_String::Ptr(), and UnregisterToManager().
Referenced by SCA_IController::UnlinkSensor().
virtual bool SCA_ISensor::Evaluate | ( | ) | [pure virtual] |
Implemented in SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, SCA_MouseSensor, SCA_PropertySensor, SCA_RandomSensor, KX_ArmatureSensor, KX_MouseFocusSensor, KX_NearSensor, KX_RaySensor, KX_TouchSensor, and KX_NetworkMessageSensor.
Referenced by Activate().
int SCA_ISensor::GetNegTicks | ( | ) | [inline] |
get the number of ticks since the last negative pulse
Definition at line 179 of file SCA_ISensor.h.
References m_neg_ticks.
double SCA_ISensor::GetNumber | ( | ) | [virtual] |
Reimplemented from SCA_ILogicBrick.
Definition at line 127 of file SCA_ISensor.cpp.
References GetState().
int SCA_ISensor::GetPosTicks | ( | ) | [inline] |
get the number of ticks since the last positive pulse
Definition at line 173 of file SCA_ISensor.h.
References m_pos_ticks.
bool SCA_ISensor::GetPrevState | ( | ) | [inline] |
get the previous state of the sensor: positive or negative
Definition at line 167 of file SCA_ISensor.h.
References m_prev_state.
virtual CValue* SCA_ISensor::GetReplica | ( | ) | [pure virtual] |
Implements CValue.
Implemented in SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, SCA_MouseSensor, SCA_PropertySensor, SCA_RandomSensor, KX_ArmatureSensor, KX_MouseFocusSensor, KX_NearSensor, KX_RadarSensor, KX_RaySensor, KX_TouchSensor, and KX_NetworkMessageSensor.
Referenced by SCA_IObject::ReParentLogic().
virtual sensortype SCA_ISensor::GetSensorType | ( | ) | [inline, virtual] |
Reimplemented in KX_NearSensor, KX_RadarSensor, and KX_TouchSensor.
Definition at line 152 of file SCA_ISensor.h.
References ST_NONE.
bool SCA_ISensor::GetState | ( | void | ) | [inline] |
get the state of the sensor: positive or negative
Definition at line 161 of file SCA_ISensor.h.
References m_state.
Referenced by SCA_ExpressionController::FindIdentifier(), GetNumber(), SCA_NANDController::Trigger(), SCA_XORController::Trigger(), SCA_ANDController::Trigger(), SCA_XNORController::Trigger(), SCA_NORController::Trigger(), and SCA_ORController::Trigger().
void SCA_ISensor::IncLink | ( | ) | [inline] |
Definition at line 189 of file SCA_ISensor.h.
References m_links, and RegisterToManager().
Referenced by BL_ConvertSensors(), and SCA_IController::LinkToSensor().
void SCA_ISensor::Init | ( | void | ) | [virtual] |
Reimplemented in SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, SCA_MouseSensor, SCA_PropertySensor, SCA_RandomSensor, KX_ArmatureSensor, KX_MouseFocusSensor, KX_RaySensor, KX_TouchSensor, and KX_NetworkMessageSensor.
Definition at line 147 of file SCA_ISensor.cpp.
References SCA_ILogicBrick::m_name, and STR_String::Ptr().
Referenced by RegisterToManager().
bool SCA_ISensor::IsNoLink | ( | ) | const [inline] |
Definition at line 192 of file SCA_ISensor.h.
References m_links.
bool SCA_ISensor::IsPositiveTrigger | ( | ) | [virtual] |
Reimplemented in SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, SCA_MouseSensor, SCA_PropertySensor, SCA_RandomSensor, KX_ArmatureSensor, KX_MouseFocusSensor, KX_RaySensor, KX_TouchSensor, and KX_NetworkMessageSensor.
Definition at line 89 of file SCA_ISensor.cpp.
References CValue::GetNumber(), SCA_ILogicBrick::m_eventval, and m_invert.
Referenced by Activate().
bool SCA_ISensor::IsSuspended | ( | ) |
Is this sensor switched off?
Definition at line 137 of file SCA_ISensor.cpp.
References m_suspended.
Referenced by SCA_MouseManager::NextFrame(), and SCA_JoystickManager::NextFrame().
void SCA_ISensor::LinkToController | ( | SCA_IController * | controller | ) |
Definition at line 188 of file SCA_ISensor.cpp.
References m_linkedcontrollers.
Referenced by SCA_LogicManager::RegisterToSensor().
void SCA_ISensor::ProcessReplica | ( | ) | [virtual] |
Makes sure any internal data owned by this class is deep copied.
Reimplemented from CValue.
Reimplemented in SCA_RandomSensor, KX_NearSensor, and KX_TouchSensor.
Definition at line 83 of file SCA_ISensor.cpp.
References m_linkedcontrollers.
Referenced by SCA_ActuatorSensor::GetReplica(), KX_ArmatureSensor::GetReplica(), SCA_MouseSensor::GetReplica(), SCA_JoystickSensor::GetReplica(), KX_RaySensor::GetReplica(), SCA_PropertySensor::GetReplica(), and SCA_KeyboardSensor::GetReplica().
void SCA_ISensor::RegisterToManager | ( | ) | [virtual] |
Definition at line 167 of file SCA_ISensor.cpp.
References Init(), m_eventmgr, m_state, and SCA_EventManager::RegisterSensor().
Referenced by IncLink().
void SCA_ISensor::ReParent | ( | SCA_IObject * | parent | ) | [virtual] |
Reimplemented from SCA_ILogicBrick.
Reimplemented in SCA_ActuatorSensor, KX_ArmatureSensor, KX_NearSensor, and KX_TouchSensor.
Definition at line 47 of file SCA_ISensor.cpp.
Referenced by SCA_IObject::ReParentLogic().
void SCA_ISensor::Replace_EventManager | ( | class SCA_LogicManager * | logicmgr | ) |
Definition at line 175 of file SCA_ISensor.cpp.
References SCA_LogicManager::FindEventManager(), SCA_EventManager::GetType(), m_eventmgr, m_links, SCA_EventManager::RegisterSensor(), and SCA_EventManager::RemoveSensor().
Referenced by MergeScene_LogicBrick().
void SCA_ISensor::ReserveController | ( | int | num | ) | [inline] |
Definition at line 139 of file SCA_ISensor.h.
References m_linkedcontrollers.
Referenced by BL_ConvertSensors().
void SCA_ISensor::Resume | ( | void | ) |
void SCA_ISensor::SetInvert | ( | bool | inv | ) |
Set inversion of pulses on or off.
Definition at line 111 of file SCA_ISensor.cpp.
References m_invert.
Referenced by BL_ConvertSensors().
void SCA_ISensor::SetLevel | ( | bool | lvl | ) |
set the level detection on or off
Definition at line 116 of file SCA_ISensor.cpp.
References m_level.
Referenced by BL_ConvertSensors().
void SCA_ISensor::SetPulseMode | ( | bool | posmode, |
bool | negmode, | ||
int | freq | ||
) |
Set parameters for the pulsing behaviour.
posmode | Trigger positive pulses? |
negmode | Trigger negative pulses? |
freq | Frequency to use when doing pulsing. |
Definition at line 103 of file SCA_ISensor.cpp.
References m_neg_pulsemode, m_pos_pulsemode, and m_pulse_frequency.
Referenced by BL_ConvertSensors().
void SCA_ISensor::SetTap | ( | bool | tap | ) |
Definition at line 121 of file SCA_ISensor.cpp.
References m_tap.
Referenced by BL_ConvertSensors().
void SCA_ISensor::Suspend | ( | void | ) |
void SCA_ISensor::UnlinkAllControllers | ( | ) |
Definition at line 210 of file SCA_ISensor.cpp.
References m_linkedcontrollers.
Referenced by SCA_LogicManager::RemoveSensor().
void SCA_ISensor::UnlinkController | ( | SCA_IController * | controller | ) |
Definition at line 193 of file SCA_ISensor.cpp.
References SCA_ILogicBrick::GetName(), CValue::GetName(), SCA_ILogicBrick::GetParent(), SCA_ILogicBrick::m_gameobj, m_linkedcontrollers, and STR_String::ReadPtr().
void SCA_ISensor::UnregisterToManager | ( | ) | [virtual] |
Reimplemented in KX_TouchSensor.
Definition at line 220 of file SCA_ISensor.cpp.
References m_eventmgr, m_links, and SCA_EventManager::RemoveSensor().
Referenced by DecLink(), and SCA_LogicManager::RemoveSensor().
class SCA_EventManager* SCA_ISensor::m_eventmgr [protected] |
Definition at line 52 of file SCA_ISensor.h.
Referenced by SCA_KeyboardSensor::Evaluate(), SCA_MouseSensor::Evaluate(), SCA_JoystickSensor::Evaluate(), RegisterToManager(), Replace_EventManager(), SCA_ISensor(), and UnregisterToManager().
bool SCA_ISensor::m_invert [protected] |
invert the output signal
Definition at line 70 of file SCA_ISensor.h.
Referenced by SCA_PropertySensor::Init(), SCA_JoystickSensor::Init(), SCA_MouseSensor::Init(), SCA_KeyboardSensor::Init(), KX_TouchSensor::Init(), KX_MouseFocusSensor::Init(), SCA_ActuatorSensor::Init(), KX_ArmatureSensor::Init(), KX_RaySensor::Init(), SCA_ActuatorSensor::IsPositiveTrigger(), IsPositiveTrigger(), SCA_JoystickSensor::IsPositiveTrigger(), SCA_MouseSensor::IsPositiveTrigger(), KX_MouseFocusSensor::IsPositiveTrigger(), KX_RaySensor::IsPositiveTrigger(), SCA_AlwaysSensor::IsPositiveTrigger(), SCA_PropertySensor::IsPositiveTrigger(), KX_TouchSensor::IsPositiveTrigger(), SCA_DelaySensor::IsPositiveTrigger(), SCA_KeyboardSensor::IsPositiveTrigger(), SCA_RandomSensor::IsPositiveTrigger(), KX_ArmatureSensor::IsPositiveTrigger(), SCA_ISensor(), and SetInvert().
bool SCA_ISensor::m_level [protected] |
detect level instead of edge
Definition at line 73 of file SCA_ISensor.h.
Referenced by Activate(), SCA_KeyboardSensor::Evaluate(), SCA_PropertySensor::Evaluate(), KX_TouchSensor::Evaluate(), SCA_MouseSensor::Evaluate(), KX_MouseFocusSensor::Evaluate(), SCA_JoystickSensor::Evaluate(), SCA_ActuatorSensor::Evaluate(), KX_ArmatureSensor::Evaluate(), SCA_DelaySensor::Evaluate(), KX_RaySensor::Evaluate(), SCA_ISensor(), and SetLevel().
std::vector<class SCA_IController*> SCA_ISensor::m_linkedcontrollers [protected] |
Definition at line 93 of file SCA_ISensor.h.
Referenced by Activate(), ActivateControllers(), LinkToController(), ProcessReplica(), ReserveController(), UnlinkAllControllers(), and UnlinkController().
int SCA_ISensor::m_links [protected] |
number of connections to controller
Definition at line 85 of file SCA_ISensor.h.
Referenced by Activate(), ClrLink(), DecLink(), IncLink(), IsNoLink(), KX_NearSensor::NewHandleCollision(), KX_TouchSensor::NewHandleCollision(), Replace_EventManager(), SCA_ISensor(), and UnregisterToManager().
bool SCA_ISensor::m_neg_pulsemode [protected] |
Pulse negative pulses?
Definition at line 58 of file SCA_ISensor.h.
Referenced by Activate(), SCA_ISensor(), and SetPulseMode().
int SCA_ISensor::m_neg_ticks [protected] |
Number of ticks since the last negative pulse.
Definition at line 67 of file SCA_ISensor.h.
Referenced by Activate(), GetNegTicks(), and SCA_ISensor().
bool SCA_ISensor::m_pos_pulsemode [protected] |
Pulse positive pulses?
Definition at line 55 of file SCA_ISensor.h.
Referenced by Activate(), SCA_ISensor(), and SetPulseMode().
int SCA_ISensor::m_pos_ticks [protected] |
Number of ticks since the last positive pulse.
Definition at line 64 of file SCA_ISensor.h.
Referenced by Activate(), GetPosTicks(), and SCA_ISensor().
bool SCA_ISensor::m_prev_state [protected] |
previous state (for tap option)
Definition at line 91 of file SCA_ISensor.h.
Referenced by Activate(), GetPrevState(), and SCA_ISensor().
int SCA_ISensor::m_pulse_frequency [protected] |
Repeat frequency in pulse mode.
Definition at line 61 of file SCA_ISensor.h.
Referenced by Activate(), SCA_RandomSensor::Evaluate(), SCA_ISensor(), and SetPulseMode().
bool SCA_ISensor::m_reset [protected] |
sensor has been reset
Definition at line 79 of file SCA_ISensor.h.
Referenced by SCA_KeyboardSensor::Evaluate(), SCA_PropertySensor::Evaluate(), KX_TouchSensor::Evaluate(), SCA_MouseSensor::Evaluate(), KX_MouseFocusSensor::Evaluate(), SCA_JoystickSensor::Evaluate(), SCA_ActuatorSensor::Evaluate(), KX_ArmatureSensor::Evaluate(), SCA_DelaySensor::Evaluate(), KX_RaySensor::Evaluate(), SCA_DelaySensor::Init(), SCA_PropertySensor::Init(), SCA_JoystickSensor::Init(), SCA_MouseSensor::Init(), SCA_KeyboardSensor::Init(), KX_TouchSensor::Init(), KX_MouseFocusSensor::Init(), SCA_ActuatorSensor::Init(), KX_ArmatureSensor::Init(), KX_RaySensor::Init(), and SCA_ISensor().
bool SCA_ISensor::m_state [protected] |
current sensor state
Definition at line 88 of file SCA_ISensor.h.
Referenced by Activate(), GetState(), RegisterToManager(), and SCA_ISensor().
bool SCA_ISensor::m_suspended [protected] |
Sensor must ignore updates?
Definition at line 82 of file SCA_ISensor.h.
Referenced by Activate(), IsSuspended(), KX_NearSensor::NewHandleCollision(), KX_TouchSensor::NewHandleCollision(), Resume(), SCA_ISensor(), and Suspend().
bool SCA_ISensor::m_tap [protected] |
tap mode
Definition at line 76 of file SCA_ISensor.h.
Referenced by Activate(), SCA_KeyboardSensor::Evaluate(), SCA_ISensor(), and SetTap().