diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-04-28 07:50:31 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-04-28 09:23:47 +0200 |
| commit | 63eb46698b1e19d3f36944992b948c54a7a3740b (patch) | |
| tree | 1aa8b686039e2f9291d680c21a47427de5daa12b /all.h | |
| parent | 0ed91795a2db720e688fd2daefd22f7e9c754c2f (diff) | |
| download | stalag-63eb46698b1e19d3f36944992b948c54a7a3740b.tar.gz | |
Compiler settings and macOS port
Diffstat (limited to 'all.h')
| -rw-r--r-- | all.h | 117 |
1 files changed, 117 insertions, 0 deletions
@@ -0,0 +1,117 @@ +#ifndef ALL_H +#define ALL_H + +#include "raylib.h" +#include "raymath.h" +#include "rlgl.h" +#include "config.h" + +// Resolve conflicts between Raylib and nonstd.h +#define Color NS_Color +#include "libraries/nonstd.h" +#undef Color + +#include "libraries/vfs.h" +#include <stdbool.h> +#include <stddef.h> + +// --- Map Structures --- + +typedef struct { + Vector3 p[3]; + char texture[64]; + float shift[2]; + float rotate; + float scale[2]; +} MapPlane; + +typedef struct { + MapPlane *planes; + int plane_count; +} MapBrush; + +typedef struct { + char key[64]; + char value[256]; +} MapProperty; + +typedef struct { + MapProperty *properties; + int property_count; + MapBrush *brushes; + int brush_count; +} MapEntity; + +typedef struct { + MapEntity *entities; + int entity_count; +} Map; + +typedef struct { + const char *data; + size_t length; + size_t pos; +} MapParser; + +typedef struct { + Vector3 normal; + float dist; +} Plane; + +typedef struct { + Vector3 *verts; + int count; +} Polygon; + +typedef struct { + char texture[64]; + array(float) vertices; + array(float) texcoords; + array(float) normals; +} TextureGroup; + +typedef struct { + char name[64]; + Texture2D tex; +} CachedTexture; + +// --- Game State --- + +typedef struct { + Camera camera; + Model *world_models; + int world_model_count; + bool cursor_captured; + bool vsync; +} GameState; + +extern GameState game; + +// --- Prototypes --- + +// Map +char map_peek(MapParser *p); +char map_get(MapParser *p); +void map_skip_whitespace(MapParser *p); +bool map_expect(MapParser *p, char expected); +void map_parse_token(MapParser *p, char *buffer, int size); +Vector3 map_parse_vector(MapParser *p); +Map ParseMap(const char *filename); +void FreeMap(Map map); + +// Geometry +Plane PlaneFromPoints(Vector3 p1, Vector3 p2, Vector3 p3); +void PolyFree(Polygon p); +Polygon PolyClip(Polygon poly, Plane plane); +Polygon CreateLargeQuad(Plane plane); +Vector2 GetUV(Vector3 p, MapPlane *mp, Plane plane); + +// Game +Texture2D GetTexture(const char *name); +void InitGame(void); +void UpdateGame(void); +void DrawGame(void); +bool LoadMap(const char *filename); +void UnloadMap(void); + +#endif |
