feat(event): dispatch tick events in main processing loop
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run

This commit is contained in:
fallenoak 2026-01-16 19:33:17 -06:00
parent 43dcfae6b0
commit c9aaa245c9
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
4 changed files with 24 additions and 5 deletions

View File

@ -286,12 +286,10 @@ int32_t SchedulerThreadProcProcess(uint32_t a1) {
}
}
uint32_t v9 = (currTime - context->m_schedLastIdle);
float elapsedSec = (currTime - context->m_schedLastIdle) * 0.001;
context->m_schedLastIdle = currTime;
double elapsedSec = v9 * 0.001;
// TODO
// FrameTime::Update(currTime, elapsedSec);
SynthesizeTick(context, currTime, elapsedSec);
IEvtTimerDispatch(context);

View File

@ -91,3 +91,17 @@ void SynthesizePoll(EvtContext* context) {
IEvtQueueDispatch(context, EVENT_ID_POLL, nullptr);
}
void SynthesizeTick(EvtContext* context, uint32_t currTime, float elapsedSec) {
context->m_critsect.Enter();
bool closed = context->m_schedState == EvtContext::SCHEDSTATE_CLOSED;
context->m_critsect.Leave();
if (closed) {
return;
}
EVENT_DATA_TICK data = { elapsedSec, currTime };
IEvtQueueDispatch(context, EVENT_ID_TICK, &data);
}

View File

@ -15,4 +15,6 @@ void SynthesizePaint(EvtContext* context);
void SynthesizePoll(EvtContext* context);
void SynthesizeTick(EvtContext* context, uint32_t currTime, float elapsedSec);
#endif

View File

@ -12,7 +12,7 @@ enum EVENTID {
EVENT_ID_FOCUS = 2,
EVENT_ID_CLOSE = 3,
EVENT_ID_DESTROY = 4,
EVENT_ID_5 = 5,
EVENT_ID_TICK = 5,
EVENT_ID_IDLE = 6,
EVENT_ID_POLL = 7,
EVENT_ID_INITIALIZE = 8,
@ -259,4 +259,9 @@ struct EVENT_DATA_SIZE {
int32_t h;
};
struct EVENT_DATA_TICK {
float tickTimeSec;
uint32_t curTimeMs;
};
#endif