mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-05-09 18:09:46 +08:00
dd2b6fd903
- 移除控制台版本相关代码,包括game_mode、ui、init_board等模块 - 将empty_board函数移至gobang.c核心模块 - 简化main.c仅保留GUI启动逻辑 - 更新Makefile仅构建GUI版本 - 清理过时文档和配置文件 - 优化GUI菜单和游戏窗口交互逻辑 - 添加AI难度配置支持
96 lines
1.6 KiB
C
96 lines
1.6 KiB
C
/**
|
|
* @file gui.h
|
|
* @brief 图形化用户界面头文件
|
|
* @note 使用Raylib库实现五子棋的图形化界面
|
|
* @author 刘航宇
|
|
* @date 2025-01-15
|
|
*/
|
|
|
|
#ifndef GUI_H
|
|
#define GUI_H
|
|
|
|
#include "gobang.h"
|
|
#include "config.h"
|
|
#include "globals.h"
|
|
|
|
// GUI函数声明
|
|
|
|
/**
|
|
* @brief 初始化GUI
|
|
* @details 初始化Raylib图形库和游戏界面组件
|
|
* @return 成功返回0,失败返回-1
|
|
*/
|
|
int init_gui();
|
|
|
|
/**
|
|
* @brief 清理GUI资源
|
|
* @details 关闭窗口
|
|
*/
|
|
void cleanup_gui();
|
|
|
|
/**
|
|
* @brief 渲染游戏画面
|
|
* @details 完整的游戏画面渲染流程
|
|
*/
|
|
void render_game();
|
|
|
|
/**
|
|
* @brief 处理事件
|
|
* @details 处理所有Raylib事件并执行相应操作
|
|
* @return 继续运行返回1,退出返回0
|
|
*/
|
|
int handle_events();
|
|
|
|
/**
|
|
* @brief 绘制棋盘
|
|
*/
|
|
void draw_board();
|
|
|
|
/**
|
|
* @brief 绘制棋子
|
|
*/
|
|
void draw_stones();
|
|
|
|
/**
|
|
* @brief 绘制UI元素
|
|
*/
|
|
void draw_ui_elements();
|
|
|
|
/**
|
|
* @brief 屏幕坐标转棋盘坐标
|
|
*/
|
|
int screen_to_board(int screen_x, int screen_y, int *board_x, int *board_y);
|
|
|
|
/**
|
|
* @brief 显示消息
|
|
*/
|
|
void show_message(const char *message);
|
|
|
|
/**
|
|
* @brief 启动玩家对战模式
|
|
*/
|
|
void start_pvp_game_gui();
|
|
|
|
/**
|
|
* @brief 启动人机对战模式
|
|
*/
|
|
void start_pve_game_gui();
|
|
|
|
/**
|
|
* @brief 启动复盘模式
|
|
*/
|
|
void start_replay_gui();
|
|
|
|
/**
|
|
* @brief 启动图形化界面模式
|
|
* @note 替代原来的 main 函数中的 GUI 分支逻辑
|
|
*/
|
|
int init_gui(); // Already declared
|
|
|
|
/**
|
|
* @brief 运行图形化界面模式
|
|
* @details 主循环处理事件、渲染画面和更新状态
|
|
*/
|
|
void run_gui_mode();
|
|
|
|
#endif // GUI_H
|