kiba-engine
kiba
entry.h
Go to the documentation of this file.
1
9
#pragma once
10
11
#include <
kiba/core/event.h
>
12
#include <
kiba/core/input.h
>
13
#include <
kiba/core/log.h
>
14
#include <
kiba/defines.h
>
15
#include <kiba/format/format.h>
16
#include <kiba/gpu/backend.h>
17
#include <kiba/platform/timer.h>
18
24
extern
b8
create_application
(
void
);
25
33
extern
b8
update_application
(f64 delta);
34
40
extern
void
destroy_application
(
void
);
41
51
int
main
(
int
argc,
char
**argv) {
52
UNUSED
(argc);
53
UNUSED
(argv);
54
55
log_set_active_level
(LOG_LEVEL_MAX);
56
57
if
(!format_initialize()) {
58
return
false
;
59
}
60
61
log_set_active_level
(LOG_LEVEL_DEBUG);
62
63
if
(!
input_initialize
()) {
64
return
false
;
65
}
66
if
(!
event_initialize
()) {
67
return
false
;
68
}
69
if
(!gpu_backend_initialize()) {
70
return
false
;
71
}
72
73
if
(
create_application
()) {
74
timestamp
last = time_now();
75
f64 frame_time;
76
do
{
77
timestamp
cur = time_now();
78
f64 frame_time = time_diff_ms(last, cur);
79
u64 fps = (u64) (1000.0 / frame_time);
80
KB_DEBUG
(
"fps: {u64}"
, fps);
81
last = cur;
82
input_update
(frame_time);
83
}
while
(
update_application
(frame_time));
84
destroy_application
();
85
}
86
gpu_backend_shutdown();
87
event_shutdown
();
88
input_shutdown
();
89
log_set_active_level
(LOG_LEVEL_MAX);
90
format_shutdown();
91
92
return
0;
93
}
defines.h
Global typedefs and macros.
UNUSED
#define UNUSED(x)
Mark parameter as unused.
Definition:
defines.h:21
destroy_application
void destroy_application(void)
Shutdown of the application.
main
int main(int argc, char **argv)
Entrypoint of the application.
Definition:
entry.h:51
create_application
b8 create_application(void)
Initialization of the application.
update_application
b8 update_application(f64 delta)
Updating the application.
event_initialize
b8 event_initialize(void)
Initialize the event system.
Definition:
event.c:40
event_shutdown
void event_shutdown(void)
Shutdown event system.
Definition:
event.c:45
event.h
Event system.
input_shutdown
void input_shutdown(void)
Shutdown input system.
Definition:
input.c:49
input_update
void input_update(f64 delta_time)
Updates the input system.
Definition:
input.c:51
input_initialize
b8 input_initialize(void)
Initialize the input system.
Definition:
input.c:43
input.h
Input abstraction layer.
log_set_active_level
void log_set_active_level(log_level level)
Set the minimum log level to log.
Definition:
log.c:29
log.h
Logging system.
KB_DEBUG
#define KB_DEBUG(...)
Log entry with debug log level.
Definition:
log.h:163
timestamp
Definition:
timer.h:5
Generated by
1.9.1