mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Fix presenter progress event (#300)
This commit is contained in:
parent
48d81f9324
commit
2733ffcf69
@ -22,15 +22,15 @@ void Emscripten_SendEvent(const char* p_event, const char* p_json)
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
void Emscripten_SendPresenterProgress(MxPresenter* p_presenter, MxPresenter::TickleState p_tickleState)
|
||||
void Emscripten_SendPresenterProgress(MxDSAction* p_action, MxPresenter::TickleState p_tickleState)
|
||||
{
|
||||
char buf[128];
|
||||
SDL_snprintf(
|
||||
buf,
|
||||
sizeof(buf),
|
||||
"{\"objectId\": %d, \"objectName\": \"%s\", \"tickleState\": %d}",
|
||||
p_presenter->GetAction() ? p_presenter->GetAction()->GetObjectId() : 0,
|
||||
p_presenter->GetAction() ? p_presenter->GetAction()->GetObjectName() : "",
|
||||
p_action ? p_action->GetObjectId() : 0,
|
||||
p_action ? p_action->GetObjectName() : "",
|
||||
p_tickleState
|
||||
);
|
||||
|
||||
|
||||
@ -3,6 +3,6 @@
|
||||
|
||||
#include "mxpresenter.h"
|
||||
|
||||
void Emscripten_SendPresenterProgress(MxPresenter* p_presenter, MxPresenter::TickleState p_tickleState);
|
||||
void Emscripten_SendPresenterProgress(MxDSAction* p_action, MxPresenter::TickleState p_tickleState);
|
||||
|
||||
#endif // EMSCRIPTEN_EVENTS_H
|
||||
|
||||
@ -567,13 +567,12 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
||||
}
|
||||
}
|
||||
else if (event->user.type == g_legoSdlEvents.m_presenterProgress) {
|
||||
MxPresenter* presenter = static_cast<MxPresenter*>(event->user.data1);
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
MxDSAction* action = static_cast<MxDSAction*>(event->user.data1);
|
||||
MxPresenter::TickleState state = static_cast<MxPresenter::TickleState>(event->user.code);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (!g_isle->GetGameStarted()) {
|
||||
Emscripten_SendPresenterProgress(presenter, state);
|
||||
Emscripten_SendPresenterProgress(action, state);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class MxPresenter : public MxCore {
|
||||
SDL_Event event;
|
||||
event.user.type = g_legoSdlEvents.m_presenterProgress;
|
||||
event.user.code = m_currentTickleState;
|
||||
event.user.data1 = (void*) this;
|
||||
event.user.data1 = (void*) m_action;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user