NppClone/src/level.h

59 lines
1.1 KiB
C
Raw Normal View History

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