Copy3DEngine/include/C3D/game.h

67 lines
915 B
C
Raw Normal View History

2024-10-05 00:56:13 +02:00
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
2024-10-09 16:43:10 +02:00
// See README.md for the exact licensing, by ...
2024-10-05 00:56:13 +02:00
2024-10-10 17:53:09 +02:00
#pragma once
2024-10-05 00:56:13 +02:00
#include "utils.h"
2024-10-10 17:53:09 +02:00
typedef struct {
V2d pos;
2024-10-22 12:27:16 +02:00
Rect coll;
2024-10-10 17:53:09 +02:00
int tex;
} Sprite;
typedef struct {
int w, h;
uint8_t *dat;
int spritec;
Sprite sprites[SINDEX_S/2];
} RcMap;
2024-10-05 00:56:13 +02:00
2024-10-22 12:27:16 +02:00
//Extension of Sprite, keep all first items common
2024-10-05 00:56:13 +02:00
typedef struct {
V2d pos;
2024-10-22 12:27:16 +02:00
Rect coll;
int tex;
2024-10-05 00:56:13 +02:00
V2d dir;
V2d plane;
} RcActor;
2024-10-09 16:43:10 +02:00
typedef struct {
uint8_t exit;
} RcFlags;
2024-10-05 00:56:13 +02:00
typedef struct {
RcActor player;
2024-10-09 16:43:10 +02:00
int logic_time;
2024-10-10 17:53:09 +02:00
RcMap *current_map;
2024-10-05 00:56:13 +02:00
2024-10-09 16:43:10 +02:00
RcFlags flags;
2024-10-05 00:56:13 +02:00
} RcGame;
2024-10-09 16:43:10 +02:00
typedef int (RcLogicFunc)(RcGame *);
//Returns non-zero on failure (likely max hook count was reached)
int add_logic_hook(RcLogicFunc *func);
//Retruns non-zero on failure
int remove_logic_hook(RcLogicFunc *func);
void clear_logic_hooks();
void do_logic(RcGame *game, int delta);