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库
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
/**
|
|
* @file main.c
|
|
* @brief 五子棋游戏主函数文件
|
|
* @note 本文件包含了游戏的主循环、模式选择和游戏初始化等功能
|
|
* @brief 将以下指令复制到powershell
|
|
*
|
|
* !编译(需要IUP库):
|
|
* mingw32-make gui
|
|
.\bin\gobang_gui.exe
|
|
*
|
|
* @note gcc 为编译器,添加了-lws2_32链接Windows网络库
|
|
* @note IUP 的路径:libs\iup-3.31_Win64_dllw6_lib
|
|
* @brief & "D:\Program Files (x86)\Inno Setup 6\iscc.exe" installer\\installer.iss
|
|
*/
|
|
|
|
#include "gui.h"
|
|
#include "config.h"
|
|
#include <stdio.h>
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#include <direct.h>
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// 设置控制台编码为UTF-8
|
|
#ifdef _WIN32
|
|
system("chcp 65001 > nul"); // 设置控制台编码为UTF-8
|
|
SetConsoleOutputCP(65001); // 设置控制台输出编码
|
|
SetConsoleCP(65001); // 设置控制台输入编码
|
|
_mkdir("records");
|
|
#endif
|
|
|
|
// 加载游戏配置
|
|
load_game_config();
|
|
|
|
// 启动图形化界面
|
|
run_gui_mode();
|
|
return 0;
|
|
} |