aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-29 23:12:34 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-29 23:12:34 +0100
commit3f7b9d71c75360207dd05b8cb67131b08f2c18ca (patch)
tree135ed5430b14b9901662f662f7f1dd72015dc21a /src
parent623b1dfa54e77d3ca21fb64e200a32ee9a61c021 (diff)
downloadgold-mine-run-3f7b9d71c75360207dd05b8cb67131b08f2c18ca.tar.gz
gold-mine-run-3f7b9d71c75360207dd05b8cb67131b08f2c18ca.zip
Move wait_time to vga
Diffstat (limited to 'src')
-rw-r--r--src/game.c11
-rw-r--r--src/vga.c7
-rw-r--r--src/vga.h1
3 files changed, 10 insertions, 9 deletions
diff --git a/src/game.c b/src/game.c
index 0113fe1..b45989b 100644
--- a/src/game.c
+++ b/src/game.c
@@ -42,13 +42,6 @@ static uint8_t pickaxe;
static uint8_t gameover;
static uint8_t pause;
-static void wait_time(uint16_t frames)
-{
- /* wait some time */
- for (uint16_t i = 0; i < frames; i++)
- wait_vsync();
-}
-
static void hud_render()
{
char b[32];
@@ -117,7 +110,7 @@ static void run_gameover()
blit_update();
/* wait some time */
- wait_time(255);
+ wait_frames(255);
}
void run_game()
@@ -148,7 +141,7 @@ void run_game()
blit_update();
/* wait some time */
- wait_time(96);
+ wait_frames(96);
/* erase the READY? text */
map_render();
diff --git a/src/vga.c b/src/vga.c
index 83ee2c7..1190b6e 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -75,6 +75,13 @@ void wait_vsync()
while (!(inportb(0x3da) & 8));
}
+void wait_frames(uint16_t frames)
+{
+ /* wait some time */
+ for (uint16_t i = 0; i < frames; i++)
+ wait_vsync();
+}
+
void set_palette(const uint8_t *palette)
{
outportb(0x3c8, 0);
diff --git a/src/vga.h b/src/vga.h
index 7bd5779..06a69df 100644
--- a/src/vga.h
+++ b/src/vga.h
@@ -16,6 +16,7 @@ void close_framebuffer();
uint8_t set_mode(uint8_t mode);
void wait_vsync();
+void wait_frames(uint16_t frames);
/* the palette is expected to be 8 bit per color, and will be converted to VGA's 6 bit per color */
void set_palette(const uint8_t *palette);