Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void resetScenario(void)

// Reset (global) callbacks
OSCCondition::conditionCallback = nullptr;
StoryBoardElement::stateChangeCallback = nullptr;
StoryBoardElement::stateChangeCallback = {};

time_stamp = 0;
}
Expand Down Expand Up @@ -462,6 +462,11 @@ static int InitScenario()
return 0;
}

SE_DLL_API void SE_RegisterStoryBoardElementStateChangeCallback(std::function<void(const char*, int, int)> fn)
{
StoryBoardElement::stateChangeCallback = fn;
}

extern "C"
{
SE_DLL_API int SE_AddPath(const char *path)
Expand Down
5 changes: 5 additions & 0 deletions EnvironmentSimulator/Libraries/esminiLib/esminiLib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,3 +1437,8 @@ extern "C"
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
#include <functional>
SE_DLL_API void SE_RegisterStoryBoardElementStateChangeCallback(std::function<void(const char*, int, int)> fn);
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using namespace scenarioengine;

void (*StoryBoardElement::stateChangeCallback)(const char* name, int type, int state) = nullptr;
std::function<void(const char* name, int type, int state)> StoryBoardElement::stateChangeCallback = nullptr;

std::string StoryBoardElement::state2str(StoryBoardElement::State state)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
#pragma once

#include "Entities.hpp"
#include <functional>

namespace scenarioengine
{

class StoryBoardElement
{
public:
static void (*stateChangeCallback)(const char* name, int type, int state);

/**
static std::function<void(const char* name, int type, int state)> stateChangeCallback;
/**
* Take note, changing this enum will alter the public API in esminiLib.hpp
*/
typedef enum
Expand Down