mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
change hsb to doubles internally
This commit is contained in:
parent
5ca1c37fe9
commit
029a495de1
6 changed files with 73 additions and 51 deletions
|
|
@ -234,7 +234,7 @@ void GuiColorPickerCtrl::renderAlphaGradient(RectI& bounds)
|
|||
ColorI currentColor;
|
||||
currentColor.set(ColorI::Hsb(mSelectedHue, 100, 100));
|
||||
|
||||
ColorI alphaCol = currentColor;
|
||||
ColorI alphaCol = ColorI::BLACK;
|
||||
alphaCol.alpha = 0;
|
||||
|
||||
// Begin primitive building, 4 vertices per rectangle
|
||||
|
|
@ -448,8 +448,8 @@ void GuiColorPickerCtrl::onMouseDown(const GuiEvent &event)
|
|||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
F32 relY = 1.0f - F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedSaturation(static_cast<U32>(relX * 100.0f));
|
||||
setSelectedBrightness(static_cast<U32>(relY * 100.0f));
|
||||
setSelectedSaturation(relX * 100.0);
|
||||
setSelectedBrightness(relY * 100.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::pHueRange:
|
||||
|
|
@ -459,13 +459,13 @@ void GuiColorPickerCtrl::onMouseDown(const GuiEvent &event)
|
|||
case GuiColorPickerCtrl::sHorizontal:
|
||||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
setSelectedHue(static_cast<U32>(relX * 360.0f));
|
||||
setSelectedHue(relX * 360.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::sVertical:
|
||||
{
|
||||
F32 relY = F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedHue(static_cast<U32>(relY * 360.0f));
|
||||
setSelectedHue(relY * 360.0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -480,13 +480,13 @@ void GuiColorPickerCtrl::onMouseDown(const GuiEvent &event)
|
|||
case GuiColorPickerCtrl::sHorizontal:
|
||||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
setSelectedAlpha(static_cast<U32>(relX * 255.0f));
|
||||
setSelectedAlpha(relX * 255.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::sVertical:
|
||||
{
|
||||
F32 relY = F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedAlpha(static_cast<U32>(relY * 255.0f));
|
||||
setSelectedAlpha(relY * 255.0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -518,8 +518,8 @@ void GuiColorPickerCtrl::onMouseDragged(const GuiEvent &event)
|
|||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
F32 relY = 1.0f - F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedSaturation(static_cast<U32>(relX * 100.0f));
|
||||
setSelectedBrightness(static_cast<U32>(relY * 100.0f));
|
||||
setSelectedSaturation(relX * 100.0);
|
||||
setSelectedBrightness(relY * 100.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::pHueRange:
|
||||
|
|
@ -529,13 +529,13 @@ void GuiColorPickerCtrl::onMouseDragged(const GuiEvent &event)
|
|||
case GuiColorPickerCtrl::sHorizontal:
|
||||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
setSelectedHue(static_cast<U32>(relX * 360.0f));
|
||||
setSelectedHue(relX * 360.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::sVertical:
|
||||
{
|
||||
F32 relY = F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedHue(static_cast<U32>(relY * 360.0f));
|
||||
setSelectedHue(relY * 360.0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -550,13 +550,13 @@ void GuiColorPickerCtrl::onMouseDragged(const GuiEvent &event)
|
|||
case GuiColorPickerCtrl::sHorizontal:
|
||||
{
|
||||
F32 relX = F32(mousePoint.x) / F32(ext.x);
|
||||
setSelectedAlpha(static_cast<U32>(relX * 255.0f));
|
||||
setSelectedAlpha(relX * 255.0);
|
||||
break;
|
||||
}
|
||||
case GuiColorPickerCtrl::sVertical:
|
||||
{
|
||||
F32 relY = F32(mousePoint.y) / F32(ext.y);
|
||||
setSelectedAlpha(static_cast<U32>(relY * 255.0f));
|
||||
setSelectedAlpha(relY * 255.0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -587,7 +587,7 @@ void GuiColorPickerCtrl::onMouseLeave(const GuiEvent &)
|
|||
mMouseOver = false;
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setSelectedHue(const U32& hueValue)
|
||||
void GuiColorPickerCtrl::setSelectedHue(const F64& hueValue)
|
||||
{
|
||||
if (hueValue < 0)
|
||||
{
|
||||
|
|
@ -605,7 +605,7 @@ void GuiColorPickerCtrl::setSelectedHue(const U32& hueValue)
|
|||
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setSelectedBrightness(const U32& brightValue)
|
||||
void GuiColorPickerCtrl::setSelectedBrightness(const F64& brightValue)
|
||||
{
|
||||
if (brightValue < 0)
|
||||
{
|
||||
|
|
@ -622,7 +622,7 @@ void GuiColorPickerCtrl::setSelectedBrightness(const U32& brightValue)
|
|||
mSelectedBrightness = brightValue;
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setSelectedSaturation(const U32& satValue)
|
||||
void GuiColorPickerCtrl::setSelectedSaturation(const F64& satValue)
|
||||
{
|
||||
if (satValue < 0)
|
||||
{
|
||||
|
|
@ -639,7 +639,7 @@ void GuiColorPickerCtrl::setSelectedSaturation(const U32& satValue)
|
|||
mSelectedSaturation = satValue;
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setSelectedAlpha(const U32& alphaValue)
|
||||
void GuiColorPickerCtrl::setSelectedAlpha(const F64& alphaValue)
|
||||
{
|
||||
if (alphaValue < 0)
|
||||
{
|
||||
|
|
@ -673,42 +673,42 @@ DefineEngineMethod(GuiColorPickerCtrl, executeUpdate, void, (), , "Execute the o
|
|||
object->onAction();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedHue, void, (U32 hueValue), , "Sets the selected hue value should be 0-360.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedHue, void, (F64 hueValue), , "Sets the selected hue value should be 0-360.")
|
||||
{
|
||||
object->setSelectedHue(hueValue);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedHue, S32, (), , "Gets the current selected hue value.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedHue, F64, (), , "Gets the current selected hue value.")
|
||||
{
|
||||
return object->getSelectedHue();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedBrightness, void, (U32 brightness), , "Sets the selected brightness value should be 0-100.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedBrightness, void, (F64 brightness), , "Sets the selected brightness value should be 0-100.")
|
||||
{
|
||||
object->setSelectedBrightness(brightness);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedBrightness, S32, (), , "Gets the current selected brightness.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedBrightness, F64, (), , "Gets the current selected brightness.")
|
||||
{
|
||||
return object->getSelectedBrightness();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedSaturation, void, (U32 saturation), , "Sets the selected saturation value should be 0-100.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedSaturation, void, (F64 saturation), , "Sets the selected saturation value should be 0-100.")
|
||||
{
|
||||
object->setSelectedSaturation(saturation);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedSaturation, S32, (), , "Gets the current selected saturation value.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedSaturation, F64, (), , "Gets the current selected saturation value.")
|
||||
{
|
||||
return object->getSelectedSaturation();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedAlpha, void, (U32 alpha), , "Sets the selected alpha value should be 0-255.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectedAlpha, void, (F64 alpha), , "Sets the selected alpha value should be 0-255.")
|
||||
{
|
||||
object->setSelectedAlpha(alpha);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedAlpha, S32, (), , "Gets the current selected alpha value.")
|
||||
DefineEngineMethod(GuiColorPickerCtrl, getSelectedAlpha, F64, (), , "Gets the current selected alpha value.")
|
||||
{
|
||||
return object->getSelectedAlpha();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
/// @{
|
||||
PickMode mDisplayMode; ///< Current color display mode of the selector
|
||||
SelectorMode mSelectorMode; ///< Current color display mode of the selector
|
||||
U32 mSelectedHue;
|
||||
U32 mSelectedSaturation;
|
||||
U32 mSelectedBrightness;
|
||||
U32 mSelectedAlpha;
|
||||
F64 mSelectedHue;
|
||||
F64 mSelectedSaturation;
|
||||
F64 mSelectedBrightness;
|
||||
F64 mSelectedAlpha;
|
||||
|
||||
bool mMouseOver; ///< Mouse is over?
|
||||
bool mMouseDown; ///< Mouse button down?
|
||||
|
|
@ -158,29 +158,29 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
/// Set the selected hue.
|
||||
/// </summary>
|
||||
/// <param name="hueValue">Hue value, 0 - 360.</param>
|
||||
void setSelectedHue(const U32& hueValue);
|
||||
U32 getSelectedHue() { return mSelectedHue; }
|
||||
void setSelectedHue(const F64& hueValue);
|
||||
F64 getSelectedHue() { return mSelectedHue; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the selected brightness.
|
||||
/// </summary>
|
||||
/// <param name="brightValue">Brightness value, 0 - 100.</param>
|
||||
void setSelectedBrightness(const U32& brightValue);
|
||||
U32 getSelectedBrightness() { return mSelectedBrightness; }
|
||||
void setSelectedBrightness(const F64& brightValue);
|
||||
F64 getSelectedBrightness() { return mSelectedBrightness; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the selected saturation.
|
||||
/// </summary>
|
||||
/// <param name="satValue">Saturation value, 0 - 100.</param>
|
||||
void setSelectedSaturation(const U32& satValue);
|
||||
U32 getSelectedSaturation() { return mSelectedSaturation; }
|
||||
void setSelectedSaturation(const F64& satValue);
|
||||
F64 getSelectedSaturation() { return mSelectedSaturation; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the selected alpha.
|
||||
/// </summary>
|
||||
/// <param name="alphaValue">Alpha value, 0 - 255.</param>
|
||||
void setSelectedAlpha(const U32& alphaValue);
|
||||
U32 getSelectedAlpha() { return mSelectedAlpha; }
|
||||
void setSelectedAlpha(const F64& alphaValue);
|
||||
F64 getSelectedAlpha() { return mSelectedAlpha; }
|
||||
};
|
||||
|
||||
typedef GuiColorPickerCtrl::PickMode GuiColorPickMode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue