refactor: header file for every module
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifndef TERRAIN_H
|
||||
#define TERRAIN_H
|
||||
|
||||
#include <raylib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "engineSprite.h"
|
||||
|
||||
#define TERRAIN_CHUNK_WORLD_SIZE 256.0f
|
||||
#define TERRAIN_CHUNK_RESOLUTION ((int)TERRAIN_CHUNK_WORLD_SIZE)
|
||||
#define TERRAIN_LOAD_RADIUS 2
|
||||
#define TERRAIN_GRID_SIZE (TERRAIN_LOAD_RADIUS * 2 + 1)
|
||||
#define TERRAIN_MAX_CHUNKS (TERRAIN_GRID_SIZE * TERRAIN_GRID_SIZE)
|
||||
|
||||
typedef struct {
|
||||
bool active;
|
||||
int chunkX, chunkY;
|
||||
Sprite sprite;
|
||||
bool *landMask;
|
||||
} TerrainChunk;
|
||||
|
||||
typedef struct {
|
||||
TerrainChunk chunks[TERRAIN_MAX_CHUNKS];
|
||||
Shader shader;
|
||||
float time;
|
||||
} Terrain;
|
||||
|
||||
Terrain CreateTerrain(Camera2D *camera);
|
||||
void UpdateTerrain(Terrain *terrain, Camera2D *camera);
|
||||
void RenderTerrain(Terrain *terrain);
|
||||
void UnloadTerrain(Terrain *terrain);
|
||||
|
||||
bool IsTerrainLand(Terrain *terrain, Vector2 worldPos);
|
||||
bool IsTerrainLoaded(Terrain *terrain, Vector2 worldPos);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user