From 67f48505819520f057ec933721a52a85868ee88f Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Sun, 25 Jan 2026 15:09:34 +0100 Subject: experimental builds and header fix --- build/.ninja_deps | Bin 7660 -> 8652 bytes build/.ninja_log | 5 ++- build/CMakeCache.txt | 11 +++++- build/CMakeFiles/TargetDirectories.txt | 2 +- .../minesweeper.dir/src/game/game.cpp.obj | Bin 0 -> 1336 bytes build/CMakeFiles/minesweeper.dir/src/main.cpp.obj | Bin 0 -> 2174 bytes build/CMakeFiles/rules.ninja | 6 +-- build/build.ninja | 42 ++++++++++----------- src/game/globals.hpp | 22 ++++++++++- 9 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 build/CMakeFiles/minesweeper.dir/src/game/game.cpp.obj create mode 100644 build/CMakeFiles/minesweeper.dir/src/main.cpp.obj diff --git a/build/.ninja_deps b/build/.ninja_deps index 0456b55..f45e8d6 100644 Binary files a/build/.ninja_deps and b/build/.ninja_deps differ diff --git a/build/.ninja_log b/build/.ninja_log index 6d46b37..ca28a97 100644 --- a/build/.ninja_log +++ b/build/.ninja_log @@ -1,3 +1,6 @@ # ninja log v6 -1 286 7910530735292674 CMakeFiles/my_project.dir/src/main.cpp.obj ba0350b409c2bcde 7 291 7910530735303785 CMakeFiles/my_project.dir/src/game/game.cpp.obj c7697ab1edbf7234 +1 286 7910530735292674 CMakeFiles/my_project.dir/src/main.cpp.obj ba0350b409c2bcde +1 166 7910531477594577 build.ninja 45552195ee7b13a7 +29 303 7910531478315183 CMakeFiles/minesweeper.dir/src/main.cpp.obj 56365d14a6f6ed23 +34 310 7910531478315183 CMakeFiles/minesweeper.dir/src/game/game.cpp.obj a385ee6493ade9b6 diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt index c1de7ad..7bab2d8 100644 --- a/build/CMakeCache.txt +++ b/build/CMakeCache.txt @@ -125,7 +125,7 @@ CMAKE_PROJECT_DESCRIPTION:STATIC= CMAKE_PROJECT_HOMEPAGE_URL:STATIC= //Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=MyProject +CMAKE_PROJECT_NAME:STATIC=minesweeper //Path to a program. CMAKE_RANLIB:FILEPATH=D:/MinGW/bin/ranlib.exe @@ -219,6 +219,15 @@ MyProject_IS_TOP_LEVEL:STATIC=ON //Value Computed by CMake MyProject_SOURCE_DIR:STATIC=D:/code/minesweeper +//Value Computed by CMake +minesweeper_BINARY_DIR:STATIC=D:/code/minesweeper/build + +//Value Computed by CMake +minesweeper_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +minesweeper_SOURCE_DIR:STATIC=D:/code/minesweeper + ######################## # INTERNAL cache entries diff --git a/build/CMakeFiles/TargetDirectories.txt b/build/CMakeFiles/TargetDirectories.txt index 4b192bd..224455f 100644 --- a/build/CMakeFiles/TargetDirectories.txt +++ b/build/CMakeFiles/TargetDirectories.txt @@ -1,3 +1,3 @@ -D:/code/minesweeper/build/CMakeFiles/my_project.dir +D:/code/minesweeper/build/CMakeFiles/minesweeper.dir D:/code/minesweeper/build/CMakeFiles/edit_cache.dir D:/code/minesweeper/build/CMakeFiles/rebuild_cache.dir diff --git a/build/CMakeFiles/minesweeper.dir/src/game/game.cpp.obj b/build/CMakeFiles/minesweeper.dir/src/game/game.cpp.obj new file mode 100644 index 0000000..302016a Binary files /dev/null and b/build/CMakeFiles/minesweeper.dir/src/game/game.cpp.obj differ diff --git a/build/CMakeFiles/minesweeper.dir/src/main.cpp.obj b/build/CMakeFiles/minesweeper.dir/src/main.cpp.obj new file mode 100644 index 0000000..8d11f0c Binary files /dev/null and b/build/CMakeFiles/minesweeper.dir/src/main.cpp.obj differ diff --git a/build/CMakeFiles/rules.ninja b/build/CMakeFiles/rules.ninja index 4a34568..0408dd1 100644 --- a/build/CMakeFiles/rules.ninja +++ b/build/CMakeFiles/rules.ninja @@ -6,7 +6,7 @@ # It is included in the main 'build.ninja'. # ============================================================================= -# Project: MyProject +# Project: minesweeper # Configurations: # ============================================================================= # ============================================================================= @@ -14,7 +14,7 @@ ############################################# # Rule for compiling CXX files. -rule CXX_COMPILER__my_project_unscanned_ +rule CXX_COMPILER__minesweeper_unscanned_ depfile = $DEP_FILE deps = gcc command = ${LAUNCHER}${CODE_CHECK}D:\MinGW\bin\c++.exe $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in @@ -24,7 +24,7 @@ rule CXX_COMPILER__my_project_unscanned_ ############################################# # Rule for linking CXX executable. -rule CXX_EXECUTABLE_LINKER__my_project_ +rule CXX_EXECUTABLE_LINKER__minesweeper_ command = C:\WINDOWS\system32\cmd.exe /C "$PRE_LINK && D:\MinGW\bin\c++.exe $FLAGS $LINK_FLAGS $in -o $TARGET_FILE -Wl,--out-implib,$TARGET_IMPLIB -Wl,--major-image-version,0,--minor-image-version,0 $LINK_PATH $LINK_LIBRARIES && $POST_BUILD" description = Linking CXX executable $TARGET_FILE restat = $RESTAT diff --git a/build/build.ninja b/build/build.ninja index 9d57613..4f799ff 100644 --- a/build/build.ninja +++ b/build/build.ninja @@ -11,7 +11,7 @@ # ============================================================================= # ============================================================================= -# Project: MyProject +# Project: minesweeper # Configurations: # ============================================================================= @@ -36,44 +36,44 @@ include CMakeFiles/rules.ninja cmake_ninja_workdir = D$:/code/minesweeper/build/ # ============================================================================= -# Object build statements for EXECUTABLE target my_project +# Object build statements for EXECUTABLE target minesweeper ############################################# -# Order-only phony target for my_project +# Order-only phony target for minesweeper -build cmake_object_order_depends_target_my_project: phony || . +build cmake_object_order_depends_target_minesweeper: phony || . -build CMakeFiles/my_project.dir/src/main.cpp.obj: CXX_COMPILER__my_project_unscanned_ D$:/code/minesweeper/src/main.cpp || cmake_object_order_depends_target_my_project - DEP_FILE = CMakeFiles\my_project.dir\src\main.cpp.obj.d +build CMakeFiles/minesweeper.dir/src/main.cpp.obj: CXX_COMPILER__minesweeper_unscanned_ D$:/code/minesweeper/src/main.cpp || cmake_object_order_depends_target_minesweeper + DEP_FILE = CMakeFiles\minesweeper.dir\src\main.cpp.obj.d FLAGS = -std=gnu++1z INCLUDES = -ID:/code/minesweeper/src - OBJECT_DIR = CMakeFiles\my_project.dir - OBJECT_FILE_DIR = CMakeFiles\my_project.dir\src + OBJECT_DIR = CMakeFiles\minesweeper.dir + OBJECT_FILE_DIR = CMakeFiles\minesweeper.dir\src -build CMakeFiles/my_project.dir/src/game/game.cpp.obj: CXX_COMPILER__my_project_unscanned_ D$:/code/minesweeper/src/game/game.cpp || cmake_object_order_depends_target_my_project - DEP_FILE = CMakeFiles\my_project.dir\src\game\game.cpp.obj.d +build CMakeFiles/minesweeper.dir/src/game/game.cpp.obj: CXX_COMPILER__minesweeper_unscanned_ D$:/code/minesweeper/src/game/game.cpp || cmake_object_order_depends_target_minesweeper + DEP_FILE = CMakeFiles\minesweeper.dir\src\game\game.cpp.obj.d FLAGS = -std=gnu++1z INCLUDES = -ID:/code/minesweeper/src - OBJECT_DIR = CMakeFiles\my_project.dir - OBJECT_FILE_DIR = CMakeFiles\my_project.dir\src\game + OBJECT_DIR = CMakeFiles\minesweeper.dir + OBJECT_FILE_DIR = CMakeFiles\minesweeper.dir\src\game # ============================================================================= -# Link build statements for EXECUTABLE target my_project +# Link build statements for EXECUTABLE target minesweeper ############################################# -# Link the executable my_project.exe +# Link the executable minesweeper.exe -build my_project.exe: CXX_EXECUTABLE_LINKER__my_project_ CMakeFiles/my_project.dir/src/main.cpp.obj CMakeFiles/my_project.dir/src/game/game.cpp.obj +build minesweeper.exe: CXX_EXECUTABLE_LINKER__minesweeper_ CMakeFiles/minesweeper.dir/src/main.cpp.obj CMakeFiles/minesweeper.dir/src/game/game.cpp.obj LINK_LIBRARIES = -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 - OBJECT_DIR = CMakeFiles\my_project.dir + OBJECT_DIR = CMakeFiles\minesweeper.dir POST_BUILD = cd . PRE_LINK = cd . - TARGET_FILE = my_project.exe - TARGET_IMPLIB = libmy_project.dll.a - TARGET_PDB = my_project.exe.dbg + TARGET_FILE = minesweeper.exe + TARGET_IMPLIB = libminesweeper.dll.a + TARGET_PDB = minesweeper.exe.dbg ############################################# @@ -101,7 +101,7 @@ build rebuild_cache: phony CMakeFiles/rebuild_cache.util # ============================================================================= # Target aliases. -build my_project: phony my_project.exe +build minesweeper: phony minesweeper.exe # ============================================================================= # Folder targets. @@ -111,7 +111,7 @@ build my_project: phony my_project.exe ############################################# # Folder: D:/code/minesweeper/build -build all: phony my_project.exe +build all: phony minesweeper.exe # ============================================================================= # Built-in targets diff --git a/src/game/globals.hpp b/src/game/globals.hpp index 6dfd429..2616013 100644 --- a/src/game/globals.hpp +++ b/src/game/globals.hpp @@ -1,7 +1,25 @@ #ifndef GAME_HPP #define GAME_HPP -extern bool inGame; -void game(int diff); +#include + +class Game { +private: + static constexpr int MAX_W = 32; + static constexpr int MAX_H = 32; + + int boardWidth; + int boardHeight; + + bool bombMap[MAX_H][MAX_W]; + int tileMap[MAX_H][MAX_W]; + + int mines; + +public: + void initDiff(int diff); + void initBoard(); + void displayBoard(); +}; #endif -- cgit v1.2.3