...
 
Commits (40)
......@@ -81,14 +81,14 @@ bool CShooterApplication::setup(IKernelContext* poKernelContext)
return true;
}
void CShooterApplication::processFrame(uint32_t ui32CurrentFrame)
void CShooterApplication::processFrame(const size_t ui32CurrentFrame)
{
CApplication::processFrame(ui32CurrentFrame);
m_poShip->processFrame(ui32CurrentFrame);
if (m_poShip->isShooting())
{
for (std::vector<CShooterTarget*>::iterator it = m_oTargets.begin(); it != m_oTargets.end(); ++it)
for (auto it = m_oTargets.begin(); it != m_oTargets.end(); ++it)
{
if ((*it)->collidesWith(m_poShip->getShotCoordinates()))
{
......@@ -101,7 +101,7 @@ void CShooterApplication::processFrame(uint32_t ui32CurrentFrame)
}
}
void CShooterApplication::addTarget(uint32_t ui32TargetPosition)
void CShooterApplication::addTarget(size_t ui32TargetPosition)
{
m_oTargets.push_back(CShooterTarget::createTarget(Radian(Math::PI * 2 / 360 * 45 * ui32TargetPosition)));
}
......
#pragma once
#include <iostream>
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>
......@@ -21,12 +19,12 @@ namespace OpenViBESSVEP
bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext) override;
CStarShip* getShip() { return m_poShip; }
void startExperiment() override;
void addTarget(uint32_t ui32TargetPosition);
void addTarget(size_t ui32TargetPosition);
bool m_bTargetRequest = false;
private:
void processFrame(uint32_t ui32CurrentFrame) override;
void processFrame(const size_t ui32CurrentFrame) override;
CEGUI::Window* m_poInstructionsReady = nullptr;
CStarShip* m_poShip = nullptr;
......
#pragma once
#include <Ogre.h>
#include <iostream>
#include "../ovassvepCBasicPainter.h"
......
......@@ -11,13 +11,13 @@
using namespace OpenViBESSVEP;
using namespace Ogre;
CStarShip::CStarShip(CApplication* poApplication, SceneNode* poParentNode, Real radius, std::vector<std::pair<uint32_t, uint32_t>>* pFrequencies)
CStarShip::CStarShip(CApplication* poApplication, SceneNode* poParentNode, Real radius, std::vector<std::pair<size_t, size_t>>* pFrequencies)
{
// get configuration and controlling objects
OpenViBE::Kernel::IConfigurationManager* l_poConfigurationManager = poApplication->getConfigurationManager();
CBasicPainter* painter = poApplication->getPainter();
m_rAngularSpeed = (Real)l_poConfigurationManager->expandAsFloat(
"${SSVEP_ShipAngularSpeed}", Math::PI / 60.0f);
m_rAngularSpeed = Real(l_poConfigurationManager->expandAsFloat(
"${SSVEP_ShipAngularSpeed}", Math::PI / 60.0f));
poApplication->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "Ship Angluar Speed : " << m_rAngularSpeed << "\n";
ColourValue lightColor = ColourValue(float(l_poConfigurationManager->expandAsFloat("${SSVEP_TargetLightColourRed}", 1.0f)),
......@@ -105,39 +105,39 @@ CStarShip::CStarShip(CApplication* poApplication, SceneNode* poParentNode, Real
m_poShotNode->attachObject(drawnObject);
}
void CStarShip::processFrame(uint32_t ui32CurrentFrame)
void CStarShip::processFrame(const size_t /*currentFrame*/)
{
m_poShipCannon->processFrame();
m_poShipLeftWing->processFrame();
m_poShipRightWing->processFrame();
if (m_iCurrentRotationCount != 0)
if (m_nCurrentRotation != 0)
{
m_poShipNode->roll(Radian(m_rAngularSpeed * SIGN(m_iCurrentRotationCount)));
m_rCurrentAngle += Radian(m_rAngularSpeed * SIGN(m_iCurrentRotationCount));
m_iCurrentRotationCount -= SIGN(m_iCurrentRotationCount);
m_poShipNode->roll(Radian(m_rAngularSpeed * SIGN(m_nCurrentRotation)));
m_rCurrentAngle += Radian(m_rAngularSpeed * SIGN(m_nCurrentRotation));
m_nCurrentRotation -= SIGN(m_nCurrentRotation);
}
if (m_bIsShooting)
if (m_isShooting)
{
m_rShotDistance += 0.07f;
m_poShotNode->setPosition(0.0, m_rShotDistance, 0.0);
if (m_rShotDistance > 1.5f)
{
m_bIsShooting = false;
m_isShooting = false;
m_poShotNode->setVisible(false);
}
}
}
void CStarShip::rotate(int iRotationCount) { m_iCurrentRotationCount += iRotationCount; }
void CStarShip::rotate(const int nRotation) { m_nCurrentRotation += nRotation; }
void CStarShip::shoot()
{
if (m_bIsShooting) { return; }
if (m_isShooting) { return; }
m_bIsShooting = true;
m_isShooting = true;
m_rShotDistance = 0.0f;
m_poShotNode->setPosition(0.0f, 0.0f, 0.0f);
......
......@@ -13,10 +13,10 @@ namespace OpenViBESSVEP
class CStarShip
{
public:
CStarShip(CApplication* poApplication, Ogre::SceneNode* poParentNode, Ogre::Real radius, std::vector<std::pair<uint32_t, uint32_t>>* pFrequencies);
void processFrame(uint32_t ui32CurrentFrame);
CStarShip(CApplication* poApplication, Ogre::SceneNode* poParentNode, Ogre::Real radius, std::vector<std::pair<size_t, size_t>>* pFrequencies);
void processFrame(const size_t currentFrame);
void rotate(int iRotationCount);
bool isShooting() { return m_bIsShooting; }
bool isShooting() { return m_isShooting; }
void shoot();
std::pair<Ogre::Real, Ogre::Real> getShotCoordinates();
......@@ -29,10 +29,10 @@ namespace OpenViBESSVEP
Ogre::Real m_rAngularSpeed;
Ogre::Radian m_rCurrentAngle;
int m_iCurrentRotationCount = 0;
int m_nCurrentRotation = 0;
Ogre::SceneNode* m_poShotNode = nullptr;
bool m_bIsShooting = false;
bool m_isShooting = false;
Ogre::Real m_rShotDistance;
};
} // namespace OpenViBESSVEP
......@@ -32,9 +32,9 @@ bool CTrainerApplication::setup(IKernelContext* poKernelContext)
// paint targets
uint32_t l_ui32TargetCount = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
size_t l_ui32TargetCount = size_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
for (uint32_t i = 0; i < l_ui32TargetCount; i++) { this->addObject(CTrainerFlickeringObject::createTrainerFlickeringObject(i)); }
for (size_t i = 0; i < l_ui32TargetCount; ++i) { this->addObject(CTrainerFlickeringObject::createTrainerFlickeringObject(i)); }
// draw the initial text
m_poInstructionsReady = m_poGUIWindowManager->createWindow("TaharezLook/StaticImage", "InstructionsReady");
......@@ -73,13 +73,13 @@ bool CTrainerApplication::setup(IKernelContext* poKernelContext)
}
void CTrainerApplication::processFrame(uint32_t frame)
void CTrainerApplication::processFrame(const size_t frame)
{
CApplication::processFrame(frame);
if (!m_bActive) { return; }
if (!m_active) { return; }
for (uint32_t i = 0; i < m_oObjects.size(); i++) { m_oObjects[i]->processFrame(); }
for (size_t i = 0; i < m_oObjects.size(); ++i) { m_oObjects[i]->processFrame(); }
}
void CTrainerApplication::addObject(CTrainerFlickeringObject* obj)
......@@ -90,10 +90,10 @@ void CTrainerApplication::addObject(CTrainerFlickeringObject* obj)
void CTrainerApplication::setTarget(int target)
{
uint32_t currentTime = int(time(nullptr) - m_ttStartTime);
size_t currentTime = int(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << currentTime << " > Target set to " << target << "\n";
for (int i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(target == i); }
for (int i = 0; i < m_oObjects.size(); ++i) { m_oObjects[i]->setTarget(target == i); }
}
void CTrainerApplication::startExperiment()
......@@ -108,18 +108,18 @@ void CTrainerApplication::startExperiment()
void CTrainerApplication::startFlickering()
{
uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
size_t l_ui32CurrentTime = size_t(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Starting Visual Stimulation\n";
m_bActive = true;
m_active = true;
}
void CTrainerApplication::stopFlickering()
{
uint32_t l_ui32CurrentTime = uint32_t(time(nullptr) - m_ttStartTime);
size_t l_ui32CurrentTime = size_t(time(nullptr) - m_ttStartTime);
(*m_poLogManager) << LogLevel_Info << l_ui32CurrentTime << " > Stopping Visual Stimulation\n";
m_bActive = false;
m_active = false;
for (uint32_t i = 0; i < m_oObjects.size(); i++) { m_oObjects[i]->setVisible(true); }
for (size_t i = 0; i < m_oObjects.size(); ++i) { m_oObjects[i]->setVisible(true); }
this->setTarget(-1);
}
......
#pragma once
#include <iostream>
#include <CEGUI.h>
#include "../ovassvepCApplication.h"
......@@ -23,8 +22,8 @@ namespace OpenViBESSVEP
private:
bool m_bActive = false;
void processFrame(uint32_t frame) override;
bool m_active = false;
void processFrame(const size_t frame) override;
void addObject(CTrainerFlickeringObject* obj);
std::vector<CTrainerFlickeringObject*> m_oObjects;
......
......@@ -34,7 +34,7 @@ void CTrainerFlickeringObject::initialize(CTrainerApplication* poApplication)
float(l_poConfigurationManager->expandAsFloat("${SSVEP_TargetDarkColourBlue}")));
}
CTrainerFlickeringObject* CTrainerFlickeringObject::createTrainerFlickeringObject(uint32_t l_i32TargetId)
CTrainerFlickeringObject* CTrainerFlickeringObject::createTrainerFlickeringObject(size_t l_i32TargetId)
{
OpenViBE::Kernel::IConfigurationManager* l_poConfigurationManager = m_application->getConfigurationManager();
......@@ -49,8 +49,8 @@ CTrainerFlickeringObject* CTrainerFlickeringObject::createTrainerFlickeringObjec
float l_f32TargetX = float(l_poConfigurationManager->expandAsFloat("${SSVEP_Target_X_${SSVEPTarget_Id}}"));
float l_f32TargetY = float(l_poConfigurationManager->expandAsFloat("${SSVEP_Target_Y_${SSVEPTarget_Id}}"));
uint32_t l_ui32FramesL = (*(m_application->getFrequencies()))[l_i32TargetId].first;
uint32_t l_ui32FramesD = (*(m_application->getFrequencies()))[l_i32TargetId].second;
size_t l_ui32FramesL = (*(m_application->getFrequencies()))[l_i32TargetId].first;
size_t l_ui32FramesD = (*(m_application->getFrequencies()))[l_i32TargetId].second;
m_application->getLogManager() << OpenViBE::Kernel::LogLevel_Info << "New trainer object : id=" << l_i32TargetId << " litFrames=" << l_ui32FramesL <<
" darkFrames=" << l_ui32FramesD << "\n";
......
......@@ -16,7 +16,7 @@ namespace OpenViBESSVEP
class CTrainerFlickeringObject : public CSSVEPFlickeringObject
{
public:
static CTrainerFlickeringObject* createTrainerFlickeringObject(uint32_t);
static CTrainerFlickeringObject* createTrainerFlickeringObject(size_t);
static void initialize(CTrainerApplication* poApplication);
static void connectToNode(Ogre::SceneNode* /*poSceneNode*/) { }
......
......@@ -20,7 +20,7 @@ CApplication::~CApplication()
m_poPainter = nullptr;
}
for (std::vector<ICommand*>::iterator it = m_oCommands.begin();
for (auto it = m_oCommands.begin();
it != m_oCommands.end(); ++it)
{
(*m_poLogManager) << LogLevel_Debug << "- ICommand\n";
......@@ -45,29 +45,29 @@ bool CApplication::setup(IKernelContext* poKernelContext)
m_poKernelContext = poKernelContext;
m_poLogManager = &(m_poKernelContext->getLogManager());
IConfigurationManager* l_poConfigurationManager = &(m_poKernelContext->getConfigurationManager());
IConfigurationManager* configurationManager = &(m_poKernelContext->getConfigurationManager());
(*m_poLogManager) << LogLevel_Debug << " * CApplication::setup()\n";
// Plugin config path setup
CString l_sPluginsPath = l_poConfigurationManager->expand("${Kernel_3DVisualizationOgrePlugins}");
CString pluginsPath = configurationManager->expand("${Kernel_3DVisualizationOgrePlugins}");
// Create LogManager to stop Ogre flooding the console and creating random files
(*m_poLogManager) << LogLevel_Info << "Ogre plugins path is " << l_sPluginsPath << "\n";
(*m_poLogManager) << LogLevel_Info << "Ogre plugins path is " << pluginsPath << "\n";
(*m_poLogManager) << LogLevel_Debug << "+ Creating Ogre logmanager\n";
Ogre::LogManager* l_poLogManager = new Ogre::LogManager();
(*m_poLogManager) << LogLevel_Info << "Ogre log to console : " << l_poConfigurationManager->expandAsBoolean("${SSVEP_Ogre_LogToConsole}", false) << "\n";
CString l_sOgreLog = l_poConfigurationManager->expand("${Path_Log}") + "/openvibe-ssvep-demo-ogre.log";
(*m_poLogManager) << LogLevel_Info << "Ogre log file : " << l_sOgreLog << "\n";
FS::Files::createParentPath(l_sOgreLog);
l_poLogManager->createLog(l_sOgreLog.toASCIIString(), true, l_poConfigurationManager->expandAsBoolean("${SSVEP_Ogre_LogToConsole}", false), false);
Ogre::LogManager* logManager = new Ogre::LogManager();
(*m_poLogManager) << LogLevel_Info << "Ogre log to console : " << configurationManager->expandAsBoolean("${SSVEP_Ogre_LogToConsole}", false) << "\n";
const CString ogreLog = configurationManager->expand("${Path_Log}") + "/openvibe-ssvep-demo-ogre.log";
(*m_poLogManager) << LogLevel_Info << "Ogre log file : " << ogreLog << "\n";
FS::Files::createParentPath(ogreLog);
logManager->createLog(ogreLog.toASCIIString(), true, configurationManager->expandAsBoolean("${SSVEP_Ogre_LogToConsole}", false), false);
// Root creation
CString l_sOgreCfg = l_poConfigurationManager->expand("${Path_UserData}") + "/openvibe-ssvep-demo-ogre.cfg";
const CString ogreCfg = configurationManager->expand("${Path_UserData}") + "/openvibe-ssvep-demo-ogre.cfg";
(*m_poLogManager) << LogLevel_Debug << "+ m_root = new Ogre::Root(...)\n";
(*m_poLogManager) << LogLevel_Info << "Ogre cfg file : " << l_sOgreCfg << "\n";
m_poRoot = new Ogre::Root(l_sPluginsPath.toASCIIString(), l_sOgreCfg.toASCIIString(), l_sOgreLog.toASCIIString());
(*m_poLogManager) << LogLevel_Info << "Ogre cfg file : " << ogreCfg << "\n";
m_poRoot = new Ogre::Root(pluginsPath.toASCIIString(), ogreCfg.toASCIIString(), ogreLog.toASCIIString());
// Resource handling
this->setupResources();
......@@ -87,7 +87,7 @@ bool CApplication::setup(IKernelContext* poKernelContext)
l_oOptionList["vsync"] = "1";
m_poWindow = m_poRoot->createRenderWindow("SSVEP Stimulator", 640, 480, l_poConfigurationManager->expandAsBoolean("${SSVEP_Ogre_FullScreen}", false),
m_poWindow = m_poRoot->createRenderWindow("SSVEP Stimulator", 640, 480, configurationManager->expandAsBoolean("${SSVEP_Ogre_FullScreen}", false),
&l_oOptionList);
m_ui32WindowWidth = m_poWindow->getWidth();
m_ui32WindowHeight = m_poWindow->getHeight();
......@@ -112,31 +112,31 @@ bool CApplication::setup(IKernelContext* poKernelContext)
m_poPainter = new CBasicPainter(this);
(*m_poLogManager) << LogLevel_Debug << " * initializing CEGUI\n";
this->initCEGUI(l_poConfigurationManager->expand("${Path_Log}") + "/openvibe-ssvep-demo-cegui.log");
this->initCEGUI(configurationManager->expand("${Path_Log}") + "/openvibe-ssvep-demo-cegui.log");
(*m_poLogManager) << LogLevel_Debug << " * CEGUI initialized\n";
// create the vector of stimulation frequencies
m_f64ScreenRefreshRate = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}"));
m_f64ScreenRefreshRate = size_t(configurationManager->expandAsUInteger("${SSVEP_ScreenRefreshRate}"));
(*m_poLogManager) << LogLevel_Info << "Specified screen refresh rate :" << m_f64ScreenRefreshRate << "Hz\n";
uint32_t i = 1;
size_t i = 1;
char l_sFrequencyString[32] = "1";
CIdentifier l_oFrequencyId = l_poConfigurationManager->createConfigurationToken("SSVEP_FrequencyId", CString(l_sFrequencyString));
CIdentifier l_oFrequencyId = configurationManager->createConfigurationToken("SSVEP_FrequencyId", CString(l_sFrequencyString));
m_oFrequencies.push_back(std::pair<uint32_t, uint32_t>(30, 30));
m_oFrequencies.push_back(std::pair<size_t, size_t>(30, 30));
while (l_poConfigurationManager->lookUpConfigurationTokenIdentifier(l_poConfigurationManager->expand("SSVEP_Frequency_${SSVEP_FrequencyId}")) !=
while (configurationManager->lookUpConfigurationTokenIdentifier(configurationManager->expand("SSVEP_Frequency_${SSVEP_FrequencyId}")) !=
OV_UndefinedIdentifier)
{
std::pair<uint32_t, uint32_t> l_oFrequency;
std::pair<size_t, size_t> l_oFrequency;
double l_f64CurrentFrequency;
l_f64CurrentFrequency = double(l_poConfigurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}"));
l_f64CurrentFrequency = double(configurationManager->expandAsFloat("${SSVEP_Frequency_${SSVEP_FrequencyId}}"));
double l_f64ApproximatedFrameCount = m_f64ScreenRefreshRate / l_f64CurrentFrequency;
......@@ -153,11 +153,11 @@ bool CApplication::setup(IKernelContext* poKernelContext)
}
else { (*m_poLogManager) << LogLevel_Error << "The selected frequency (" << l_f64CurrentFrequency << "Hz) is not supported by your screen.\n"; }
l_poConfigurationManager->releaseConfigurationToken(l_oFrequencyId);
configurationManager->releaseConfigurationToken(l_oFrequencyId);
sprintf(l_sFrequencyString, "%d", ++i);
l_oFrequencyId = l_poConfigurationManager->createConfigurationToken("SSVEP_FrequencyId", CString(l_sFrequencyString));
l_oFrequencyId = configurationManager->createConfigurationToken("SSVEP_FrequencyId", CString(l_sFrequencyString));
}
......@@ -230,7 +230,7 @@ void CApplication::resizeViewport()
Ogre::Real(size) / Ogre::Real(m_ui32WindowWidth), Ogre::Real(size) / Ogre::Real(m_ui32WindowHeight));
}
void CApplication::processFrame(uint32_t ui32CurrentFrame)
void CApplication::processFrame(const size_t /*currentFrame*/)
{
if (m_ui32WindowWidth != m_poWindow->getWidth() || m_ui32WindowHeight != m_poWindow->getHeight())
{
......@@ -255,17 +255,14 @@ void CApplication::setupResources()
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("CEGUI");
}
bool CApplication::frameRenderingQueued(const Ogre::FrameEvent& evt) { return (m_bContinueRendering && !m_poWindow->isClosed()); }
bool CApplication::frameRenderingQueued(const Ogre::FrameEvent& /*evt*/) { return (m_bContinueRendering && !m_poWindow->isClosed()); }
bool CApplication::frameStarted(const Ogre::FrameEvent& evt)
bool CApplication::frameStarted(const Ogre::FrameEvent& /*evt*/)
{
++m_ui32CurrentFrame;
m_ui32CurrentFrame = m_ui32CurrentFrame % int(m_f64ScreenRefreshRate);
this->processFrame(m_ui32CurrentFrame);
for (uint32_t i = 0; i < m_oCommands.size(); i++) { m_oCommands[i]->processFrame(); }
for (size_t i = 0; i < m_oCommands.size(); ++i) { m_oCommands[i]->processFrame(); }
return true;
}
......@@ -280,7 +277,7 @@ void CApplication::go()
(*m_poLogManager) << LogLevel_Debug << "Ogre rendering loop finished ... exiting\n";
}
void CApplication::addCommand(ICommand* pCommand) { m_oCommands.push_back(pCommand); }
void CApplication::addCommand(ICommand* command) { m_oCommands.push_back(command); }
void CApplication::startExperiment() { (*m_poLogManager) << LogLevel_Info << "[!] Experiment starting\n"; }
......@@ -290,5 +287,4 @@ void CApplication::stopExperiment()
this->exit();
}
#endif
......@@ -25,7 +25,7 @@ namespace OpenViBESSVEP
CApplication() {}
~CApplication() override;
void addCommand(ICommand* pCommand);
void addCommand(ICommand* command);
virtual bool setup(OpenViBE::Kernel::IKernelContext* poKernelContext);
void go();
......@@ -41,7 +41,7 @@ namespace OpenViBESSVEP
void exit() { m_bContinueRendering = false; }
OpenViBE::Kernel::ILogManager& getLogManager() { return (*m_poLogManager); }
OpenViBE::Kernel::IConfigurationManager* getConfigurationManager() { return &(m_poKernelContext->getConfigurationManager()); }
std::vector<std::pair<uint32_t, uint32_t>>* getFrequencies() { return &m_oFrequencies; }
std::vector<std::pair<size_t, size_t>>* getFrequencies() { return &m_oFrequencies; }
void resizeViewport();
protected:
......@@ -52,7 +52,7 @@ namespace OpenViBESSVEP
CBasicPainter* m_poPainter = nullptr;
bool m_bContinueRendering = true;
uint32_t m_ui32CurrentFrame = 0;
size_t m_ui32CurrentFrame = 0;
Ogre::Root* m_poRoot = nullptr;
Ogre::SceneManager* m_poSceneManager = nullptr;
......@@ -65,11 +65,11 @@ namespace OpenViBESSVEP
CEGUI::WindowManager* m_poGUIWindowManager = nullptr;
CEGUI::Window* m_poSheet = nullptr;
std::vector<std::pair<uint32_t, uint32_t>> m_oFrequencies;
std::vector<std::pair<size_t, size_t>> m_oFrequencies;
std::vector<ICommand*> m_oCommands;
virtual void processFrame(uint32_t ui32CurrentFrame);
virtual void processFrame(const size_t currentFrame);
bool frameRenderingQueued(const Ogre::FrameEvent& evt) override;
bool frameStarted(const Ogre::FrameEvent& evt) override;
......
......@@ -3,7 +3,6 @@
#include <Ogre.h>
#if (OGRE_VERSION_MAJOR > 1) || ((OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR >= 9))
#include "Overlay/OgreOverlay.h"
#include "Overlay/OgreOverlayContainer.h"
#endif
......
#if defined(TARGET_HAS_ThirdPartyOgre3D)
#include "ovassvepCSSVEPFlickeringObject.h"
#include <iostream>
using namespace OpenViBESSVEP;
CSSVEPFlickeringObject::CSSVEPFlickeringObject(Ogre::SceneNode* poObjectNode, uint32_t ui32LitFrames, uint32_t ui32DarkFrames)
CSSVEPFlickeringObject::CSSVEPFlickeringObject(Ogre::SceneNode* poObjectNode, size_t ui32LitFrames, size_t ui32DarkFrames)
: m_poObjectNode(poObjectNode), m_ui32LitFrames(ui32LitFrames), m_ui32DarkFrames(ui32DarkFrames) {}
void CSSVEPFlickeringObject::setVisible(bool bVisibility)
{
if ((!m_bVisible && bVisibility) || (m_bVisible && !bVisibility)) { m_poObjectNode->flipVisibility(); }
m_bVisible = bVisibility;
if ((!m_visible && bVisibility) || (m_visible && !bVisibility)) { m_poObjectNode->flipVisibility(); }
m_visible = bVisibility;
}
void CSSVEPFlickeringObject::processFrame()
......
......@@ -9,20 +9,20 @@ namespace OpenViBESSVEP
class CSSVEPFlickeringObject
{
public:
CSSVEPFlickeringObject(Ogre::SceneNode* poObjectNode, uint32_t ui32LitFrames, uint32_t ui32DarkFrames);
~CSSVEPFlickeringObject() {}
CSSVEPFlickeringObject(Ogre::SceneNode* poObjectNode, size_t ui32LitFrames, size_t ui32DarkFrames);
virtual ~CSSVEPFlickeringObject() {}
virtual void setVisible(bool bVisibility);
virtual void processFrame();
protected:
Ogre::SceneNode* m_poObjectNode = nullptr;
uint32_t m_ui32CurrentFrame = 0;
uint32_t m_ui32LitFrames = 0;
uint32_t m_ui32DarkFrames = 0;
size_t m_ui32CurrentFrame = 0;
size_t m_ui32LitFrames = 0;
size_t m_ui32DarkFrames = 0;
private:
bool m_bVisible = true;
bool m_visible = true;
};
} // namespace OpenViBESSVEP
......@@ -39,7 +39,7 @@ void CVRPNServer::addButton(OpenViBE::CString name, int iButtonCount)
void CVRPNServer::processFrame()
{
for (std::map<std::string, vrpn_Button_Server*>::iterator it = m_oButtonServer.begin(); it != m_oButtonServer.end(); ++it) { it->second->mainloop(); }
for (auto it = m_oButtonServer.begin(); it != m_oButtonServer.end(); ++it) { it->second->mainloop(); }
m_poConnection->mainloop();
}
......
......@@ -10,7 +10,7 @@ using namespace OIS;
InputManager* ICommandOIS::m_poInputManager = nullptr;
Keyboard* ICommandOIS::m_poKeyboard = nullptr;
int ICommandOIS::m_iInstanceCount = 0;
int ICommandOIS::m_nInstance = 0;
std::vector<ICommandOIS*> ICommandOIS::m_oInstances;
......@@ -38,15 +38,15 @@ ICommandOIS::ICommandOIS(CApplication* poApplication)
m_poKeyboard->setEventCallback(this);
}
m_iInstanceCount++;
m_nInstance++;
m_oInstances.push_back(this);
}
ICommandOIS::~ICommandOIS()
{
--m_iInstanceCount;
--m_nInstance;
if (m_iInstanceCount == 0)
if (m_nInstance == 0)
{
if (m_poInputManager != nullptr)
{
......@@ -67,14 +67,14 @@ void ICommandOIS::processFrame() { m_poKeyboard->capture(); }
bool ICommandOIS::keyPressed(const KeyEvent& oEvent)
{
for (uint32_t i = 0; i < m_oInstances.size(); i++) { m_oInstances[i]->receiveKeyPressedEvent(oEvent.key); }
for (size_t i = 0; i < m_oInstances.size(); ++i) { m_oInstances[i]->receiveKeyPressedEvent(oEvent.key); }
return true;
}
bool ICommandOIS::keyReleased(const KeyEvent& oEvent)
{
for (uint32_t i = 0; i < m_oInstances.size(); i++) { m_oInstances[i]->receiveKeyReleasedEvent(oEvent.key); }
for (size_t i = 0; i < m_oInstances.size(); ++i) { m_oInstances[i]->receiveKeyReleasedEvent(oEvent.key); }
return true;
}
......
......@@ -11,7 +11,7 @@ namespace OpenViBESSVEP
class ICommandOIS : public ICommand, OIS::KeyListener
{
static std::vector<ICommandOIS*> m_oInstances;
static int m_iInstanceCount;
static int m_nInstance;
protected:
static OIS::InputManager* m_poInputManager;
......
......@@ -32,7 +32,7 @@ ICommandVRPNButton::ICommandVRPNButton(CApplication* poApplication, OpenViBE::CS
m_poVRPNButton = new vrpn_Button_Remote(l_sButtonName);
m_poVRPNButton->register_change_handler((void*)this, ssvep_vrpn_callback_button);
m_poVRPNButton->register_change_handler(static_cast<void*>(this), ssvep_vrpn_callback_button);
}
ICommandVRPNButton::~ICommandVRPNButton()
......
......@@ -27,7 +27,7 @@ bool CGenericStimulatorApplication::setup(IKernelContext* poKernelContext)
CApplication::setup(poKernelContext);
(*m_logManager) << LogLevel_Debug << " * CGenericStimulatorApplication::setup()\n";
IConfigurationManager* l_poConfigurationManager = &(m_kernelContext->getConfigurationManager());
IConfigurationManager* l_poConfigurationManager = &(m_kernelCtx->getConfigurationManager());
l_poConfigurationManager->addConfigurationFromFile(m_ScenarioDir + "/appconf/generic-configuration.conf");
std::cout << m_ScenarioDir << "/appconf/generic-configuration.conf" << "\n";
......@@ -44,9 +44,9 @@ bool CGenericStimulatorApplication::setup(IKernelContext* poKernelContext)
// paint targets
uint32_t l_ui32TargetCount = uint32_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
size_t l_ui32TargetCount = size_t(l_poConfigurationManager->expandAsUInteger("${SSVEP_TargetCount}"));
for (uint32_t i = 0; i < l_ui32TargetCount; i++) { this->addObject(CGenericStimulatorFlickeringObject::createGenericFlickeringObject(i)); }
for (size_t i = 0; i < l_ui32TargetCount; ++i) { this->addObject(CGenericStimulatorFlickeringObject::createGenericFlickeringObject(i)); }
// draw the initial text
m_poInstructionsReady = m_guiWindowManager->createWindow("TaharezLook/StaticImage", "InstructionsReady");
......@@ -84,13 +84,13 @@ bool CGenericStimulatorApplication::setup(IKernelContext* poKernelContext)
}
void CGenericStimulatorApplication::processFrame(uint32_t frame)
void CGenericStimulatorApplication::processFrame(const size_t frame)
{
CApplication::processFrame(frame);
if (!m_bActive) { return; }
if (!m_active) { return; }
for (uint32_t i = 0; i < m_oObjects.size(); i++) { m_oObjects[i]->processFrame(); }
for (size_t i = 0; i < m_oObjects.size(); ++i) { m_oObjects[i]->processFrame(); }
}
void CGenericStimulatorApplication::addObject(CGenericStimulatorFlickeringObject* obj)
......@@ -101,10 +101,10 @@ void CGenericStimulatorApplication::addObject(CGenericStimulatorFlickeringObject
void CGenericStimulatorApplication::setTarget(int target)
{
const uint32_t currentTime = int(time(nullptr) - m_ttStartTime);
const size_t currentTime = int(time(nullptr) - m_ttStartTime);
(*m_logManager) << LogLevel_Info << currentTime << " > Target set to " << target << "\n";
for (int i = 0; i < int(m_oObjects.size()); i++) { m_oObjects[i]->setTarget(target == i); }
for (int i = 0; i < m_oObjects.size(); ++i) { m_oObjects[i]->setTarget(target == i); }
}
void CGenericStimulatorApplication::startExperiment()
......@@ -119,18 +119,18 @@ void CGenericStimulatorApplication::startExperiment()
void CGenericStimulatorApplication::startFlickering()
{