50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
/*
|
|
Name : Odyssée Game Engine
|
|
Version : dev
|
|
|
|
code provided with licence :
|
|
GNU General Public Licence v3.0
|
|
*/
|
|
|
|
#include <gint/keyboard.h>
|
|
#include <gint/display.h>
|
|
#include "game_engine.h"
|
|
|
|
#define TILE_SIZE 16
|
|
#define TILESET_WIDTH 49
|
|
|
|
#define SCREEN_WIDTH 24
|
|
#define SCREEN_HEIGHT 14
|
|
|
|
int main(void)
|
|
{
|
|
extern const struct map map_world;
|
|
extern const bopti_image_t img_tileset;
|
|
|
|
dclear(C_WHITE);
|
|
|
|
for (int layer = 0 ; layer < map_world.nb_layers; layer++)
|
|
{
|
|
for (int y = 0 ; y <= SCREEN_HEIGHT; y ++)
|
|
{
|
|
for (int x = 0 ; x <= SCREEN_WIDTH; x ++)
|
|
{
|
|
unsigned int tile_id = map_world.layers[layer][y * map_world.width + x];
|
|
if (tile_id != 0)
|
|
{
|
|
tile_id --;
|
|
unsigned int tile_x = (TILE_SIZE + 1) * (tile_id % TILESET_WIDTH);
|
|
unsigned int tile_y = (TILE_SIZE + 1) * (tile_id / TILESET_WIDTH);
|
|
|
|
dsubimage(x * TILE_SIZE, y * TILE_SIZE, &img_tileset, tile_x, tile_y, TILE_SIZE, TILE_SIZE, DIMAGE_NONE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// dprint(2, 2, C_BLACK, "%d", map_world.layers[0][0]);
|
|
dupdate();
|
|
getkey();
|
|
|
|
return 0;
|
|
} |