summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt15
-rw-r--r--src/game/game.cpp6
-rw-r--r--src/game/globals.hpp1
-rw-r--r--src/main.cpp37
4 files changed, 25 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 9c84396..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-cmake_minimum_required(VERSION 3.15)
-
-project(minesweeper LANGUAGES CXX)
-
-set(CMAKE_CXX_STANDARD 17)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-add_executable(minesweeper
- src/main.cpp
- src/game/game.cpp
-)
-
-target_include_directories(minesweeper PRIVATE
- src
-)
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 4f4d1f9..463a84e 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -4,6 +4,12 @@
#include <cstdio>
#include <iostream>
+using namespace std;
+
+void Game::editDiff(){
+ cout << "Now editing custom difficulty" << endl;
+}
+
void Game::initDiff(int diff) {
switch (diff) {
case 0:
diff --git a/src/game/globals.hpp b/src/game/globals.hpp
index 054dc6e..7518a84 100644
--- a/src/game/globals.hpp
+++ b/src/game/globals.hpp
@@ -15,6 +15,7 @@ private:
int mines;
public:
+ void editDiff();
void initDiff(int diff);
void initBoard();
void displayBoard();
diff --git a/src/main.cpp b/src/main.cpp
index 5498cf9..3f18423 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,28 +3,27 @@
using namespace std;
int main(){
+ Game game;
int choice;
- while(!inGame){
- cout << "Welcome to minesweeper 0.1.0\n";
- cout << "\n";
- cout << "Select difficulty:\n"
- "1. Easy\n"
- "2. Medium\n"
- "3. Hard\n"
- "4. Custom\n";
- cout << "Difficulty: ";
- cin >> choice;
+ cout << "Welcome to minesweeper 0.1.0\n";
+ cout << "\n";
+ cout << "Select difficulty:\n"
+ "1. Easy\n"
+ "2. Medium\n"
+ "3. Hard\n"
+ "4. Custom\n";
+ cout << "Difficulty: ";
+ cin >> choice;
- if(choice == 1){
- game(0);
- } else if(choice == 2){
- game(1);
- } else if(choice == 3){
- game(2);
- } else if(choice == 4){
- game(3);
- }
+ if(choice == 1){
+ game.initDiff(0);
+ } else if(choice == 2){
+ game.initDiff(1);
+ } else if(choice == 3){
+ game.initDiff(2);
+ } else if(choice == 4){
+ game.initDiff(3);
}
return 0;