yet another api rework, removal of integer types in public api, optionals at the end, some cleaning
This commit is contained in:
@ -11,9 +11,9 @@ static void title_tick(State *state) {
|
||||
SceneTitle *scn = (SceneTitle *)state->scene;
|
||||
(void)scn;
|
||||
|
||||
input_bind_action_control("ui_accept", CONTROL_RETURN);
|
||||
input_action("ui_accept", CONTROL_RETURN);
|
||||
|
||||
if (input_is_action_just_pressed("ui_accept")) {
|
||||
if (input_action_just_pressed("ui_accept")) {
|
||||
switch_to(state, ingame_scene);
|
||||
return;
|
||||
}
|
||||
@ -22,20 +22,20 @@ static void title_tick(State *state) {
|
||||
((float)ctx.resolution.x / 2) - ((float)320 / 2), 64, 320, 128 }));
|
||||
|
||||
/* draw the tick count as an example of dynamic text */
|
||||
size_t text_str_len = snprintf(NULL, 0, "%llu", state->ctx->frame_number) + 1;
|
||||
size_t text_str_len = snprintf(NULL, 0, "%llu", (unsigned long long)state->ctx->frame_number) + 1;
|
||||
char *text_str = cmalloc(text_str_len);
|
||||
snprintf(text_str, text_str_len, "%llu", state->ctx->frame_number);
|
||||
snprintf(text_str, text_str_len, "%llu", (unsigned long long)state->ctx->frame_number);
|
||||
|
||||
const char *font = "/fonts/kenney-pixel.ttf";
|
||||
int text_h = 32;
|
||||
int text_w = draw_text_width(text_str, text_h, font);
|
||||
float text_h = 32;
|
||||
float text_w = draw_text_width(text_str, text_h, font);
|
||||
|
||||
draw_rectangle(
|
||||
(Rect) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.w = (float)text_w,
|
||||
.h = (float)text_h,
|
||||
.w = text_w,
|
||||
.h = text_h,
|
||||
},
|
||||
(Color) { 0, 0, 0, 255 }
|
||||
);
|
||||
|
Reference in New Issue
Block a user