Bad looking graphics

This commit is contained in:
KikooDX 2021-06-02 14:27:18 +02:00
parent 9bfa3e802a
commit 2cf29c38c0
6 changed files with 18 additions and 34 deletions

View File

@ -24,6 +24,8 @@ set(SOURCES
)
set(ASSETS
assets/player.png
assets/tileset.png
)
set(FLAGS

View File

@ -0,0 +1,9 @@
# gint bopti_image_t
player.png:
type: bopti-image
profile: p4
name: bimg_player
tileset.png:
type: bopti-image
profile: p4
name: bimg_tileset

BIN
assets/player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

BIN
assets/tileset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

View File

@ -2,6 +2,8 @@
#include "tiles.h"
#include <gint/display.h>
extern bopti_image_t bimg_tileset;
static void tile_draw(enum Tile, int x, int y);
void
@ -47,37 +49,6 @@ grid_draw(struct Grid grid, int scr_x, int scr_y)
static void
tile_draw(enum Tile tile, int x, int y)
{
color_t color;
switch (tile) {
case TILE_VOID:
color = C_BLACK;
break;
case TILE_OBSTACLE_1:
color = C_DARK;
break;
case TILE_OBSTACLE_2:
color = C_LIGHT;
break;
case TILE_OBSTACLE_3:
color = C_WHITE;
break;
case TILE_SOLID:
color = C_BLUE;
break;
case TILE_ZONE_TRANSITION:
color = C_RGB(0, 31, 31);
break;
case TILE_CONTRACTS_SPEED_UP:
color = C_RGB(31, 31, 0);
break;
case TILE_CONTRACTS_SLOW_DOWN:
color = C_RED;
break;
default:
color = C_RGB(31, 0, 31);
break;
}
drect(x, y, x + TILE_WIDTH - 1, y + TILE_HEIGHT - 1, color);
dsubimage(x, y, &bimg_tileset, tile * TILE_WIDTH, 0, TILE_WIDTH,
TILE_HEIGHT, DIMAGE_NONE);
}

View File

@ -2,6 +2,8 @@
#include "tiles.h"
#include <gint/display.h>
extern bopti_image_t bimg_player;
int
player_draw(struct Player player, int scr_x, int scr_y)
{
@ -9,7 +11,7 @@ player_draw(struct Player player, int scr_x, int scr_y)
const int y = scr_y + player.y * TILE_HEIGHT;
if (x < -TILE_WIDTH * 4)
return 0;
drect(x + 2, y + 2, x + TILE_WIDTH - 3, y + TILE_HEIGHT - 3, C_GREEN);
dimage(x + 2, y + 2, &bimg_player);
dprint(0, 0, C_RGB(31, 31, 0), "$%d", *player.cash);
return 1;
}