Skip to content

Commit 8f179c2

Browse files
committed
- Fixed frame counter.
- Fixed problems with measuring time in perf_*(). - Changed KEY_* constants to be the same as VK_* on Windows, as Windows is currently the only platform we're targetting. - Added draw_rect().
1 parent a27f747 commit 8f179c2

File tree

3 files changed

+336
-263
lines changed

3 files changed

+336
-263
lines changed

main.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ static Font font;
44
static Sound sound1;
55
static Sound sound2;
66

7+
#define COLOR_BLACK (1)
8+
#define COLOR_WHITE (2)
9+
710
void
811
init()
912
{
@@ -33,13 +36,35 @@ step()
3336
sound_play(&sound2);
3437
}
3538

39+
if (CORE->key_states[KEY_RIGHT]) {
40+
CORE->translate_x++;
41+
}
42+
43+
if (CORE->key_states[KEY_LEFT]) {
44+
CORE->translate_x--;
45+
}
46+
47+
if (CORE->key_states[KEY_DOWN]) {
48+
CORE->translate_y++;
49+
}
50+
51+
if (CORE->key_states[KEY_UP]) {
52+
CORE->translate_y--;
53+
}
54+
55+
if (CORE->key_states[KEY_ESCAPE]) {
56+
CORE->running = 0;
57+
}
58+
3659
canvas_clear(0);
3760
// Rect r = rect_make_size(0, 0, 16, 16);
3861
// bitmap_draw(0, 0, 0, 0, &splash, &r, 0, 0);
3962

4063
text_draw(0, 0, "\n\nHELLO\nWORLD", 3);
4164

65+
rect_draw(rect_make_size(32, 32, 8, 8), 2);
66+
4267
static char buf[256];
43-
sprintf(buf, "%03d", (i32)(CORE->perf_audio.delta * 1000.0f));
68+
sprintf(buf, "%03f %05d", CORE->perf_blit_gdi.delta, (i32)CORE->frame);
4469
text_draw(0, 0, buf, 2);
4570
}

0 commit comments

Comments
 (0)