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
15 changes: 15 additions & 0 deletions DrawingEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.10)

# Set the project name
project(DrawingEngine)

# Create a library target for DrawingEngine module
add_library(DrawingEngine STATIC
DrawingEngine.cpp
DrawingEngine.h
)

# Set the include directory
target_include_directories(DrawingEngine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(DrawingEngine PUBLIC ClassFactory)

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

DrawingEngine::DrawingEngine(any widthI, any heightI) : ClassFactory() {
if (!setVar(width, widthI, "width") || !setVar(height, heightI, "height")) {
setNotCorrected();
}
}

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative paths shall not be used for includes

#include "../ClassFactory/ClassFactory.h"

using namespace std;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class DrawingEngine : public ClassFactory {
private:
shared_ptr<int> width = make_shared<int>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just ints, or even better unsigned ints as the width and height shall not be negative

shared_ptr<int> height = make_shared<int>();

public:
DrawingEngine(any widthI, any heightI);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would you take any as width and height when only valid type is unsigned int?


virtual void print(vector<vector<int>> grid) = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DrawingEngine shall be able to draw the Drawables, not a buffer of ints.

The drawing engine shall have as a member a Framebuffer which would be a some type of container holding some representation of pixel, preferably (r,g,b) values

};

#endif /* DRAWINGENGINE_H */