diff --git a/README.md b/README.md index 754ca4f..3928b17 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,21 @@ ![Build Status](https://img.shields.io/badge/build-passing-brightgreen) ![License](https://img.shields.io/badge/license-MIT-blue) -![Version](https://img.shields.io/badge/version-v8.0-blue) +![Version](https://img.shields.io/badge/version-v8.2-blue) ![Platform](https://img.shields.io/badge/platform-Windows-lightgrey) -> 🎯 **最新版本 v8.0** - GUI图形化界面更新,实现SDL3图形化界面、现代化用户体验、可视化棋盘操作等重大功能升级 +> 🎯 **最新版本 v8.2** - 编译脚本优化更新,完善批处理脚本功能、增强用户编译体验、优化开发工作流程 ## 📋 大版本更新 +### v8.2 (2025-01-20) - 编译脚本优化更新 +- 🔧 **交互式编译脚本** - compile_gui.bat支持选择编译控制台或GUI版本 +- 📋 **用户友好界面** - 提供清晰的编译选项菜单和操作指引 +- ⚡ **编译流程优化** - 统一编译参数,解决SDL3依赖问题 +- 🌐 **多语言支持** - 英文界面避免编码问题,确保兼容性 +- ✅ **错误处理完善** - 添加无效输入处理和详细错误提示 +- 🎯 **开发体验提升** - 简化编译流程,提高开发效率 + ### v8.0 (2025-01-18) - GUI图形化界面更新 - 🖥️ **SDL3图形化界面** - 全新的现代化图形用户界面 - 🎮 **可视化棋盘操作** - 支持鼠标点击落子和直观的棋盘显示 diff --git a/compile.bat b/compile.bat new file mode 100644 index 0000000..80aea60 --- /dev/null +++ b/compile.bat @@ -0,0 +1,99 @@ +@echo off +echo ===== Gobang Game Compile Script ===== +echo. +echo Please select compile version: +echo 1. Console version (gobang_console.exe) +echo 2. GUI version (gobang_gui.exe) +echo 3. Compile all versions +echo 0. Exit +echo. +set /p choice="Please enter your choice (0-3): " + +if "%choice%"=="0" goto :exit +if "%choice%"=="1" goto :console +if "%choice%"=="2" goto :gui +if "%choice%"=="3" goto :all +echo Invalid choice! +pause +exit /b 1 + +:console +echo. +echo Compiling console version... +echo. +gcc -std=c17 -o gobang_console.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 +if %ERRORLEVEL% EQU 0 ( + echo. + echo Compilation successful! Generated: gobang_console.exe + echo Run command: .\gobang_console.exe + echo. +) else ( + echo. + echo Compilation failed! Please check source files and compiler installation + echo. +) +goto :end + +:gui +echo. +echo Compiling GUI version... +echo. +REM Check if SDL3 library exists +if not exist "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include" ( + echo Error: SDL3 library not found! + echo Please ensure SDL3 is extracted to: D:\settings\SDL\SDL3-3.2.22\ + goto :end +) +gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 +if %ERRORLEVEL% EQU 0 ( + echo. + echo Compilation successful! Generated: gobang_gui.exe + echo. + echo Copying SDL3.dll to current directory... + copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . >nul 2>&1 + echo Run command: .\gobang_gui.exe + echo. +) else ( + echo. + echo Compilation failed! Please check: + echo 1. SDL3 library path is correct + echo 2. All source files exist + echo 3. gcc compiler is installed + echo. +) +goto :end + +:all +echo. +echo Compiling all versions... +echo. +echo [1/2] Compiling console version... +gcc -std=c17 -o gobang_console.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 +if %ERRORLEVEL% EQU 0 ( + echo Console version compilation successful! +) else ( + echo Console version compilation failed! +) +echo. +echo [2/2] Compiling GUI version... +if not exist "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include" ( + echo Error: SDL3 library not found! Skipping GUI version compilation + goto :end +) +gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 +if %ERRORLEVEL% EQU 0 ( + echo GUI version compilation successful! + copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . >nul 2>&1 +) else ( + echo GUI version compilation failed! +) +echo. +echo Compilation complete! Generated files: +dir *.exe 2>nul +echo. +goto :end + +:end +pause + +:exit \ No newline at end of file diff --git a/compile_gui.bat b/compile_gui.bat deleted file mode 100644 index 8948df7..0000000 --- a/compile_gui.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo off -chcp 65001 >nul -echo Compiling Gobang GUI version... -echo. - -REM Check if SDL3 library exists -if not exist "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include" ( - echo Error: SDL3 library not found! - echo Please ensure SDL3 is extracted to: D:\settings\SDL\SDL3-3.2.22\ - pause - exit /b 1 -) - -REM Compile GUI version -gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 - -if %ERRORLEVEL% EQU 0 ( - echo. - echo Compilation successful! Generated: gobang_gui.exe - echo. - echo Copy SDL3.dll to current directory... - copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . - echo. - echo Run GUI version: - echo .\gobang_gui.exe - echo. -) else ( - echo. - echo Compilation failed! Please check: - echo 1. SDL3 library path is correct - echo 2. All source files exist - echo 3. gcc compiler is installed - echo. -) - -pause \ No newline at end of file diff --git a/main.c b/main.c index c56808a..577f6d5 100644 --- a/main.c +++ b/main.c @@ -5,14 +5,14 @@ * @brief 将以下指令复制到powershell * * !控制台版本编译: - * gcc -std=c17 -o gobang.exe *.c -lws2_32 - .\gobang.exe + * gcc -std=c17 -o gobang_console.exe *.c -lws2_32 + .\gobang_console.exe * * !图形化版本编译(需要SDL3): * gcc -std=c17 -o gobang_gui.exe *.c -ID:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\include -LD:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\lib -lSDL3 -lws2_32 copy "D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32\bin\SDL3.dll" . .\gobang_gui.exe - * + * * @detail gcc 为编译器,添加了-lws2_32链接Windows网络库 * @detail SDL3 的路径:D:\settings\SDL\SDL3-3.2.22\x86_64-w64-mingw32 * @brief & "D:\Program Files (x86)\NSIS\makensis.exe" "installer\\installer.nsi"