NppClone/src/player.h

57 lines
1.2 KiB
C
Raw Normal View History

2023-04-21 20:27:02 +02:00
#ifndef PLAYER_H
#define PLAYER_H
#include <azur/azur.h>
#include <azur/gint/render.h>
#include <cstdint>
#include <stdlib.h>
#include <num/num.h>
enum
{
STATIC = 0,
DRAFT = 1,
2023-04-21 20:27:02 +02:00
WALK = 2,
RUN = 3,
JUMP = 4,
FALL = 5,
};
#define LEFT libnum::num(-1)
#define TOP libnum::num(-1)
#define CENTER libnum::num(0)
#define BOTTOM libnum::num(+1)
#define RIGHT libnum::num(+1)
2023-04-21 20:27:02 +02:00
class Player
{
public:
Player( int16_t _x, int16_t _y );
~Player();
2023-04-22 12:50:03 +02:00
void Update( float dt );
2023-04-21 20:27:02 +02:00
void Render( );
2023-05-03 22:50:46 +02:00
void Left( float dt );
void Right( float dt );
void Up( float dt );
void Down( float dt );
2023-05-03 22:50:46 +02:00
void Nothing( float dt );
2023-04-21 20:27:02 +02:00
void Jump( float dt );
libnum::num currx, curry; // center position of the player
libnum::num nextx, nexty; // interim x and y position (to be tested to check if they can be actually achieved or not while moving)
int8_t tileX, tileY;
2023-05-03 22:50:46 +02:00
libnum::num vx, vy; // speed of the player as per x and y coordinates
libnum::num ax, ay; // acceleration of the player as per x an y coordinates
2023-04-21 20:27:02 +02:00
uint32_t last_tick;
};
#endif