From ca2fe9cf4594b949d07e5b460d391de351bf2a75 Mon Sep 17 00:00:00 2001 From: conde2 Date: Sat, 30 Nov 2013 23:08:43 -0200 Subject: [PATCH 1/7] Fix compilation under MSVC Use template for std::min and std::max --- src/client/creature.cpp | 8 ++++---- src/framework/graphics/texture.cpp | 2 +- src/framework/ui/uihorizontallayout.cpp | 4 ++-- src/framework/ui/uilayout.h | 2 +- src/framework/ui/uitextedit.cpp | 12 ++++++------ src/framework/ui/uiverticallayout.cpp | 4 ++-- src/framework/ui/uiwidget.cpp | 2 +- src/framework/ui/uiwidget.h | 2 +- src/framework/util/rect.h | 16 ++++++++-------- src/framework/util/size.h | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/client/creature.cpp b/src/client/creature.cpp index 6a015452..3bfc45b4 100644 --- a/src/client/creature.cpp +++ b/src/client/creature.cpp @@ -128,7 +128,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal dest -= datType->getDisplacement() * scaleFactor; datType->draw(dest, scaleFactor, 0, xPattern, 0, 0, animationPhase, lightView); dest += getDisplacement() * scaleFactor; - zPattern = std::min(1, getNumPatternZ() - 1); + zPattern = std::min(1, getNumPatternZ() - 1); } PointF jumpOffset = m_jumpOffset * scaleFactor; @@ -183,7 +183,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal } if(m_outfit.getCategory() == ThingCategoryEffect) - animationPhase = std::min(animationPhase+1, animationPhases); + animationPhase = std::min(animationPhase+1, animationPhases); type->draw(dest - (getDisplacement() * scaleFactor), scaleFactor, 0, 0, 0, 0, animationPhase, lightView); } @@ -480,7 +480,7 @@ void Creature::updateWalkAnimation(int totalPixelsWalked) if(!self->m_walking || self->m_walkTimer.ticksElapsed() >= self->getStepDuration(true)) self->m_walkAnimationPhase = 0; self->m_walkFinishAnimEvent = nullptr; - }, std::min(footDelay, 200)); + }, std::min(footDelay, 200)); } } @@ -553,7 +553,7 @@ void Creature::nextWalkUpdate() void Creature::updateWalk() { float walkTicksPerPixel = getStepDuration(true) / 32; - int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f); + int totalPixelsWalked = std::min(m_walkTimer.ticksElapsed() / walkTicksPerPixel, 32.0f); // needed for paralyze effect m_walkedPixels = std::max(m_walkedPixels, totalPixelsWalked); diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index d4721a89..59923094 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -170,7 +170,7 @@ bool Texture::setupSize(const Size& size, bool forcePowerOfTwo) glSize = size; // checks texture max size - if(std::max(glSize.width(), glSize.height()) > g_graphics.getMaxTextureSize()) { + if(std::max(glSize.width(), glSize.height()) > g_graphics.getMaxTextureSize()) { g_logger.error(stdext::format("loading texture with size %dx%d failed, " "the maximum size allowed by the graphics card is %dx%d," "to prevent crashes the texture will be displayed as a blank texture", diff --git a/src/framework/ui/uihorizontallayout.cpp b/src/framework/ui/uihorizontallayout.cpp index 197f20f3..e8596066 100644 --- a/src/framework/ui/uihorizontallayout.cpp +++ b/src/framework/ui/uihorizontallayout.cpp @@ -66,10 +66,10 @@ bool UIHorizontalLayout::internalUpdate() pos.y = paddingRect.top() + widget->getMarginTop(); } else if(widget->getTextAlign() & Fw::AlignBottom) { pos.y = paddingRect.bottom() - widget->getHeight() - widget->getMarginBottom(); - pos.y = std::max(pos.y, paddingRect.top()); + pos.y = std::max(pos.y, paddingRect.top()); } else { // center it pos.y = paddingRect.top() + (paddingRect.height() - (widget->getMarginTop() + widget->getHeight() + widget->getMarginBottom()))/2; - pos.y = std::max(pos.y, paddingRect.top()); + pos.y = std::max(pos.y, paddingRect.top()); } } else { // expand height diff --git a/src/framework/ui/uilayout.h b/src/framework/ui/uilayout.h index 2ff95cd6..3aa48722 100644 --- a/src/framework/ui/uilayout.h +++ b/src/framework/ui/uilayout.h @@ -40,7 +40,7 @@ public: virtual void addWidget(const UIWidgetPtr& widget) { } virtual void removeWidget(const UIWidgetPtr& widget) { } void disableUpdates() { m_updateDisabled++; } - void enableUpdates() { m_updateDisabled = std::max(m_updateDisabled-1,0); } + void enableUpdates() { m_updateDisabled = std::max(m_updateDisabled-1,0); } void setParent(UIWidgetPtr parentWidget) { m_parentWidget = parentWidget; } UIWidgetPtr getParentWidget() { return m_parentWidget; } diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index f2c8f588..2f3f1ebb 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -181,15 +181,15 @@ void UITextEdit::update(bool focusCursor) if(!virtualRect.contains(glyphRect.topLeft()) || !virtualRect.contains(glyphRect.bottomRight())) { // calculate where is the first glyph visible Point startGlyphPos; - startGlyphPos.y = std::max(glyphRect.bottom() - virtualRect.height(), 0); - startGlyphPos.x = std::max(glyphRect.right() - virtualRect.width(), 0); + startGlyphPos.y = std::max(glyphRect.bottom() - virtualRect.height(), 0); + startGlyphPos.x = std::max(glyphRect.right() - virtualRect.width(), 0); // find that glyph for(pos = 0; pos < textLength; ++pos) { glyph = (uchar)text[pos]; glyphRect = Rect(glyphsPositions[pos], glyphsSize[glyph]); - glyphRect.setTop(std::max(glyphRect.top() - m_font->getYOffset() - m_font->getGlyphSpacing().height(), 0)); - glyphRect.setLeft(std::max(glyphRect.left() - m_font->getGlyphSpacing().width(), 0)); + glyphRect.setTop(std::max(glyphRect.top() - m_font->getYOffset() - m_font->getGlyphSpacing().height(), 0)); + glyphRect.setLeft(std::max(glyphRect.left() - m_font->getGlyphSpacing().width(), 0)); // first glyph entirely visible found if(glyphRect.topLeft() >= startGlyphPos) { @@ -358,8 +358,8 @@ void UITextEdit::setSelection(int start, int end) if(end == -1) end = m_text.length(); - m_selectionStart = std::min(std::max(start, 0), (int)m_text.length()); - m_selectionEnd = std::min(std::max(end, 0), (int)m_text.length()); + m_selectionStart = std::min(std::max(start, 0), (int)m_text.length()); + m_selectionEnd = std::min(std::max(end, 0), (int)m_text.length()); } void UITextEdit::setTextHidden(bool hidden) diff --git a/src/framework/ui/uiverticallayout.cpp b/src/framework/ui/uiverticallayout.cpp index 4b9c1077..91fd8ef1 100644 --- a/src/framework/ui/uiverticallayout.cpp +++ b/src/framework/ui/uiverticallayout.cpp @@ -68,10 +68,10 @@ bool UIVerticalLayout::internalUpdate() pos.x = paddingRect.left() + widget->getMarginLeft(); } else if(widget->getTextAlign() & Fw::AlignLeft) { pos.x = paddingRect.bottom() - widget->getHeight() - widget->getMarginBottom(); - pos.x = std::max(pos.x, paddingRect.left()); + pos.x = std::max(pos.x, paddingRect.left()); } else { pos.x = paddingRect.left() + (paddingRect.width() - (widget->getMarginLeft() + widget->getWidth() + widget->getMarginRight()))/2; - pos.x = std::max(pos.x, paddingRect.left()); + pos.x = std::max(pos.x, paddingRect.left()); } } else { // expand width diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index f5571f59..94ce52df 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -192,7 +192,7 @@ void UIWidget::insertChild(int index, const UIWidgetPtr& child) if(!(index >= 0 && (uint)index <= m_children.size())) { //g_logger.traceWarning("attempt to insert a child UIWidget into an invalid index, using nearest index..."); - index = std::min(std::max(index, 0), (int)m_children.size()); + index = std::min(std::max(index, 0), (int)m_children.size()); } // retrieve child by index diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index a00eff0c..2cb495ef 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -346,7 +346,7 @@ public: void setPaddingRight(int padding) { m_padding.right = padding; updateLayout(); } void setPaddingBottom(int padding) { m_padding.bottom = padding; updateLayout(); } void setPaddingLeft(int padding) { m_padding.left = padding; updateLayout(); } - void setOpacity(float opacity) { m_opacity = std::min(std::max(opacity, 0.0f), 1.0f); } + void setOpacity(float opacity) { m_opacity = std::min(std::max(opacity, 0.0f), 1.0f); } void setRotation(float degrees) { m_rotation = degrees; } int getX() { return m_rect.x(); } diff --git a/src/framework/util/rect.h b/src/framework/util/rect.h index f052e9f4..ed93635d 100644 --- a/src/framework/util/rect.h +++ b/src/framework/util/rect.h @@ -221,10 +221,10 @@ public: TRect united(const TRect &r) const { TRect tmp; - tmp.x1 = std::min(x1, r.x1); - tmp.x2 = std::max(x2, r.x2); - tmp.y1 = std::min(y1, r.y1); - tmp.y2 = std::max(y2, r.y2); + tmp.x1 = std::min(x1, r.x1); + tmp.x2 = std::max(x2, r.x2); + tmp.y1 = std::min(y1, r.y1); + tmp.y2 = std::max(y2, r.y2); return tmp; } @@ -263,10 +263,10 @@ public: b2 = r.y2; TRect tmp; - tmp.x1 = std::max(l1, l2); - tmp.x2 = std::min(r1, r2); - tmp.y1 = std::max(t1, t2); - tmp.y2 = std::min(b1, b2); + tmp.x1 = std::max(l1, l2); + tmp.x2 = std::min(r1, r2); + tmp.y1 = std::max(t1, t2); + tmp.y2 = std::min(b1, b2); return tmp; } diff --git a/src/framework/util/size.h b/src/framework/util/size.h index 287ac73f..5298a7f3 100644 --- a/src/framework/util/size.h +++ b/src/framework/util/size.h @@ -70,8 +70,8 @@ public: bool operator==(const TSize& other) const { return other.wd==wd && other.ht==ht; } bool operator!=(const TSize& other) const { return other.wd!=wd || other.ht!=ht; } - TSize expandedTo(const TSize& other) const { return TSize(std::max(wd,other.wd), std::max(ht,other.ht)); } - TSize boundedTo(const TSize& other) const { return TSize(std::min(wd,other.wd), std::min(ht,other.ht)); } + TSize expandedTo(const TSize& other) const { return TSize(std::max(wd, other.wd), std::max(ht, other.ht)); } + TSize boundedTo(const TSize& other) const { return TSize(std::min(wd, other.wd), std::min(ht, other.ht)); } void scale(const TSize& s, Fw::AspectRatioMode mode) { if(mode == Fw::IgnoreAspectRatio || wd == 0 || ht == 0) { From 7ff73d1064fc86e236d4d0903a4980de42a73d9d Mon Sep 17 00:00:00 2001 From: conde2 Date: Sat, 30 Nov 2013 23:34:21 -0200 Subject: [PATCH 2/7] Fix indentation --- src/framework/util/rect.h | 6 +++--- src/framework/util/size.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/framework/util/rect.h b/src/framework/util/rect.h index ed93635d..e56e7c40 100644 --- a/src/framework/util/rect.h +++ b/src/framework/util/rect.h @@ -222,9 +222,9 @@ public: TRect united(const TRect &r) const { TRect tmp; tmp.x1 = std::min(x1, r.x1); - tmp.x2 = std::max(x2, r.x2); - tmp.y1 = std::min(y1, r.y1); - tmp.y2 = std::max(y2, r.y2); + tmp.x2 = std::max(x2, r.x2); + tmp.y1 = std::min(y1, r.y1); + tmp.y2 = std::max(y2, r.y2); return tmp; } diff --git a/src/framework/util/size.h b/src/framework/util/size.h index 5298a7f3..f2ffb822 100644 --- a/src/framework/util/size.h +++ b/src/framework/util/size.h @@ -70,8 +70,8 @@ public: bool operator==(const TSize& other) const { return other.wd==wd && other.ht==ht; } bool operator!=(const TSize& other) const { return other.wd!=wd || other.ht!=ht; } - TSize expandedTo(const TSize& other) const { return TSize(std::max(wd, other.wd), std::max(ht, other.ht)); } - TSize boundedTo(const TSize& other) const { return TSize(std::min(wd, other.wd), std::min(ht, other.ht)); } + TSize expandedTo(const TSize& other) const { return TSize(std::max(wd, other.wd), std::max(ht, other.ht)); } + TSize boundedTo(const TSize& other) const { return TSize(std::min(wd, other.wd), std::min(ht, other.ht)); } void scale(const TSize& s, Fw::AspectRatioMode mode) { if(mode == Fw::IgnoreAspectRatio || wd == 0 || ht == 0) { From 4dcb30110feac98ea9ebce769a61f56044cbd5da Mon Sep 17 00:00:00 2001 From: conde2 Date: Sun, 1 Dec 2013 00:48:36 -0200 Subject: [PATCH 3/7] Use of clamp --- src/client/lightview.cpp | 2 +- src/client/mapview.cpp | 4 ++-- src/client/uimap.cpp | 2 +- src/client/uiprogressrect.cpp | 2 +- src/framework/core/adaptativeframecounter.cpp | 2 +- src/framework/stdext/math.h | 3 +++ src/framework/ui/uitextedit.cpp | 4 ++-- src/framework/ui/uiwidget.cpp | 2 +- src/framework/ui/uiwidget.h | 2 +- 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/client/lightview.cpp b/src/client/lightview.cpp index b347e8c8..dccac0e3 100644 --- a/src/client/lightview.cpp +++ b/src/client/lightview.cpp @@ -50,7 +50,7 @@ TexturePtr LightView::generateLightBubble(float centerFactor) for(int x = 0; x < bubbleDiameter; x++) { for(int y = 0; y < bubbleDiameter; y++) { float radius = std::sqrt((bubbleRadius - x)*(bubbleRadius - x) + (bubbleRadius - y)*(bubbleRadius - y)); - float intensity = std::max(std::min((bubbleRadius-radius)/(float)(bubbleRadius-centerRadius), 1.0f), 0.0f); + float intensity = stdext::clamp((bubbleRadius - radius) / (float)(bubbleRadius - centerRadius), 0.0f, 1.0f); // light intensity varies inversely with the square of the distance intensity = intensity * intensity; diff --git a/src/client/mapview.cpp b/src/client/mapview.cpp index 36246a0b..39bc80a7 100644 --- a/src/client/mapview.cpp +++ b/src/client/mapview.cpp @@ -644,7 +644,7 @@ int MapView::calcFirstVisibleFloor() } // just ensure the that the floor is in the valid range - z = std::min(std::max(z, 0), (int)Otc::MAX_Z); + z = stdext::clamp(z, 0, (int)Otc::MAX_Z); return z; } @@ -669,7 +669,7 @@ int MapView::calcLastVisibleFloor() z = std::max(m_lockedFirstVisibleFloor, z); // just ensure the that the floor is in the valid range - z = std::min(std::max(z, 0), (int)Otc::MAX_Z); + z = stdext::clamp(z, 0, (int)Otc::MAX_Z); return z; } diff --git a/src/client/uimap.cpp b/src/client/uimap.cpp index a961e4af..e7086111 100644 --- a/src/client/uimap.cpp +++ b/src/client/uimap.cpp @@ -77,7 +77,7 @@ void UIMap::movePixels(int x, int y) bool UIMap::setZoom(int zoom) { - m_zoom = std::min(std::max(zoom, m_maxZoomIn), m_maxZoomOut); + m_zoom = stdext::clamp(zoom, m_maxZoomOut, m_maxZoomIn); updateVisibleDimension(); return false; } diff --git a/src/client/uiprogressrect.cpp b/src/client/uiprogressrect.cpp index 1187f1ca..f1abfd6c 100644 --- a/src/client/uiprogressrect.cpp +++ b/src/client/uiprogressrect.cpp @@ -84,7 +84,7 @@ void UIProgressRect::drawSelf(Fw::DrawPane drawPane) void UIProgressRect::setPercent(float percent) { - m_percent = std::max(std::min((double)percent, 100.0), 0.0); + m_percent = stdext::clamp((double)percent, 0.0, 100.0); } void UIProgressRect::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode) diff --git a/src/framework/core/adaptativeframecounter.cpp b/src/framework/core/adaptativeframecounter.cpp index ca1f40c6..bab8e09c 100644 --- a/src/framework/core/adaptativeframecounter.cpp +++ b/src/framework/core/adaptativeframecounter.cpp @@ -89,7 +89,7 @@ bool AdaptativeFrameCounter::update() void AdaptativeFrameCounter::setMaxFps(int maxFps) { - maxFps = std::max(std::min(maxFps, 1000), 0); + maxFps = stdext::clamp(maxFps, 0, 1000); if(maxFps != 0) { m_bestFrameDelay = 1000000 / maxFps; diff --git a/src/framework/stdext/math.h b/src/framework/stdext/math.h index 01c5f681..6de3a04f 100644 --- a/src/framework/stdext/math.h +++ b/src/framework/stdext/math.h @@ -45,6 +45,9 @@ float random_range(float min, float max); double round(double r); +template +T clamp(T x, T min, T max) { return std::max(min, std::min(x, max)); } + } #endif diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index 2f3f1ebb..999a4e5e 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -358,8 +358,8 @@ void UITextEdit::setSelection(int start, int end) if(end == -1) end = m_text.length(); - m_selectionStart = std::min(std::max(start, 0), (int)m_text.length()); - m_selectionEnd = std::min(std::max(end, 0), (int)m_text.length()); + m_selectionStart = stdext::clamp(start, 0, (int)m_text.length()); + m_selectionEnd = stdext::clamp(end, 0, (int)m_text.length()); } void UITextEdit::setTextHidden(bool hidden) diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 94ce52df..4a6b84b0 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -192,7 +192,7 @@ void UIWidget::insertChild(int index, const UIWidgetPtr& child) if(!(index >= 0 && (uint)index <= m_children.size())) { //g_logger.traceWarning("attempt to insert a child UIWidget into an invalid index, using nearest index..."); - index = std::min(std::max(index, 0), (int)m_children.size()); + index = stdext::clamp(index, 0, (int)m_children.size()); } // retrieve child by index diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index 2cb495ef..42e1e059 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -346,7 +346,7 @@ public: void setPaddingRight(int padding) { m_padding.right = padding; updateLayout(); } void setPaddingBottom(int padding) { m_padding.bottom = padding; updateLayout(); } void setPaddingLeft(int padding) { m_padding.left = padding; updateLayout(); } - void setOpacity(float opacity) { m_opacity = std::min(std::max(opacity, 0.0f), 1.0f); } + void setOpacity(float opacity) { m_opacity = stdext::clamp(opacity, 0.0f, 1.0f); } void setRotation(float degrees) { m_rotation = degrees; } int getX() { return m_rect.x(); } From d7612e9304d630fce4d4eb4f73165672214717b8 Mon Sep 17 00:00:00 2001 From: conde2 Date: Sun, 1 Dec 2013 01:12:06 -0200 Subject: [PATCH 4/7] Little mistake --- src/client/uimap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/uimap.cpp b/src/client/uimap.cpp index e7086111..b31e8ad2 100644 --- a/src/client/uimap.cpp +++ b/src/client/uimap.cpp @@ -77,7 +77,7 @@ void UIMap::movePixels(int x, int y) bool UIMap::setZoom(int zoom) { - m_zoom = stdext::clamp(zoom, m_maxZoomOut, m_maxZoomIn); + m_zoom = stdext::clamp(zoom, m_maxZoomIn, m_maxZoomOut); updateVisibleDimension(); return false; } From 8b0509a5c3dc6a1c37c7884fed3c1c22014903b7 Mon Sep 17 00:00:00 2001 From: conde2 Date: Sun, 1 Dec 2013 01:19:29 -0200 Subject: [PATCH 5/7] Try to fix compilation --- src/framework/stdext/stdext.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/framework/stdext/stdext.h b/src/framework/stdext/stdext.h index 3b27a51f..2e33cbcf 100644 --- a/src/framework/stdext/stdext.h +++ b/src/framework/stdext/stdext.h @@ -23,6 +23,7 @@ #ifndef STDEXT_H #define STDEXT_H +#include #include "compiler.h" #include "dumper.h" #include "types.h" From 3288711d167fdc3ec7fd7da4761d0219959ed53f Mon Sep 17 00:00:00 2001 From: conde2 Date: Sun, 1 Dec 2013 01:25:34 -0200 Subject: [PATCH 6/7] Mistake --- src/framework/stdext/math.h | 1 + src/framework/stdext/stdext.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/framework/stdext/math.h b/src/framework/stdext/math.h index 6de3a04f..f7c237d6 100644 --- a/src/framework/stdext/math.h +++ b/src/framework/stdext/math.h @@ -23,6 +23,7 @@ #ifndef STDEXT_MATH_H #define STDEXT_MATH_H +#include #include "types.h" namespace stdext { diff --git a/src/framework/stdext/stdext.h b/src/framework/stdext/stdext.h index 2e33cbcf..3b27a51f 100644 --- a/src/framework/stdext/stdext.h +++ b/src/framework/stdext/stdext.h @@ -23,7 +23,6 @@ #ifndef STDEXT_H #define STDEXT_H -#include #include "compiler.h" #include "dumper.h" #include "types.h" From ba091c9f5b1eac6aa5bc54ca3a42e1564ad3bba5 Mon Sep 17 00:00:00 2001 From: conde2 Date: Sun, 1 Dec 2013 01:30:48 -0200 Subject: [PATCH 7/7] Indentation --- src/framework/ui/uiwidget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index 42e1e059..259cf68b 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -346,7 +346,7 @@ public: void setPaddingRight(int padding) { m_padding.right = padding; updateLayout(); } void setPaddingBottom(int padding) { m_padding.bottom = padding; updateLayout(); } void setPaddingLeft(int padding) { m_padding.left = padding; updateLayout(); } - void setOpacity(float opacity) { m_opacity = stdext::clamp(opacity, 0.0f, 1.0f); } + void setOpacity(float opacity) { m_opacity = stdext::clamp(opacity, 0.0f, 1.0f); } void setRotation(float degrees) { m_rotation = degrees; } int getX() { return m_rect.x(); }