mirror of https://git.sr.ht/~kikoodx/momento
30 lines
727 B
C
30 lines
727 B
C
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
/* Copyright (C) 2021 KikooDX */
|
|
|
|
#include "conf.h"
|
|
#include "level.h"
|
|
#include "particles.h"
|
|
#include "player.h"
|
|
#include "zxcolors.h"
|
|
#include <gint/display.h>
|
|
|
|
extern char *const level_names[];
|
|
|
|
void
|
|
player_draw(struct Player player)
|
|
{
|
|
/* set animation position */
|
|
struct Particle anim = player.anim;
|
|
anim.x = player.x;
|
|
anim.y = player.y;
|
|
anim.x -= (anim.frame_width - PLAYER_WIDTH) / 2;
|
|
anim.y -= (anim.texture->height - PLAYER_HEIGHT) / 2;
|
|
/* draw animation */
|
|
particle_draw(anim);
|
|
|
|
/* print level name
|
|
* this shouldn't be in player code */
|
|
dprint_opt(DWIDTH - 4, DHEIGHT, ZX_WHITE, C_NONE, DTEXT_RIGHT,
|
|
DTEXT_BOTTOM, "%s", level_names[level.id]);
|
|
}
|