-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation of Drawing engine #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) | ||
|
|
| 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(); | ||
| } | ||
| } | ||
|
|
| 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" | ||
| #include "../ClassFactory/ClassFactory.h" | ||
|
|
||
| using namespace std; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| class DrawingEngine : public ClassFactory { | ||
| private: | ||
| shared_ptr<int> width = make_shared<int>(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 */ | ||
|
|
||
There was a problem hiding this comment.
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