refactor: JI_* a Ji:: i JG_* a Jg::

This commit is contained in:
2026-05-16 14:43:16 +02:00
parent 9d30dd538c
commit bbcc10da81
27 changed files with 174 additions and 163 deletions
+12 -12
View File
@@ -2,7 +2,7 @@
namespace {
bool quitting = false;
bool is_quitting = false;
Uint32 update_ticks = 0;
Uint32 update_time = 0;
Uint32 cycle_counter = 0;
@@ -10,29 +10,29 @@ namespace {
} // namespace
void JG_Init() {
void Jg::init() {
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
update_time = SDL_GetTicks();
last_delta_time = update_time;
}
void JG_Finalize() {
void Jg::finalize() {
SDL_Quit();
}
void JG_QuitSignal() {
quitting = true;
void Jg::quitSignal() {
is_quitting = true;
}
auto JG_Quitting() -> bool {
return quitting;
auto Jg::quitting() -> bool {
return is_quitting;
}
void JG_SetUpdateTicks(Uint32 milliseconds) {
void Jg::setUpdateTicks(Uint32 milliseconds) {
update_ticks = milliseconds;
}
auto JG_ShouldUpdate() -> bool {
auto Jg::shouldUpdate() -> bool {
const Uint32 now = SDL_GetTicks();
if (now - update_time > update_ticks) {
update_time = now;
@@ -40,16 +40,16 @@ auto JG_ShouldUpdate() -> bool {
return true;
}
// No toca update — retornem false sense més. Des de Phase B.2 ja no
// hi ha fibers: cap caller fa spin-waits (`while (!JG_ShouldUpdate())`)
// hi ha fibers: cap caller fa spin-waits (`while (!Jg::shouldUpdate())`)
// i el Director pren el control del main loop frame a frame.
return false;
}
auto JG_GetCycleCounter() -> Uint32 {
auto Jg::getCycleCounter() -> Uint32 {
return cycle_counter;
}
auto JG_GetDeltaMs() -> Uint32 {
auto Jg::getDeltaMs() -> Uint32 {
const Uint32 now = SDL_GetTicks();
const Uint32 delta = now - last_delta_time;
last_delta_time = now;