feat(game_core): 重构游戏引擎并添加新功能
- 重构了游戏引擎的核心逻辑和架构 - 添加了新的实体组件系统(ECS) - 实现了简单的碰撞检测和响应 - 新增了地图和子弹功能 - 优化了输入处理和渲染逻辑 - 调整了游戏控制方式
This commit is contained in:
34
game_engine/ecs/ge_collision_component.h
Normal file
34
game_engine/ecs/ge_collision_component.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __GE_COLLISION_COMPONENT_H__
|
||||
#define __GE_COLLISION_COMPONENT_H__
|
||||
|
||||
#include <utils/ge_vector2i.h>
|
||||
typedef unsigned char ge_layers_t;
|
||||
|
||||
typedef enum {
|
||||
GE_COLLISION_COMP_TYPE_NONE,
|
||||
GE_COLLISION_COMP_TYPE_BOX,
|
||||
GE_COLLISION_COMP_TYPE_TILEMAP,
|
||||
} ge_collision_type_t;
|
||||
|
||||
typedef struct ge_collision_box {
|
||||
ge_vector2i_t relative_pos;
|
||||
ge_vector2i_t size;
|
||||
} ge_collision_box_t;
|
||||
|
||||
typedef struct ge_collision_tilemap {
|
||||
ge_vector2i_t map_size;
|
||||
ge_unit_t tile_size;
|
||||
ge_layers_t* layers;
|
||||
} ge_collision_tilemap_t;
|
||||
|
||||
typedef struct ge_collision_component {
|
||||
ge_collision_type_t type;
|
||||
ge_layers_t layers;
|
||||
ge_layers_t mask;
|
||||
struct {
|
||||
ge_collision_box_t box;
|
||||
ge_collision_tilemap_t tilemap;
|
||||
} collider;
|
||||
} ge_collision_component_t;
|
||||
|
||||
#endif /* __GE_COLLISION_COMPONENT_H__ */
|
||||
Reference in New Issue
Block a user