feat(game): 添加基础游戏引擎和渲染模块
- 新增游戏引擎核心模块,包括初始化和运行逻辑 - 实现基本的渲染功能,支持控制台输出 - 添加物理引擎基础,包括碰撞检测 - 集成日志系统,用于调试和信息输出 - 创建窗口和输入管理模块
This commit is contained in:
20
game_engine/physics/ge_collision_box.h
Normal file
20
game_engine/physics/ge_collision_box.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef __GE_COLLISION_H__
|
||||
#define __GE_COLLISION_H__
|
||||
|
||||
#include "ge_physics.h"
|
||||
|
||||
typedef struct ge_collision {
|
||||
ge_phy_layers_t layers;
|
||||
ge_phy_layers_t mask;
|
||||
ge_vector2i_t position;
|
||||
ge_vector2i_t size;
|
||||
} ge_phy_box_t;
|
||||
|
||||
static inline int check_box_collision(ge_phy_box_t* a, ge_phy_box_t* b) {
|
||||
return (a->position.x < b->position.x + b->size.x) &&
|
||||
(a->position.x + a->size.x > b->position.x) &&
|
||||
(a->position.y < b->position.y + b->size.y) &&
|
||||
(a->position.y + a->size.y > b->position.y);
|
||||
}
|
||||
|
||||
#endif // __GE_COLLISION_H__
|
||||
Reference in New Issue
Block a user