mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-05-09 18:09:46 +08:00
feat(gui): 添加主菜单和游戏模式选择界面
- 新增 GUI 主菜单,支持玩家对战、人机对战、复盘模式和设置选项 - 新增游戏设置对话框,可配置棋盘大小、禁手、计时器和 AI 难度 - 重构 GUI 游戏窗口,集成悔棋、保存和返回菜单功能 - 更新 Makefile 以支持 PowerShell 并添加新源文件编译 - 调整窗口尺寸为 1000x800 以提供更好的游戏体验
This commit is contained in:
+2
-2
@@ -118,8 +118,8 @@
|
||||
|
||||
//---------- GUI界面参数 ----------//
|
||||
// 窗口和棋盘配置
|
||||
#define WINDOW_WIDTH 800
|
||||
#define WINDOW_HEIGHT 600
|
||||
#define WINDOW_WIDTH 1000
|
||||
#define WINDOW_HEIGHT 800
|
||||
#define BOARD_OFFSET_X 50
|
||||
#define BOARD_OFFSET_Y 50
|
||||
#define CELL_SIZE 30
|
||||
|
||||
@@ -27,6 +27,7 @@ extern int network_timeout; // 网络超时时间
|
||||
|
||||
// ==================== AI相关变量 ====================
|
||||
extern double defense_coefficient; // 防守系数
|
||||
extern int ai_difficulty; // AI难度 (1-5)
|
||||
|
||||
// ==================== 网络相关变量 ====================
|
||||
extern NetworkGameState network_state; // 网络游戏状态
|
||||
|
||||
@@ -66,4 +66,19 @@ int screen_to_board(int screen_x, int screen_y, int *board_x, int *board_y);
|
||||
*/
|
||||
void show_message(const char *message);
|
||||
|
||||
/**
|
||||
* @brief 启动玩家对战模式
|
||||
*/
|
||||
void start_pvp_game_gui();
|
||||
|
||||
/**
|
||||
* @brief 启动人机对战模式
|
||||
*/
|
||||
void start_pve_game_gui();
|
||||
|
||||
/**
|
||||
* @brief 启动复盘模式
|
||||
*/
|
||||
void start_replay_gui();
|
||||
|
||||
#endif // GUI_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef GUI_MENU_H
|
||||
#define GUI_MENU_H
|
||||
|
||||
/**
|
||||
* @brief 创建并显示主菜单
|
||||
*/
|
||||
void create_main_menu();
|
||||
|
||||
/**
|
||||
* @brief 显示主菜单
|
||||
*/
|
||||
void show_main_menu();
|
||||
|
||||
/**
|
||||
* @brief 隐藏主菜单
|
||||
*/
|
||||
void hide_main_menu();
|
||||
|
||||
#endif // GUI_MENU_H
|
||||
Reference in New Issue
Block a user