-
Notifications
You must be signed in to change notification settings - Fork 7
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
♻️ (video): Forward declare CGColor and CGPixel struct #1271
♻️ (video): Forward declare CGColor and CGPixel struct #1271
Conversation
Version comparison
|
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff listNo differenes where found in map files. |
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff listNo differenes where found in map files. |
Codecov Report
@@ Coverage Diff @@
## develop #1271 +/- ##
========================================
Coverage 98.20% 98.20%
========================================
Files 150 150
Lines 3727 3727
========================================
Hits 3660 3660
Misses 67 67
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
a78c489
to
aec856f
Compare
Kudos, SonarCloud Quality Gate passed! |
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.
LGTM 👍
A few questions/suggestions but not needed for this PR. If it makes sense we can do this in a future PR.
struct FilledRectangle { | ||
CGPoint origin {0, 0}; // * Top left corner by convention | ||
uint16_t width {}; | ||
uint16_t height {}; | ||
}; |
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.
why not just Rectangle
? :)
Also I'm wondering if it would not be simpler to store the color directly in the struct.
If we look at how SVG is designed, we can see that the fill
color is stored directly into the object and used when it's drawn.
This would allow us to move the rectangle on the screen without the need to store the color somewhere else.
In the future, we might have stroke
and stroke_width
which are also object related.
struct FilledRectangle { | |
CGPoint origin {0, 0}; // * Top left corner by convention | |
uint16_t width {}; | |
uint16_t height {}; | |
}; | |
struct Rectangle { | |
CGPoint origin {0, 0}; // * Top left corner by convention | |
uint16_t width {}; | |
uint16_t height {}; | |
CGColor color {}; | |
}; |
struct CGColor; | ||
struct Character; |
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.
Nice! 👍
In the future, I still have the wish to put all those "user types" in the main include
directory and have our code depend on it directly.
This is something discussed by Tony in the Cpp.chat episode https://www.youtube.com/watch?v=WRMhO9Gn5GM
Very interesting talk btw.
CGColor background = CGColor::white) = 0; | ||
virtual void display(const char *text, uint32_t size, uint32_t starting_line, CGColor foreground = CGColor::black, | ||
CGColor background = CGColor::white) = 0; | ||
virtual void drawChar(Character character, CGColor foreground, CGColor background) = 0; |
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.
the same question about background/foreground can be asked here: could they be stored directly inside the struct?
Character character {}; | ||
character.ascii = '.'; | ||
CGColor foreground_color = CGColor::pure_red; | ||
CGColor background_color = CGColor::black; |
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.
building on the previous comment, storing the colors inside the struct would allow us to do:
Character character {}; | |
character.ascii = '.'; | |
CGColor foreground_color = CGColor::pure_red; | |
CGColor background_color = CGColor::black; | |
Character character {.ascii = '.', | |
.foreground = CGColor::pure_red, | |
.background= CGColor::black, | |
}; |
Validation