forked from NotAShelf/rogged
render: add player sprite. welcome to dude man
This commit is contained in:
parent
4dfe52ae72
commit
0b3608b18c
6 changed files with 10 additions and 6 deletions
|
|
@ -505,6 +505,8 @@ static void game_loop(void) {
|
|||
GameState gs;
|
||||
memset(&gs, 0, sizeof(GameState));
|
||||
load_audio_assets(&gs);
|
||||
// entities
|
||||
Texture2D player_tile = LoadTexture("./assets/entities/player_white.png");
|
||||
// Initialize first floor
|
||||
rng_seed(12345);
|
||||
init_floor(&gs, 1);
|
||||
|
|
@ -552,7 +554,7 @@ static void game_loop(void) {
|
|||
render_map(&gs.map);
|
||||
render_items(gs.items, gs.item_count);
|
||||
render_enemies(gs.enemies, gs.enemy_count);
|
||||
render_player(&gs.player);
|
||||
render_player(&gs.player, &player_tile);
|
||||
EndMode2D();
|
||||
|
||||
// Floating texts follow world shake
|
||||
|
|
|
|||
10
src/render.c
10
src/render.c
|
|
@ -29,10 +29,12 @@ void render_map(const Map *map) {
|
|||
}
|
||||
}
|
||||
|
||||
void render_player(const Player *p) {
|
||||
Rectangle rect = {(float)(p->position.x * TILE_SIZE), (float)(p->position.y * TILE_SIZE), (float)TILE_SIZE,
|
||||
(float)TILE_SIZE};
|
||||
DrawRectangleRec(rect, BLUE);
|
||||
void render_player(const Player *p, Texture2D *ptile) {
|
||||
//Rectangle rect = {(float)(p->position.x * TILE_SIZE), (float)(p->position.y * TILE_SIZE), (float)TILE_SIZE,
|
||||
// (float)TILE_SIZE};
|
||||
//DrawRectangleRec(rect, BLUE);
|
||||
|
||||
DrawTexture(*ptile, (float)(p->x * TILE_SIZE), (float)(p->y * TILE_SIZE), (Color){255, 255, 255, 255});
|
||||
}
|
||||
|
||||
void render_enemies(const Enemy *enemies, int count) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
void render_map(const Map *map);
|
||||
|
||||
// Render the player
|
||||
void render_player(const Player *p);
|
||||
void render_player(const Player *p, Texture2D *ptile);
|
||||
|
||||
// Render all enemies
|
||||
void render_enemies(const Enemy *enemies, int count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue