mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-05-09 18:09:46 +08:00
88f12bcfea
- 添加ENet库作为网络通信基础,替换原有的原生Socket实现 - 扩展游戏模式支持局域网联机对战(PvP网络模式) - 重构网络状态结构以适配ENet的Host/Peer模型 - 在图形界面中添加网络对战菜单,支持创建房间和加入房间 - 实现网络消息的发送与接收,包括落子、断开连接等消息类型 - 为网络对战添加定时器轮询机制,实时处理网络事件 - 更新构建系统以编译和链接ENet库
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
#ifndef GUI_INTERNAL_H
|
|
#define GUI_INTERNAL_H
|
|
|
|
#include <iup.h>
|
|
|
|
// 全局变量声明 (在 gui_core.c 中定义)
|
|
extern Ihandle *dlg;
|
|
extern Ihandle *board_canvas;
|
|
extern Ihandle *lbl_player;
|
|
extern Ihandle *lbl_status;
|
|
extern int gui_loop_running;
|
|
extern int gui_game_mode; // 0: PvP, 1: PvE, 2: Replay
|
|
extern int replay_total_steps; // 复盘总步数
|
|
|
|
// 绘图函数 (在 gui_draw.c 中定义)
|
|
void set_draw_color(Ihandle *ih, unsigned char r, unsigned char g, unsigned char b);
|
|
void draw_board_iup(Ihandle *ih);
|
|
void draw_stones_iup(Ihandle *ih);
|
|
|
|
// 核心功能 (在 gui_core.c 中定义)
|
|
void update_ui_labels();
|
|
int screen_to_board(int screen_x, int screen_y, int *board_x, int *board_y);
|
|
|
|
// 游戏窗口 (在 gui_game.c 中定义)
|
|
void create_game_window();
|
|
void start_pvp_game_gui();
|
|
void start_pve_game_gui();
|
|
void start_network_game_gui(); // 新增:启动网络对战游戏窗口
|
|
int action_cb(Ihandle *ih);
|
|
int button_cb(Ihandle *ih, int button, int pressed, int x, int y, char *status);
|
|
int k_any_cb(Ihandle *ih, int c);
|
|
int btn_back_cb(Ihandle *ih);
|
|
int btn_undo_cb(Ihandle *ih);
|
|
int btn_save_cb(Ihandle *ih);
|
|
|
|
// 复盘功能 (在 gui_replay.c 中定义)
|
|
void select_replay_file_gui();
|
|
int btn_replay_prev_cb(Ihandle *ih);
|
|
int btn_replay_next_cb(Ihandle *ih);
|
|
int btn_replay_sel_ok_cb(Ihandle *ih);
|
|
int btn_replay_sel_cancel_cb(Ihandle *ih);
|
|
|
|
#endif // GUI_INTERNAL_H
|