blob: 98493e266f4a608c68239bfd172669de5476bbe0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include "level-init.hpp"
#include "level-main.hpp"
#include <pke/pke.hpp>
struct pke_level_init_master {
pke_level *level = nullptr;
} init_mstr;
pke_level *pke_at_level_init_create() {
init_mstr.level = pke_level_create("init", pk_uuid_zed, pk_uuid_zed);
init_mstr.level->pke_cb_spinup.func = pke_at_level_init_init;
init_mstr.level->pke_cb_tick.func = (void(*)())pke_at_level_init_tick;
init_mstr.level->pke_cb_teardown.func = pke_at_level_init_teardown;
return init_mstr.level;
}
void pke_at_level_init_init() { }
void pke_at_level_init_tick(double delta) {
(void)delta;
/* 2025-09-29 JCB
* This is a little goofy, but the engine needs to process 1(one) entire
* tick before we actually want to start the application.
* Specifically, the issue I was running into was that the editor plugin
* activates its player inputs on its very first tick, which happens *after*
* both the first level's init function and the first level's first tick.
* This means that certain ui actions are being swallowed because they do not
* have the desired priority in the input handler.
* I am unconvinced that this qualifies as a bug; perhaps a quirk at worst.
* The fix is to just register things in the right order, which we are doing
* with this fake level that immediately passes off being the active level,
* allowing the needed 1(one) tick to pass.
*/
pkeSettings.rt.nextLevel = pke_at_level_main_create();
}
void pke_at_level_init_teardown() { }
|