NppClone/src/player.h

54 lines
1.0 KiB
C++

#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,
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)
class Player {
public:
Player(int16_t _x, int16_t _y);
~Player();
void Update(float dt);
void Render();
void Left(float dt);
void Right(float dt);
void Up(float dt);
void Down(float dt);
void Nothing(float dt);
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;
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
uint32_t last_tick;
};
#endif