2019-07-26 11:57:28 -07:00
|
|
|
/* Copyright (C) 2019 Wildfire Games.
|
2009-04-18 10:00:33 -07:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
|
|
#include "CTooltip.h"
|
2019-09-20 06:11:18 -07:00
|
|
|
|
|
|
|
|
#include "gui/CGUI.h"
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
#include "gui/CGUIString.h"
|
2019-09-22 16:28:25 -07:00
|
|
|
#include "gui/CGUIText.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
2019-08-21 03:12:33 -07:00
|
|
|
CTooltip::CTooltip(CGUI& pGUI)
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
: IGUIObject(pGUI),
|
|
|
|
|
IGUITextOwner(pGUI),
|
|
|
|
|
m_BufferZone(),
|
|
|
|
|
m_Caption(),
|
|
|
|
|
m_Font(),
|
|
|
|
|
m_Sprite(),
|
|
|
|
|
m_Delay(),
|
|
|
|
|
m_TextColor(),
|
|
|
|
|
m_MaxWidth(),
|
|
|
|
|
m_Offset(),
|
|
|
|
|
m_Anchor(),
|
|
|
|
|
m_TextAlign(),
|
|
|
|
|
m_Independent(),
|
|
|
|
|
m_MousePos(),
|
|
|
|
|
m_UseObject(),
|
|
|
|
|
m_HideObject()
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
// If the tooltip is an object by itself:
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
RegisterSetting("buffer_zone", m_BufferZone);
|
|
|
|
|
RegisterSetting("caption", m_Caption);
|
|
|
|
|
RegisterSetting("font", m_Font);
|
|
|
|
|
RegisterSetting("sprite", m_Sprite);
|
|
|
|
|
RegisterSetting("delay", m_Delay); // in milliseconds
|
|
|
|
|
RegisterSetting("textcolor", m_TextColor);
|
|
|
|
|
RegisterSetting("maxwidth", m_MaxWidth);
|
|
|
|
|
RegisterSetting("offset", m_Offset);
|
|
|
|
|
RegisterSetting("anchor", m_Anchor);
|
|
|
|
|
RegisterSetting("text_align", m_TextAlign);
|
2012-03-08 12:42:28 -08:00
|
|
|
// This is used for tooltips that are hidden/revealed manually by scripts, rather than through the standard tooltip display mechanism
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
RegisterSetting("independent", m_Independent);
|
2006-04-23 16:14:18 -07:00
|
|
|
// Private settings:
|
2019-07-29 04:56:11 -07:00
|
|
|
// This is set by GUITooltip
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
RegisterSetting("_mousepos", m_MousePos);
|
|
|
|
|
// If the tooltip is just a reference to another object:
|
|
|
|
|
RegisterSetting("use_object", m_UseObject);
|
|
|
|
|
RegisterSetting("hide_object", m_HideObject);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
// Defaults
|
Move static GUI<>::SetSetting operating on IGUIObject to a member IGUIObject::SetSetting.
Remove PSERROR codes from SetSetting (let std::map throw an out_of_range
if a caller wants to Set a setting that doesn't exist without having
checked with SettingExists, equal to GetSetting from 92b6cdfeab).
That also simplifies std::function SetSettingWrap construct from
0a7d0ecdde to void IGUIObject::SettingChanged.
Don't trigger debug_warn or exceptions in GUITooltip::ShowTooltip if the
XML author specified wrong tooltip input, and dodge another
dynamic_cast.
Rename existing IGUIObject::SetSetting to
IGUIObject::SetSettingFromString and comment that it is purposed for
parsing XML files.
Remove SetSetting default value, so that authors are made aware
explicitly of the need to decide the function broadcasting a message,
refs d87057b1c0, 719f2d7967, ...
Change const bool& SkipMessage to const bool SendMessage, so that a
positive value relates to a positive action.
Clean AddSettings whitespace and integer types.
Differential Revision: https://code.wildfiregames.com/D2231
Tested on: gcc 9.1.0, clang 8.0.1, Jenkins
Comments By: Philip on IRC on 2010-07-24 on GUIUtil being ugly, in case
that one counts
This was SVN commit r22796.
2019-08-28 04:21:11 -07:00
|
|
|
SetSetting<i32>("delay", 500, true);
|
|
|
|
|
SetSetting<EVAlign>("anchor", EVAlign_Bottom, true);
|
|
|
|
|
SetSetting<EAlign>("text_align", EAlign_Left, true);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
// Set up a blank piece of text, to be replaced with a more
|
|
|
|
|
// interesting message later
|
Move CGUI::GenerateText to CGUIText constructor, CGUI::DrawText to CGUIText::Draw, SGenerateTextImage from CGUI to CGUIText.
Makes GUI text construction 30x faster for empty strings, otherwise less
than 1% faster.
Split the constructor into smaller helper functions to reduce nesting
and improve readability.
Change m_GeneratedTexts from pointer to reference, so that one doesn't
have to keep track to delete it correctly in several places, without
having to resort to copy or move assignments but constructing in place.
Mark CGUIText as NONCOPYABLE and MOVABLE which is already implicitly the
case due to the CGUISpriteInstance members, refs 0a7d0ecdde/D2133,
D2163/3028551b91.
Differential Revision: https://code.wildfiregames.com/D2168
Prepared by the GUIText.h file split in 838889ab12 / D2167.
Comments By: Vladislav
Tested on: gcc 9, clang 8, VS2015, Jenkins
Inlining tested using: clang -Rpass=inline and gcc -Winline
This was SVN commit r22679.
2019-08-16 18:32:11 -07:00
|
|
|
AddText();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CTooltip::~CTooltip()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CTooltip::SetupText()
|
|
|
|
|
{
|
2015-08-21 10:08:41 -07:00
|
|
|
ENSURE(m_GeneratedTexts.size() == 1);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
m_GeneratedTexts[0] = CGUIText(m_pGUI, m_Caption, m_Font, m_MaxWidth, m_BufferZone, this);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
// Position the tooltip relative to the mouse:
|
|
|
|
|
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
const CPos& mousepos = m_Independent ? m_pGUI.GetMousePos() : m_MousePos;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
Move CGUI::GenerateText to CGUIText constructor, CGUI::DrawText to CGUIText::Draw, SGenerateTextImage from CGUI to CGUIText.
Makes GUI text construction 30x faster for empty strings, otherwise less
than 1% faster.
Split the constructor into smaller helper functions to reduce nesting
and improve readability.
Change m_GeneratedTexts from pointer to reference, so that one doesn't
have to keep track to delete it correctly in several places, without
having to resort to copy or move assignments but constructing in place.
Mark CGUIText as NONCOPYABLE and MOVABLE which is already implicitly the
case due to the CGUISpriteInstance members, refs 0a7d0ecdde/D2133,
D2163/3028551b91.
Differential Revision: https://code.wildfiregames.com/D2168
Prepared by the GUIText.h file split in 838889ab12 / D2167.
Comments By: Vladislav
Tested on: gcc 9, clang 8, VS2015, Jenkins
Inlining tested using: clang -Rpass=inline and gcc -Winline
This was SVN commit r22679.
2019-08-16 18:32:11 -07:00
|
|
|
float textwidth = m_GeneratedTexts[0].GetSize().cx;
|
|
|
|
|
float textheight = m_GeneratedTexts[0].GetSize().cy;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
CClientArea size;
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
size.pixel.left = mousepos.x + m_Offset.x;
|
2006-04-23 16:14:18 -07:00
|
|
|
size.pixel.right = size.pixel.left + textwidth;
|
2019-08-23 07:43:10 -07:00
|
|
|
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
switch (m_Anchor)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
case EVAlign_Top:
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
size.pixel.top = mousepos.y + m_Offset.y;
|
2006-04-23 16:14:18 -07:00
|
|
|
size.pixel.bottom = size.pixel.top + textheight;
|
|
|
|
|
break;
|
|
|
|
|
case EVAlign_Bottom:
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
size.pixel.bottom = mousepos.y + m_Offset.y;
|
2006-04-23 16:14:18 -07:00
|
|
|
size.pixel.top = size.pixel.bottom - textheight;
|
|
|
|
|
break;
|
|
|
|
|
case EVAlign_Center:
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
size.pixel.top = mousepos.y + m_Offset.y - textheight/2.f;
|
2006-04-23 16:14:18 -07:00
|
|
|
size.pixel.bottom = size.pixel.top + textwidth;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2009-11-03 13:46:35 -08:00
|
|
|
debug_warn(L"Invalid EVAlign!");
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reposition the tooltip if it's falling off the screen:
|
|
|
|
|
|
|
|
|
|
extern int g_xres, g_yres;
|
2017-07-29 11:30:59 -07:00
|
|
|
extern float g_GuiScale;
|
|
|
|
|
float screenw = g_xres / g_GuiScale;
|
|
|
|
|
float screenh = g_yres / g_GuiScale;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
if (size.pixel.top < 0.f)
|
|
|
|
|
size.pixel.bottom -= size.pixel.top, size.pixel.top = 0.f;
|
|
|
|
|
else if (size.pixel.bottom > screenh)
|
|
|
|
|
size.pixel.top -= (size.pixel.bottom-screenh), size.pixel.bottom = screenh;
|
2011-02-13 04:16:31 -08:00
|
|
|
|
|
|
|
|
if (size.pixel.left < 0.f)
|
2006-04-23 16:14:18 -07:00
|
|
|
size.pixel.right -= size.pixel.left, size.pixel.left = 0.f;
|
|
|
|
|
else if (size.pixel.right > screenw)
|
|
|
|
|
size.pixel.left -= (size.pixel.right-screenw), size.pixel.right = screenw;
|
2014-02-19 13:59:07 -08:00
|
|
|
|
Move static GUI<>::SetSetting operating on IGUIObject to a member IGUIObject::SetSetting.
Remove PSERROR codes from SetSetting (let std::map throw an out_of_range
if a caller wants to Set a setting that doesn't exist without having
checked with SettingExists, equal to GetSetting from 92b6cdfeab).
That also simplifies std::function SetSettingWrap construct from
0a7d0ecdde to void IGUIObject::SettingChanged.
Don't trigger debug_warn or exceptions in GUITooltip::ShowTooltip if the
XML author specified wrong tooltip input, and dodge another
dynamic_cast.
Rename existing IGUIObject::SetSetting to
IGUIObject::SetSettingFromString and comment that it is purposed for
parsing XML files.
Remove SetSetting default value, so that authors are made aware
explicitly of the need to decide the function broadcasting a message,
refs d87057b1c0, 719f2d7967, ...
Change const bool& SkipMessage to const bool SendMessage, so that a
positive value relates to a positive action.
Clean AddSettings whitespace and integer types.
Differential Revision: https://code.wildfiregames.com/D2231
Tested on: gcc 9.1.0, clang 8.0.1, Jenkins
Comments By: Philip on IRC on 2010-07-24 on GUIUtil being ugly, in case
that one counts
This was SVN commit r22796.
2019-08-28 04:21:11 -07:00
|
|
|
SetSetting<CClientArea>("size", size, true);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
void CTooltip::HandleMessage(SGUIMessage& Message)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2010-04-19 12:43:05 -07:00
|
|
|
IGUITextOwner::HandleMessage(Message);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
void CTooltip::Draw()
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
float z = 900.f; // TODO: Find a nicer way of putting the tooltip on top of everything else
|
|
|
|
|
|
2015-08-21 10:08:41 -07:00
|
|
|
// Normally IGUITextOwner will handle this updating but since SetupText can modify the position
|
|
|
|
|
// we need to call it now *before* we do the rest of the drawing
|
|
|
|
|
if (!m_GeneratedTextsValid)
|
|
|
|
|
{
|
|
|
|
|
SetupText();
|
|
|
|
|
m_GeneratedTextsValid = true;
|
|
|
|
|
}
|
2010-04-19 12:43:05 -07:00
|
|
|
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
m_pGUI.DrawSprite(m_Sprite, 0, z, m_CachedActualSize);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
Change GUI Object Setting values to be members of the IGUIObject inheriting class, rename AddSetting to RegisterSetting.
Improves performance for Draw calls by 3-5% according to a shady
benchmark.
Improves memory layout, since the values are not on the heap anymore but
in the using class.
Reduces complexity of the implementation and increases type safety.
Allows specifying default values at setting value construction time,
refs D2242.
Inspired by Vladislav introducing members that cached GetSetting values
in c016a74309/D325, refs #4039, ee38f0db37/D763, refs 4225,
a1c4c23ce4/D474, D406, which were formerly proposed to be removed in
D2241.
Differential Revision: https://code.wildfiregames.com/D2313
Tested on: clang 8.0.1, gcc 9.1.0, Jenkins vs2015
Comments By: Vladislav
This was SVN commit r23005.
2019-09-27 05:49:59 -07:00
|
|
|
DrawText(0, m_TextColor, m_CachedActualSize.TopLeft(), z + 0.1f);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|