Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.10)

# Set the project name
project(Cli)

# Define the Cli library
add_library(Cli STATIC
Cli.cpp
Cli.h
)

target_include_directories(Cli PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(Cli PUBLIC DrawingEngine ClassFactory)

19 changes: 19 additions & 0 deletions Cli/Cli.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Cli.h"

Cli::Cli(any widthI, any heightI, any wallI, any routeI) : DrawingEngine(widthI, heightI) {
writeToLogs("CLI created");
if (!checkIfCorrect() || !setVar<char>(wall, wallI, "wall") || !setVar<char>(route, routeI, "route")) {
setNotCorrected();
}
}

void Cli::print(vector<vector<int>> grid) {
for (int v = 0; v < getVar<int>("height"); v++) {
for (int i = 0; i < getVar<int>("width"); ++i) {
char toPrint = (grid[v][i] == 0) ? getVar<char>("route") : getVar<char>("wall");
cout << toPrint;
}
cout << endl;
}
}

25 changes: 25 additions & 0 deletions Cli/Cli.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef CLI_H
#define CLI_H

#include <iostream>
#include <any>
#include <memory>
#include <vector>
#include "../Logs/Logs.h"
#include "../DrawingEngine/DrawingEngine.h"

using namespace std;

class Cli : public DrawingEngine {
private:
shared_ptr<char> wall = make_shared<char>();
shared_ptr<char> route = make_shared<char>();

public:
Cli(any widthI, any heightI, any wallI, any routeI);

void print(vector<vector<int>> grid);
};

#endif /* CLI_H */