Updated code to work with latest gint stable release

This commit is contained in:
KikooDX 2020-08-29 15:54:37 +02:00
parent 9a5a723502
commit 40fe31ccb6
4 changed files with 36 additions and 36 deletions

View File

@ -1,8 +1,8 @@
#include <gint/display.h>
void draw_anim_speed(int x, int y, image_t *image, int step, int speed);
void draw_anim(int x, int y, image_t *image, int step);
void draw_anim_drill(int x, int y, image_t *image, int step);
void draw_anim_speed(int x, int y, bopti_image_t *image, int step, int speed);
void draw_anim(int x, int y, bopti_image_t *image, int step);
void draw_anim_drill(int x, int y, bopti_image_t *image, int step);
void draw_player(int x, int y);
void draw_drill(int x, int y, int direction, int step);
void draw_level(char level[], unsigned int step, char polarity, int *start_x,

View File

@ -7,36 +7,36 @@
#define DRAW_OFFSET_Y -24
#define DRAW_OFFSET_X -27
extern image_t img_player; //player texture, 12x12 (NOT ANIMATED)
extern image_t img_drill; //drill texture, 12x12 (animated)
extern image_t img_solid_0; //solid texture, 16x16
extern image_t img_solid_1; //solid texture, 16x16
extern image_t img_spike; //spike texture, 16x16
extern image_t img_bouncer; //bouncer texture, 16x16
extern image_t img_ice; //ice texture, 16x16
extern image_t img_blue; //blue bloc texture, 16x16
extern image_t img_blue_dot; //off blue bloc texture, 16x16
extern image_t img_red; //red bloc texture, 16x16
extern image_t img_red_dot; //off red bloc texture, 16x16
extern image_t img_exit; //exit texture, 16x16
extern image_t img_water; //water texture, 16x16
extern image_t img_semi_solid; //semi solid texture, 16x16
extern image_t img_teleporter_0; //teleporter 0 texture, 16x16
extern image_t img_teleporter_1; //teleporter 1 texture, 16x16
extern image_t img_elevator; //elevator texture, 16x16
extern image_t img_dust; //dust texture, 16x16
extern bopti_image_t img_player; //player texture, 12x12 (NOT ANIMATED)
extern bopti_image_t img_drill; //drill texture, 12x12 (animated)
extern bopti_image_t img_solid_0; //solid texture, 16x16
extern bopti_image_t img_solid_1; //solid texture, 16x16
extern bopti_image_t img_spike; //spike texture, 16x16
extern bopti_image_t img_bouncer; //bouncer texture, 16x16
extern bopti_image_t img_ice; //ice texture, 16x16
extern bopti_image_t img_blue; //blue bloc texture, 16x16
extern bopti_image_t img_blue_dot; //off blue bloc texture, 16x16
extern bopti_image_t img_red; //red bloc texture, 16x16
extern bopti_image_t img_red_dot; //off red bloc texture, 16x16
extern bopti_image_t img_exit; //exit texture, 16x16
extern bopti_image_t img_water; //water texture, 16x16
extern bopti_image_t img_semi_solid; //semi solid texture, 16x16
extern bopti_image_t img_teleporter_0; //teleporter 0 texture, 16x16
extern bopti_image_t img_teleporter_1; //teleporter 1 texture, 16x16
extern bopti_image_t img_elevator; //elevator texture, 16x16
extern bopti_image_t img_dust; //dust texture, 16x16
void draw_anim_speed(int x, int y, image_t *image, int step, int speed)
void draw_anim_speed(int x, int y, bopti_image_t *image, int step, int speed)
{
dsubimage(x + DRAW_OFFSET_X, y + DRAW_OFFSET_Y, image,
((step/speed) % (image->width / 16)) * 16, 0, 16, 16, DIMAGE_NONE);
}
void draw_anim(int x, int y, image_t *image, int step)
void draw_anim(int x, int y, bopti_image_t *image, int step)
{
draw_anim_speed(x, y, image, step, 1);
}
void draw_anim_drill(int x, int y, image_t *image, int step)
void draw_anim_drill(int x, int y, bopti_image_t *image, int step)
{
dsubimage(x + DRAW_OFFSET_X, y + DRAW_OFFSET_Y, image,
(step % (image->width / 12)) * 12, 0, 12, 12, DIMAGE_NONE);
@ -150,8 +150,8 @@ void just_breathe(unsigned int step)
while (!keydown_any(KEY_MENU, KEY_EXIT, 0))
{
dclear(0);
dtext(x, y, "Thank you for playing", C_WHITE, C_BLACK);
dprint(x, y + 12, C_WHITE, C_BLACK, "%u.%02u", step/FPS, step%FPS);
dtext_opt(x, y, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "Thank you for playing");
dprint_opt(x, y + 12, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%u.%02u", step/FPS, step%FPS);
dupdate();
x += xspd;
y += yspd;

View File

@ -74,7 +74,7 @@ int main(void)
player_x = start_x;
player_y = start_y;
//fps cap timer
timer_setup(0, timer_delay(0, 1000000/FPS), 0, callback, &has_ticked);
timer_setup(0, timer_delay(0, 1000000/FPS, TIMER_Pphi_4), 0, callback, &has_ticked);
timer_start(0);
while (game_loop) {
while(!has_ticked) sleep();

View File

@ -22,12 +22,12 @@ char menu(int *level_id, char *enable_up_key, char *game_loop,
if (selected == 4) selected = 0;
else if (selected == -1) selected = 3;
dclear(0);
dprint(0, 0, C_WHITE, C_BLACK, "%u.%02u", rem_step/60, rem_step%60);
dtext(32, Y_POS, "CONTINUE", C_WHITE, C_BLACK);
dtext(32, Y_POS + 12, "SELECT LEVEL", C_WHITE, C_BLACK);
dtext(32, Y_POS + 24, "UP KEY TO JUMP:", C_WHITE, C_BLACK);
dtext(32, Y_POS + 36, "EXIT GAME", C_WHITE, C_BLACK);
dtext(16, Y_POS + (selected * 12), ">", C_WHITE, C_BLACK);
dprint(0, 0, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%u.%02u", rem_step/60, rem_step%60);
dtext_opt(32, Y_POS, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "CONTINUE");
dtext_opt(32, Y_POS + 12, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "SELECT LEVEL");
dtext_opt(32, Y_POS + 24, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "UP KEY TO JUMP:");
dtext_opt(32, Y_POS + 36, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "EXIT GAME");
dtext_opt(16, Y_POS + (selected * 12), C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, ">");
//action switch
if (keydown_any(KEY_SHIFT, KEY_EXE, 0))
{
@ -50,8 +50,8 @@ char menu(int *level_id, char *enable_up_key, char *game_loop,
}
}
//up key state display
if (*enable_up_key) dtext(152, Y_POS + 24, "ON", C_WHITE, C_BLACK);
else dtext(152, Y_POS + 24, "OFF", C_WHITE, C_BLACK);
if (*enable_up_key) dtext_opt(152, Y_POS + 24, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "ON");
else dtext_opt(152, Y_POS + 24, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "OFF");
dupdate();
while (keydown_any(KEY_UP, KEY_DOWN, KEY_SHIFT, KEY_EXE, 0)) clearevents();
}
@ -69,7 +69,7 @@ char menu_level_selection(int *level_id)
*level_id += keydown(KEY_RIGHT) - keydown(KEY_LEFT);
if (*level_id > LAST_LEVEL || keydown(KEY_0)) *level_id = 5050;
else if (*level_id < 5050) *level_id = LAST_LEVEL;
dprint(32, Y_POS + 20, C_WHITE, C_BLACK, "> %02d <", *level_id - 5049);
dprint_opt(32, Y_POS + 20, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "> %02d <", *level_id - 5049);
if (keydown_any(KEY_SHIFT, KEY_EXE, 0))
{
if (!confirm_buffer)