feat(game_core): 重构游戏引擎并添加新功能
- 重构了游戏引擎的核心逻辑和架构 - 添加了新的实体组件系统(ECS) - 实现了简单的碰撞检测和响应 - 新增了地图和子弹功能 - 优化了输入处理和渲染逻辑 - 调整了游戏控制方式
This commit is contained in:
46
game_core/config.h
Normal file
46
game_core/config.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
|
||||
/**
|
||||
* only for main can include
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define _pynic_logout_printf(...) fprintf(fp , ##__VA_ARGS__)
|
||||
#define GE_VEC2I_USE_SHORT_NAMES
|
||||
#include <ge_core.h>
|
||||
/**
|
||||
* some cross plantform config
|
||||
*/
|
||||
#define KEY_UP 'w'
|
||||
#define KEY_DOWN 's'
|
||||
#define KEY_LEFT 'a'
|
||||
#define KEY_RIGHT 'd'
|
||||
#define KEY_ATTACK 'f'
|
||||
|
||||
#define KEY_EXIT 'q'
|
||||
#define KEY_STOP 'p'
|
||||
#define KEY_CONTINUE 'p'
|
||||
|
||||
/**
|
||||
* logger init part
|
||||
*/
|
||||
static FILE* fp;
|
||||
logger_t logger;
|
||||
static void log_handler
|
||||
(log_level_t level, const char* module, const char* file, int line, const char* message) {
|
||||
fprintf(fp, "[%s] %s:%d | %s: %s\n",
|
||||
pynic_level_str(level), file, line, module, message);
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
static inline void init_config() {
|
||||
fp = fopen("D:\\Git_Code\\school_stm32\\game_core\\log.txt", "w+");
|
||||
init_logger_ex(&logger, "game", log_handler);
|
||||
Assert(fp != NULL);
|
||||
}
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
Reference in New Issue
Block a user