mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
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
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:
parent
43dcfae6b0
commit
c9aaa245c9
@ -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;
|
context->m_schedLastIdle = currTime;
|
||||||
double elapsedSec = v9 * 0.001;
|
|
||||||
|
|
||||||
// TODO
|
SynthesizeTick(context, currTime, elapsedSec);
|
||||||
// FrameTime::Update(currTime, elapsedSec);
|
|
||||||
|
|
||||||
IEvtTimerDispatch(context);
|
IEvtTimerDispatch(context);
|
||||||
|
|
||||||
|
|||||||
@ -91,3 +91,17 @@ void SynthesizePoll(EvtContext* context) {
|
|||||||
|
|
||||||
IEvtQueueDispatch(context, EVENT_ID_POLL, nullptr);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@ -15,4 +15,6 @@ void SynthesizePaint(EvtContext* context);
|
|||||||
|
|
||||||
void SynthesizePoll(EvtContext* context);
|
void SynthesizePoll(EvtContext* context);
|
||||||
|
|
||||||
|
void SynthesizeTick(EvtContext* context, uint32_t currTime, float elapsedSec);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -12,7 +12,7 @@ enum EVENTID {
|
|||||||
EVENT_ID_FOCUS = 2,
|
EVENT_ID_FOCUS = 2,
|
||||||
EVENT_ID_CLOSE = 3,
|
EVENT_ID_CLOSE = 3,
|
||||||
EVENT_ID_DESTROY = 4,
|
EVENT_ID_DESTROY = 4,
|
||||||
EVENT_ID_5 = 5,
|
EVENT_ID_TICK = 5,
|
||||||
EVENT_ID_IDLE = 6,
|
EVENT_ID_IDLE = 6,
|
||||||
EVENT_ID_POLL = 7,
|
EVENT_ID_POLL = 7,
|
||||||
EVENT_ID_INITIALIZE = 8,
|
EVENT_ID_INITIALIZE = 8,
|
||||||
@ -259,4 +259,9 @@ struct EVENT_DATA_SIZE {
|
|||||||
int32_t h;
|
int32_t h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct EVENT_DATA_TICK {
|
||||||
|
float tickTimeSec;
|
||||||
|
uint32_t curTimeMs;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user