-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support SDL color #99
Conversation
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.
Welcome to the club! 👍
Great job, though here's a dozen of minor improvements :)
You could also extend tests, but it can be done in separate PR.
Also please ignore AppVeyor failure, which is unrelated.
.gitignore
Outdated
@@ -42,9 +42,14 @@ tests/live_* | |||
tests/test_* | |||
!tests/live_*.cc | |||
!tests/test_*.cc | |||
libSDL2pp.dylib |
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.
Good, but please submit these .gitignore changes as a separate PR, as they are unrelated.
SDL2pp/Color.cc
Outdated
@@ -0,0 +1,27 @@ | |||
/* | |||
libSDL2pp - C++11 bindings/wrapper for SDL2 | |||
Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru> |
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.
Nah, it wasn't me who wrote it, so please put yourself here and in other new files :)
SDL2pp/Renderer.cc
Outdated
@@ -197,6 +197,10 @@ Renderer& Renderer::SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) { | |||
return *this; | |||
} | |||
|
|||
Renderer& Renderer::SetDrawColor(const Color color) { |
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.
You don't need const here
SDL2pp/Surface.cc
Outdated
@@ -145,6 +145,13 @@ SDL_BlendMode Surface::GetBlendMode() const { | |||
return blendMode; | |||
} | |||
|
|||
Color Surface::GetColorAndAlphaMod() const { | |||
Color color; | |||
GetColorMod(color.r, color.g, color.b); |
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.
Whitespace inconsistency, please use tabs
SDL2pp/Surface.cc
Outdated
@@ -180,6 +187,10 @@ Surface& Surface::SetColorMod(Uint8 r, Uint8 g, Uint8 b) { | |||
return *this; | |||
} | |||
|
|||
Surface& Surface::SetColorAndAlphaMod(const Color color) { |
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.
const
SDL2pp/Texture.hh
Outdated
/// | ||
/// \throws SDL2pp::Exception | ||
/// | ||
/// \see http://wiki.libsdl.org/SDL_GetTextureColorMod |
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.
Could reference SDL_GetTextureAlphaMod here too
SDL2pp/Texture.hh
Outdated
/// | ||
/// \throws SDL2pp::Exception | ||
/// | ||
/// \see http://wiki.libsdl.org/SDL_SetTextureColorMod |
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.
Could reference SDL_SetTextureAlphaMod here too
SDL2pp/Surface.hh
Outdated
/// | ||
/// \throws SDL2pp::Exception | ||
/// | ||
/// \see http://wiki.libsdl.org/SDL_SetSurfaceColorMod |
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.
Could reference SDL_SetSurfaceAlphaMod here too
SDL2pp/Surface.hh
Outdated
/// | ||
/// \throws SDL2pp::Exception | ||
/// | ||
/// \see http://wiki.libsdl.org/SDL_GetSurfaceColorMod |
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.
Could reference SDL_GetSurfaceAlphaMod here too
SDL2pp/Renderer.hh
Outdated
/// \see http://wiki.libsdl.org/SDL_SetRenderDrawColor | ||
/// | ||
//////////////////////////////////////////////////////////// | ||
Renderer& SetDrawColor(const Color color); |
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.
const
As for the tests, I don't get them very well how they work. I guess they are not unit tests but rather like integration tests, right? Have you seen Catch? Is an awesome very simple and elegant testing framework for C++ |
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.
Also please rebase + push --force this to avoid unrelated changes in the history.
SDL2pp/Color.cc
Outdated
@@ -1,6 +1,6 @@ | |||
/* | |||
libSDL2pp - C++11 bindings/wrapper for SDL2 | |||
Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru> |
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.
Please set correct date as well.
SDL2pp/Renderer.cc
Outdated
@@ -197,7 +197,7 @@ Renderer& Renderer::SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) { | |||
return *this; | |||
} | |||
|
|||
Renderer& Renderer::SetDrawColor(const Color color) { |
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.
Sorry, I've misguided you. It should better be const Color&
. Before, I did benchmarks for Rect
vs. const Rect&
arguments, and the latter was better. We should do the same way here.
There are both.
No, but I've heard of it. From what I've heard, I'm using the very similar homegrown framework (grep |
a3a78d2
to
510b679
Compare
510b679
to
02510d4
Compare
There, sorry for the mess, this should be good to go |
Looks good now apart from the Doxyfile.in changes. Since these were merged in separate PR they should go awat if you just rebase onto master. |
02510d4
to
49251c3
Compare
👍👍👍 |
Hey, this is my first contribution to a project ever.
I saw you have issue #55 open and I realized it was something I could do, please let me know if I missed something, I tried to follow the style from Point and Rect classes.