...
 
Commits (87)
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "ovassvepCCommandShipControl.h"
......@@ -7,9 +6,7 @@
using namespace OpenViBESSVEP;
CCommandShipControl::CCommandShipControl(CShooterApplication* poApplication)
: ICommandVRPNButton(poApplication, "SSVEP_VRPN_ShipControl")
{
}
: ICommandVRPNButton(poApplication, "SSVEP_VRPN_ShipControl") {}
void CCommandShipControl::execute(int iButton, int iState)
{
......@@ -21,12 +18,12 @@ void CCommandShipControl::execute(int iButton, int iState)
l_poShooterApplication->getShip()->shoot();
break;
case 1:
l_poShooterApplication->getShip()->rotate( -6 );
l_poShooterApplication->getShip()->rotate(-6);
break;
case 2:
l_poShooterApplication->getShip()->rotate( 6 );
l_poShooterApplication->getShip()->rotate(6);
break;
}
}
#endif
\ No newline at end of file
#endif
#ifndef __OpenViBEApplication_CCommandShipControl_H__
#define __OpenViBEApplication_CCommandShipControl_H__
#pragma once
#include "../ovassvepICommandVRPNButton.h"
......@@ -9,14 +8,10 @@ namespace OpenViBESSVEP
class CCommandShipControl : public ICommandVRPNButton
{
public:
CCommandShipControl(CShooterApplication* poApplication);
~CCommandShipControl() {};
void execute(int iButton, int iState);
public:
CCommandShipControl(CShooterApplication* poApplication);
~CCommandShipControl() override {}
void execute(int iButton, int iState) override;
};
}
#endif // __OpenViBEApplication_CCommandShipControl_H__
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "ovassvepCCommandTargetControl.h"
......@@ -10,7 +9,7 @@ using namespace OpenViBE::Kernel;
CCommandTargetControl::CCommandTargetControl(CShooterApplication* poApplication)
: ICommandVRPNButton(poApplication, "SSVEP_VRPN_ShooterTarget")
{
m_poVRPNServer = CVRPNServer::getInstance( poApplication );
m_poVRPNServer = CVRPNServer::getInstance(poApplication);
m_poVRPNServer->addButton("SSVEP_VRPN_TargetRequest", 1);
}
......@@ -43,4 +42,4 @@ void CCommandTargetControl::execute(int iButton, int iState)
}
}
#endif
\ No newline at end of file
#endif
#ifndef __OpenViBEApplication_CCommandTargetControl_
#define __OpenViBEApplication_CCommandTargetControl_
#pragma once
#include "../ovassvepICommandVRPNButton.h"
#include "../ovassvepCVRPNServer.h"
......@@ -10,18 +9,14 @@ namespace OpenViBESSVEP
class CCommandTargetControl : public ICommandVRPNButton
{
public:
CCommandTargetControl(CShooterApplication* poApplication);
~CCommandTargetControl() {};
public:
CCommandTargetControl(CShooterApplication* poApplication);
~CCommandTargetControl() override {}
void execute(int iButton, int iState);
void processFrame();
private:
CVRPNServer* m_poVRPNServer;
void execute(int iButton, int iState) override;
void processFrame() override;
private:
CVRPNServer* m_poVRPNServer = nullptr;
};
}
#endif // __OpenViBEApplication_CCommandTargetControl_
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "ovassvepCShooterApplication.h"
......@@ -10,7 +9,7 @@
using namespace Ogre;
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace Kernel;
using namespace OpenViBESSVEP;
#if !((CEGUI_VERSION_MAJOR > 0) || (CEGUI_VERSION_MINOR >= 8))
......@@ -21,11 +20,7 @@ namespace CEGUI
#endif
CShooterApplication::CShooterApplication()
: CApplication(),
m_bTargetRequest( false ),
m_poShip( NULL )
{
}
: CApplication() {}
CShooterApplication::~CShooterApplication()
{
......@@ -33,63 +28,63 @@ CShooterApplication::~CShooterApplication()
delete m_poShip;
}
bool CShooterApplication::setup(OpenViBE::Kernel::IKernelContext* poKernelContext)
bool CShooterApplication::setup(IKernelContext* poKernelContext)
{
if (!CApplication::setup(poKernelContext))
{
// If setup failed, logmanager may be in an unusable state, use cout
std::cout << "Error: Base application setup failed\n";
return false;
return false;
}
// Create the StarShip object
(*m_poLogManager) << LogLevel_Debug << "+ m_poShip = new CStarShip(...)\n";
m_poShip = new CStarShip( this, m_poSceneNode, 0.3f, &m_oFrequencies );
m_poShip = new CStarShip(this, m_poSceneNode, 0.3f, &m_oFrequencies);
// Initialize the Target class
CShooterTarget::initialize( m_poPainter, m_poSceneNode );
CShooterTarget::initialize(m_poPainter, m_poSceneNode);
// draw the initial text
m_poInstructionsReady = m_poGUIWindowManager->createWindow("TaharezLook/StaticImage", "InstructionsReady");
m_poInstructionsReady->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)) );
m_poInstructionsReady->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
m_poInstructionsReady->setSize(CEGUI::USize(CEGUI::UDim(0.0f, 640.f), CEGUI::UDim(0.0f, 32.f)));
#if (CEGUI_VERSION_MAJOR > 0) || (CEGUI_VERSION_MINOR >= 8)
m_poSheet->addChild(m_poInstructionsReady);
CEGUI::ImageManager::getSingleton().addFromImageFile("InstructionsReady","InstructionText-Start.png");
m_poInstructionsReady->setProperty("Image","InstructionsReady");
CEGUI::ImageManager::getSingleton().addFromImageFile("InstructionsReady", "InstructionText-Start.png");
m_poInstructionsReady->setProperty("Image", "InstructionsReady");
#else
m_poSheet->addChildWindow(m_poInstructionsReady);
m_sheet->addChildWindow(m_poInstructionsReady);
CEGUI::ImagesetManager::getSingleton().createFromImageFile("InstructionsReady", "InstructionText-Start.png");
m_poInstructionsReady->setProperty("Image", "set:InstructionsReady image:full_image");
#endif
m_poInstructionsReady->setProperty("FrameEnabled","False");
m_poInstructionsReady->setProperty("BackgroundEnabled","False");
m_poInstructionsReady->setProperty("FrameEnabled", "False");
m_poInstructionsReady->setProperty("BackgroundEnabled", "False");
m_poInstructionsReady->setVisible(true);
// Create commands
(*m_poLogManager) << LogLevel_Debug << "+ addCommand(new CCommandStartStop(...)\n";
this->addCommand(new CCommandStartStop( this ));
this->addCommand(new CCommandStartStop(this));
(*m_poLogManager) << LogLevel_Debug << "+ addCommand(new CCommandStimulatorControl(...))\n";
this->addCommand(new CCommandStimulatorControl( this ));
this->addCommand(new CCommandStimulatorControl(this));
(*m_poLogManager) << LogLevel_Debug << "+ addCommand(new CCommandTargetControl(...)\n";
this->addCommand(new CCommandTargetControl( this ));
this->addCommand(new CCommandTargetControl(this));
(*m_poLogManager) << LogLevel_Debug << "+ addCommand(new CCommandShipControl(...))\n";
this->addCommand(new CCommandShipControl( this ));
this->addCommand(new CCommandShipControl(this));
return true;
}
void CShooterApplication::processFrame(OpenViBE::uint32 ui32CurrentFrame)
void CShooterApplication::processFrame(uint32_t ui32CurrentFrame)
{
CApplication::processFrame(ui32CurrentFrame);
m_poShip->processFrame( ui32CurrentFrame );
m_poShip->processFrame(ui32CurrentFrame);
if (m_poShip->isShooting())
{
......@@ -106,9 +101,9 @@ void CShooterApplication::processFrame(OpenViBE::uint32 ui32CurrentFrame)
}
}
void CShooterApplication::addTarget(OpenViBE::uint32 ui32TargetPosition)
void CShooterApplication::addTarget(uint32_t ui32TargetPosition)
{
m_oTargets.push_back( CShooterTarget::createTarget( Ogre::Radian( Math::PI * 2 / 360 * 45 * ui32TargetPosition ) ) );
m_oTargets.push_back(CShooterTarget::createTarget(Radian(Math::PI * 2 / 360 * 45 * ui32TargetPosition)));
}
void CShooterApplication::startExperiment()
......@@ -116,7 +111,7 @@ void CShooterApplication::startExperiment()
m_bTargetRequest = true;
CApplication::startExperiment();
m_poInstructionsReady->setVisible( false );
m_poInstructionsReady->setVisible(false);
}
#endif
\ No newline at end of file
#endif
#ifndef __OpenViBEApplication_CShooterApplication_H__
#define __OpenViBEApplication_CShooterApplication_H__
#pragma once
#include <iostream>
......@@ -13,37 +12,30 @@
namespace OpenViBESSVEP
{
class CShooterApplication : public CApplication
{
public:
CShooterApplication();
~CShooterApplication();
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext);
CStarShip* getShip()
{
return m_poShip;
}
void startExperiment();
void addTarget(OpenViBE::uint32 ui32TargetPosition);
bool m_bTargetRequest;
private:
bool m_bActive;
void processFrame(OpenViBE::uint32 ui32CurrentFrame);
CEGUI::Window* m_poInstructionsReady;
CStarShip* m_poShip;
std::vector<CShooterTarget*> m_oTargets;
public:
CShooterApplication();
~CShooterApplication() override;
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
CStarShip* getShip() { return m_poShip; }
void startExperiment() override;
void addTarget(uint32_t ui32TargetPosition);
bool m_bTargetRequest = false;
private:
bool m_bActive = false;
void processFrame(uint32_t ui32CurrentFrame) override;
CEGUI::Window* m_poInstructionsReady = nullptr;
CStarShip* m_poShip = nullptr;
std::vector<CShooterTarget*> m_oTargets;
};
}
#endif // __OpenViBEApplication_CShooterApplication_H__
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "ovassvepCShooterTarget.h"
......@@ -6,42 +5,41 @@
using namespace OpenViBESSVEP;
Ogre::SceneNode* CShooterTarget::m_poParentNode = nullptr;
CBasicPainter* CShooterTarget::m_poPainter = nullptr;
CBasicPainter* CShooterTarget::m_poPainter = nullptr;
void CShooterTarget::initialize( CBasicPainter* poPainter, Ogre::SceneNode* poParentNode )
void CShooterTarget::initialize(CBasicPainter* poPainter, Ogre::SceneNode* poParentNode)
{