Permalink
Browse files

working on reworking everything for newest dt, works so far

  • Loading branch information...
1 parent d2c1780 commit 3c73744e0bbc0abed5ae5568e541a6a2ac2bac46 @shua shua committed Mar 26, 2012
View
@@ -9,7 +9,7 @@ bool Agent::IsEnabled() const
return mIsEnabled;
}
-void Agent::SetEnabled(bool is_enabled)
+void Agent::setEnabled(bool is_enabled)
{
if(mIsEnabled != is_enabled)
mIsEnabled = is_enabled;
View
@@ -18,7 +18,7 @@ class Agent : public QObject
public:
Agent();
- void SetEnabled(bool is_enabled);
+ void setEnabled(bool is_enabled);
virtual bool OnInitialize() = 0;
@@ -10,7 +10,7 @@ ConfigurationManager::ConfigurationManager()
{
}
-ConfigurationManager* ConfigurationManager::GetInstance()
+ConfigurationManager* ConfigurationManager::getInstance()
{
return mInstance.get();
}
@@ -23,17 +23,17 @@ bool ConfigurationManager::LoadConfig()
// If the file doesn't exist...
if(!config_file.open(QIODevice::ReadOnly))
{
- Logger::Get().Info("The configuration file doesn't exist. Trying to create a new one.");
+ Logger::get().info("The configuration file doesn't exist. Trying to create a new one.");
if(!SaveConfig())
{
- Logger::Get().Error("Failed to open the configuration file.");
+ Logger::get().error("Failed to open the configuration file.");
return false;
}
else
{
- Logger::Get().Info("Created a new configuration file.");
+ Logger::get().info("Created a new configuration file.");
return true;
}
@@ -58,20 +58,20 @@ bool ConfigurationManager::LoadConfig()
}
else
{
- Logger::Get().Error("Failed to read from the configuration file.");
+ Logger::get().error("Failed to read from the configuration file.");
return false;
}
return true;
}
-KeySettings ConfigurationManager::GetKeySettings() const
+KeySettings ConfigurationManager::getKeySettings() const
{
return mKeySettings;
}
-void ConfigurationManager::SetKeySettings(KeySettings key_settings)
+void ConfigurationManager::setKeySettings(KeySettings key_settings)
{
mKeySettings = key_settings;
}
@@ -83,7 +83,7 @@ bool ConfigurationManager::SaveConfig() const
if(!config_file.open(QIODevice::WriteOnly))
{
- Logger::Get().Error("Cannot create the configuration file.");
+ Logger::get().error("Cannot create the configuration file.");
return false;
}
@@ -113,7 +113,7 @@ void ConfigurationManager::_LoadKeySettings(const QDomElement& element)
KeySettings::Function function_code = (KeySettings::Function)key_node.attribute(KEY_FUNCTION).toUInt();
InputManager::InputCode input_code = (InputManager::InputCode)key_node.attribute(KEY_CODE).toUInt();
- mKeySettings.SetKey(function_code, input_code);
+ mKeySettings.setKey(function_code, input_code);
}
}
@@ -123,10 +123,10 @@ QDomElement ConfigurationManager::_SaveKeySettings(QDomDocument& doc) const
for(unsigned function = (unsigned)mKeySettings.Begin() ; function <= (unsigned)mKeySettings.End() ; ++function)
{
- auto element = doc.createElement(mKeySettings.GetName((KeySettings::Function)function));
+ auto element = doc.createElement(mKeySettings.getName((KeySettings::Function)function));
element.setAttribute(KEY_FUNCTION, function);
- element.setAttribute(KEY_CODE, (unsigned)mKeySettings.GetKey((KeySettings::Function)function));
+ element.setAttribute(KEY_CODE, (unsigned)mKeySettings.getKey((KeySettings::Function)function));
key_settings.appendChild(element);
}
@@ -14,15 +14,15 @@
class ConfigurationManager : boost::noncopyable
{
public:
- static ConfigurationManager* GetInstance();
+ static ConfigurationManager* getInstance();
bool LoadConfig();
bool SaveConfig() const;
- KeySettings GetKeySettings() const;
+ KeySettings getKeySettings() const;
- void SetKeySettings(KeySettings key_settings);
+ void setKeySettings(KeySettings key_settings);
private:
void _LoadKeySettings(const QDomElement& element);
@@ -35,4 +35,4 @@ class ConfigurationManager : boost::noncopyable
KeySettings mKeySettings;
};
-#endif
+#endif
@@ -4,7 +4,7 @@
#include <Scene/Scene.hpp>
#include <Physics/PhysicsWorld.hpp>
-#include <BtogreGP.h>
+#include <BtOgreGP.h>
#include <BtOgrePG.h>
FacadeControllerComponent::FacadeControllerComponent(Agent* agent)
@@ -20,8 +20,8 @@ void FacadeControllerComponent::OnInitialize()
{
btTransform start_trans;
start_trans.setIdentity();
- start_trans.setOrigin(BtOgre::Convert::toBullet(GetNode()->GetPosition(Node::SCENE)));
- start_trans.setRotation(BtOgre::Convert::toBullet(GetNode()->GetRotation(Node::SCENE)));
+ start_trans.setOrigin(BtOgre::Convert::toBullet(getNode()->getPosition(Node::SCENE)));
+ start_trans.setRotation(BtOgre::Convert::toBullet(getNode()->getRotation(Node::SCENE)));
btScalar character_height = 1.75;
btScalar character_width = 0.44;
@@ -35,8 +35,8 @@ void FacadeControllerComponent::OnInitialize()
mBtController = std::shared_ptr<btKinematicCharacterController>
(new btKinematicCharacterController(mBtGhostObject.get(), capsule, 1));
- GetNode()->GetScene()->GetPhysicsWorld()->GetBulletWorld()->addCollisionObject(mBtGhostObject.get());
- GetNode()->GetScene()->GetPhysicsWorld()->GetBulletWorld()->addAction(mBtController.get());
+ getNode()->getScene()->getPhysicsWorld()->getBulletWorld()->addCollisionObject(mBtGhostObject.get());
+ getNode()->getScene()->getPhysicsWorld()->getBulletWorld()->addAction(mBtController.get());
Agent* agent = mAgent.get();
bool result = true;
@@ -47,18 +47,18 @@ void FacadeControllerComponent::OnInitialize()
{
if(!QObject::connect(agent, SIGNAL(sMove(Ogre::Vector3)), this, SLOT(_OnMoveChange(Ogre::Vector3))))
{
- Logger::Get().Error("Failed to connect signal sMove.");
+ Logger::get().error("Failed to connect signal sMove.");
result = false;
}
if(!QObject::connect(agent, SIGNAL(sLook(const Ogre::Radian&, const Ogre::Radian&, const Ogre::Radian&)),
this, SLOT(_OnLook(const Ogre::Radian&, const Ogre::Radian&, const Ogre::Radian&))))
{
- Logger::Get().Error("Failed to connect signal sLook.");
+ Logger::get().error("Failed to connect signal sLook.");
result = false;
}
if(!QObject::connect(agent, SIGNAL(sJump(bool)), this, SLOT(_OnJump())))
{
- Logger::Get().Error("Failed to connect signal sJump.");
+ Logger::get().error("Failed to connect signal sJump.");
result = false;
}
}
@@ -70,24 +70,24 @@ void FacadeControllerComponent::OnInitialize()
if(!result)
{
- Logger::Get().Error(QString("Failed to connect one or more signals for ") + this->GetNode()->GetName() + ".");
+ Logger::get().error(QString("Failed to connect one or more signals for ") + this->getNode()->getName() + ".");
}
}
void FacadeControllerComponent::OnEnable()
{
btTransform transform;
transform.setIdentity();
- transform.setOrigin(BtOgre::Convert::toBullet(GetNode()->GetPosition(Node::SCENE)));
- transform.setRotation(BtOgre::Convert::toBullet(GetNode()->GetRotation(Node::SCENE)));
+ transform.setOrigin(BtOgre::Convert::toBullet(getNode()->getPosition(Node::SCENE)));
+ transform.setRotation(BtOgre::Convert::toBullet(getNode()->getRotation(Node::SCENE)));
mBtGhostObject->setWorldTransform(transform);
- GetNode()->GetScene()->GetPhysicsWorld()->GetBulletWorld()->addCollisionObject(mBtGhostObject.get());
+ getNode()->getScene()->getPhysicsWorld()->getBulletWorld()->addCollisionObject(mBtGhostObject.get());
}
void FacadeControllerComponent::OnDisable()
{
- GetNode()->GetScene()->GetPhysicsWorld()->GetBulletWorld()->removeCollisionObject(mBtGhostObject.get());
+ getNode()->getScene()->getPhysicsWorld()->getBulletWorld()->removeCollisionObject(mBtGhostObject.get());
}
void FacadeControllerComponent::OnUpdate(double time_diff)
@@ -96,13 +96,13 @@ void FacadeControllerComponent::OnUpdate(double time_diff)
static Ogre::Quaternion quaternion;
static btTransform trans;
- quaternion = Ogre::Quaternion(GetNode()->GetRotation().getYaw(), Ogre::Vector3(0.0, 1.0, 0.0));
+ quaternion = Ogre::Quaternion(getNode()->getRotation().getYaw(), Ogre::Vector3(0.0, 1.0, 0.0));
move = quaternion * BtOgre::Convert::toOgre(mMove) * mMoveSpeed;
mBtController->setVelocityForTimeInterval(BtOgre::Convert::toBullet(move), 0.5);
trans = mBtGhostObject->getWorldTransform();
- GetNode()->SetPosition(BtOgre::Convert::toOgre(trans.getOrigin()), Node::SCENE);
+ getNode()->setPosition(BtOgre::Convert::toOgre(trans.getOrigin()), Node::SCENE);
mAgent->OnUpdate(time_diff);
}
@@ -112,32 +112,32 @@ void FacadeControllerComponent::OnDeinitialize()
mAgent->OnDeinitialize();
}
-void FacadeControllerComponent::SetMoveSpeed(float move_speed)
+void FacadeControllerComponent::setMoveSpeed(float move_speed)
{
mMoveSpeed = move_speed;
}
-float FacadeControllerComponent::GetMoveSpeed() const
+float FacadeControllerComponent::getMoveSpeed() const
{
return mMoveSpeed;
}
-void FacadeControllerComponent::SetJumpEnabled(bool jump_enabled)
+void FacadeControllerComponent::setJumpEnabled(bool jump_enabled)
{
mJumpEnabled = jump_enabled;
}
-bool FacadeControllerComponent::GetJumpEnabled() const
+bool FacadeControllerComponent::getJumpEnabled() const
{
return mJumpEnabled;
}
-Agent* FacadeControllerComponent::GetAgent() const
+Agent* FacadeControllerComponent::getAgent() const
{
return mAgent.get();
}
-void FacadeControllerComponent::SetAgent(Agent* agent)
+void FacadeControllerComponent::setAgent(Agent* agent)
{
mAgent.reset(agent);
}
@@ -158,7 +158,7 @@ void FacadeControllerComponent::_OnJump()
void FacadeControllerComponent::_OnLook(const Ogre::Radian& pitch, const Ogre::Radian& yaw, const Ogre::Radian& roll)
{
Ogre::Matrix3 orientMatrix;
- GetNode()->GetRotation().ToRotationMatrix(orientMatrix);
+ getNode()->getRotation().ToRotationMatrix(orientMatrix);
Ogre::Radian old_yaw, old_pitch, old_roll;
orientMatrix.ToEulerAnglesYXZ(old_yaw, old_pitch, old_roll);
@@ -178,5 +178,5 @@ void FacadeControllerComponent::_OnLook(const Ogre::Radian& pitch, const Ogre::R
Ogre::Quaternion rot;
rot.FromRotationMatrix(orientMatrix);
- GetNode()->SetRotation(rot);
-}
+ getNode()->setRotation(rot);
+}
@@ -38,30 +38,30 @@ class FacadeControllerComponent : public Component
* Sets the speed the player moves at.
* @param move_speed The maximum speed, in units per second.
*/
- void SetMoveSpeed(float move_speed);
+ void setMoveSpeed(float move_speed);
/**
* Gets the speed the player moves at.
* @returns The player speed, in units per second.
*/
- float GetMoveSpeed() const;
+ float getMoveSpeed() const;
/**
* Sets whether the character can jump or not.
* @param jump_enabled Whether the character can jump or not.
*/
- void SetJumpEnabled(bool jump_enabled);
+ void setJumpEnabled(bool jump_enabled);
/**
* Gets whether the character can jump or not.
* @returns Whether the character can jump or not.
*/
- bool GetJumpEnabled() const;
+ bool getJumpEnabled() const;
- Agent* GetAgent() const;
+ Agent* getAgent() const;
- void SetAgent(Agent* agent);
+ void setAgent(Agent* agent);
private:
void _OnMoveChange(Ogre::Vector3 direction);
@@ -78,4 +78,4 @@ class FacadeControllerComponent : public Component
bool mJumpEnabled; //!< Whether the character can jump or not.
};
-#endif
+#endif
Oops, something went wrong.

0 comments on commit 3c73744

Please sign in to comment.