@@ -44,7 +44,6 @@ constexpr const char* texFragmentSource =
44
44
45
45
namespace my
46
46
{
47
- const float AbstractShape::pi = 3 .1415926535f ;
48
47
ShaderProgram AbstractShape::shader;
49
48
ShaderProgram AbstractShape::texShader;
50
49
const ShaderProgram& AbstractShape::defaultShader = AbstractShape::shader;
@@ -70,8 +69,9 @@ namespace my
70
69
}
71
70
72
71
AbstractShape::AbstractShape (int width, int height) :
73
- m_position (0 .0f , 0 .0f ), m_originalScale(width / 2 .0f , height / 2 .0f ), m_scaleFactor(1 .0f , 1 .0f ), m_rotationAngle(0 .0f ), m_updateMatrix(true ),
74
- m_model (1 .0f ), m_color(100 , 100 , 100 ), m_outlineThickness(0 .0f ), m_outlineColor(255 , 255 , 255 ), m_outlineModel(1 .0f ), m_isTextured(false ) {
72
+ m_position (0 .0f , 0 .0f ), m_originalScale(static_cast <float >(width) / 2 .0f , static_cast <float >(height) / 2 .0f ), m_scaleFactor(1 .0f , 1 .0f ),
73
+ m_rotationAngle (0 .0f ), m_updateMatrix(true ), m_model(1 .0f ), m_color(100 , 100 , 100 ), m_outlineThickness(0 .0f ), m_outlineColor(255 , 255 , 255 ),
74
+ m_outlineModel (1 .0f ), m_isTextured(false ) {
75
75
initShaders ();
76
76
m_shader = shader;
77
77
m_outlineShader = shader;
@@ -154,8 +154,8 @@ namespace my
154
154
return m_rotationAngle;
155
155
}
156
156
157
- void AbstractShape::setColor (int r, int g, int b, int alpha) noexcept {
158
- m_color = my::Color (glm::clamp ( r, 0 , 255 ), glm::clamp ( g, 0 , 255 ), glm::clamp ( b, 0 , 255 ), glm::clamp ( alpha, 0 , 255 ) );
157
+ void AbstractShape::setColor (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) noexcept {
158
+ m_color = my::Color (r, g, b, alpha);
159
159
}
160
160
161
161
void AbstractShape::setColor (const my::Color& color) noexcept {
@@ -180,8 +180,8 @@ namespace my
180
180
m_outlineColor = color;
181
181
}
182
182
183
- void AbstractShape::setOutlineColor (int r, int g, int b, int alpha) noexcept {
184
- m_outlineColor = my::Color (glm::clamp ( r, 0 , 255 ), glm::clamp ( g, 0 , 255 ), glm::clamp ( b, 0 , 255 ), glm::clamp ( alpha, 0 , 255 ) );
183
+ void AbstractShape::setOutlineColor (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) noexcept {
184
+ m_outlineColor = my::Color (r, g, b, alpha);
185
185
}
186
186
187
187
bool AbstractShape::SATCollides (const AbstractShape& shape) const {
0 commit comments