NppClone/src/level.h

54 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-04-21 20:27:02 +02:00
#ifndef BACKGROUND_H
#define BACKGROUND_H
#include <cstdint>
2023-05-26 18:14:13 +02:00
#include <stdlib.h>
2023-04-21 20:27:02 +02:00
#include <azur/gint/render.h>
#include "num/num.h"
2023-05-26 18:14:13 +02:00
#include <vector>
2023-04-21 20:27:02 +02:00
#include "player.h"
#include "vector2D.h"
2023-04-21 20:27:02 +02:00
struct Map {
2023-05-26 18:14:13 +02:00
/*width, height and the number of layer of the map*/
int w, h, nblayers;
2023-04-21 20:27:02 +02:00
2023-05-26 18:14:13 +02:00
/*the tileset to use*/
bopti_image_t *tileset;
int tileset_size;
2023-04-21 20:27:02 +02:00
2023-05-26 18:14:13 +02:00
/*list of all the tiles*/
short *layers[];
2023-04-21 20:27:02 +02:00
};
2023-05-26 18:14:13 +02:00
class Level {
public:
Level();
~Level();
2023-04-21 20:27:02 +02:00
2023-05-26 18:14:13 +02:00
void Update(float dt);
void Render(void);
2023-04-21 20:27:02 +02:00
2023-05-26 18:14:13 +02:00
void ChangeMap(int level);
void UpdateDataMap(void);
void ConvertTileToBorder(int16_t currentTile, libnum::num32 DeltaX,
libnum::num32 DeltaY);
void UpdateBorders(void);
2023-04-21 20:27:02 +02:00
2023-05-26 18:14:13 +02:00
bool CanGo(void);
2023-05-26 18:14:13 +02:00
private:
int GetTileBackground(uint16_t x, uint16_t y);
int GetTileForeground(uint16_t x, uint16_t y);
int GetTileBackgroundINT(uint8_t x, uint8_t y);
int GetTileForegroundINT(uint8_t x, uint8_t y);
2023-04-22 12:50:03 +02:00
2023-05-26 18:14:13 +02:00
Border *MakeBorder(libnum::num32 DX, libnum::num32 DY, libnum::num32 x1,
libnum::num32 y1, libnum::num32 x2, libnum::num32 y2);
2023-04-21 20:27:02 +02:00
};
#endif