Removes unused and limited cell sprite functionality.

Tested By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3749
This was SVN commit r25140.
This commit is contained in:
Vladislav Belov 2021-03-27 11:38:34 +00:00
parent f884848745
commit 734b672569
31 changed files with 63 additions and 155 deletions

View File

@ -62,7 +62,6 @@ ex_settings =
attribute format_y { text }?&
attribute fov_wedge_color { ccolor }?&
attribute hotkey { text }?&
attribute cell_id { xsd:integer }?&
attribute independent { bool }?&
attribute input_initvalue_destroyed_at_focus { bool }?&
attribute mask { bool }?&
@ -233,7 +232,6 @@ icon =
attribute name { text }&
attribute size { size }&
attribute sprite { text }&
attribute cell_id { text }?
}
tooltip =
element tooltip {
@ -274,7 +272,6 @@ image =
attribute size { clientarea }?&
attribute texture_size { clientarea }?&
attribute real_texture_placement { rect }?&
attribute cell_size { size }?&
attribute backcolor { ccolor }?&
attribute bordercolor { ccolor }?&
attribute border { bool }?&

View File

@ -253,11 +253,6 @@
<optional>
<attribute name="hotkey"/>
</optional>
<optional>
<attribute name="cell_id">
<data type="integer"/>
</attribute>
</optional>
<optional>
<attribute name="independent">
<ref name="bool"/>
@ -721,9 +716,6 @@
<ref name="size"/>
</attribute>
<attribute name="sprite"/>
<optional>
<attribute name="cell_id"/>
</optional>
</interleave>
</element>
</define>
@ -831,11 +823,6 @@
<ref name="rect"/>
</attribute>
</optional>
<optional>
<attribute name="cell_size">
<ref name="size"/>
</attribute>
</optional>
<optional>
<attribute name="backcolor">
<ref name="ccolor"/>

View File

@ -305,7 +305,7 @@ void CGUI::Draw()
m_BaseObject->RecurseObject(&IGUIObject::IsHidden, &IGUIObject::Draw);
}
void CGUI::DrawSprite(const CGUISpriteInstance& Sprite, int CellID, const float& Z, const CRect& Rect, const CRect& UNUSED(Clipping))
void CGUI::DrawSprite(const CGUISpriteInstance& Sprite, const float& Z, const CRect& Rect, const CRect& UNUSED(Clipping))
{
// If the sprite doesn't exist (name == ""), don't bother drawing anything
if (!Sprite)
@ -313,7 +313,7 @@ void CGUI::DrawSprite(const CGUISpriteInstance& Sprite, int CellID, const float&
// TODO: Clipping?
Sprite.Draw(*this, Rect, CellID, m_Sprites, Z);
Sprite.Draw(*this, Rect, m_Sprites, Z);
}
void CGUI::UpdateResolution()
@ -1009,14 +1009,6 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
else
Image->m_TexturePlacementInFile = rect;
}
else if (attr_name == "cell_size")
{
CSize size;
if (!ParseString<CSize>(this, attr_value, size))
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value));
else
Image->m_CellSize = size;
}
else if (attr_name == "fixed_h_aspect_ratio")
{
float val;
@ -1242,14 +1234,6 @@ void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
else
icon.m_Size = size;
}
else if (attr_name == "cell_id")
{
int cell_id;
if (!ParseString<int>(this, attr_value.FromUTF8(), cell_id))
LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value);
else
icon.m_CellID = cell_id;
}
else
debug_warn(L"Invalid data - DTD shouldn't allow this");
}

View File

@ -101,13 +101,11 @@ public:
*
* @param Sprite Object referring to the sprite (which also caches
* calculations for faster rendering)
* @param CellID Number of the icon cell to use. (Ignored if this sprite doesn't
* have any images with "cell-size")
* @param Z Drawing order, depth value
* @param Rect Position and Size
* @param Clipping The sprite shouldn't be drawn outside this rectangle
*/
void DrawSprite(const CGUISpriteInstance& Sprite, int CellID, const float& Z, const CRect& Rect, const CRect& Clipping = CRect());
void DrawSprite(const CGUISpriteInstance& Sprite, const float& Z, const CRect& Rect, const CRect& Clipping = CRect());
/**
* The replacement of Process(), handles an SDL_Event_

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -61,7 +61,6 @@ void CGUIScrollBarVertical::Draw()
m_pGUI.DrawSprite(
GetStyle()->m_SpriteBackVertical,
0,
m_Z+0.1f,
CRect(
outline.left,
@ -98,7 +97,6 @@ void CGUIScrollBarVertical::Draw()
m_pGUI.DrawSprite(
*button_top,
0,
m_Z+0.2f,
CRect(
outline.left,
@ -110,7 +108,6 @@ void CGUIScrollBarVertical::Draw()
m_pGUI.DrawSprite(
*button_bottom,
0,
m_Z+0.2f,
CRect(
outline.left,
@ -123,7 +120,6 @@ void CGUIScrollBarVertical::Draw()
m_pGUI.DrawSprite(
GetStyle()->m_SpriteBarVertical,
0,
m_Z + 0.2f,
GetBarRect()
);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -30,13 +30,12 @@ void CGUISprite::AddImage(SGUIImage* image)
m_Images.push_back(image);
}
void CGUISpriteInstance::Draw(CGUI& pGUI, const CRect& Size, int CellID, std::map<CStr, const CGUISprite*>& Sprites, float Z) const
void CGUISpriteInstance::Draw(CGUI& pGUI, const CRect& Size, std::map<CStr, const CGUISprite*>& Sprites, float Z) const
{
if (m_CachedSize != Size || m_CachedCellID != CellID)
if (m_CachedSize != Size)
{
GUIRenderer::UpdateDrawCallCache(pGUI, m_DrawCallCache, m_SpriteName, Size, CellID, Sprites);
GUIRenderer::UpdateDrawCallCache(pGUI, m_DrawCallCache, m_SpriteName, Size, Sprites);
m_CachedSize = Size;
m_CachedCellID = CellID;
}
GUIRenderer::Draw(m_DrawCallCache, Z);
}
@ -46,12 +45,11 @@ void CGUISpriteInstance::Draw(CGUI& pGUI, const CRect& Size, int CellID, std::ma
// of data):
CGUISpriteInstance::CGUISpriteInstance()
: m_CachedCellID(-1)
{
}
CGUISpriteInstance::CGUISpriteInstance(const CStr& SpriteName)
: m_SpriteName(SpriteName), m_CachedCellID(-1)
: m_SpriteName(SpriteName)
{
}
@ -60,5 +58,4 @@ void CGUISpriteInstance::SetName(const CStr& SpriteName)
m_SpriteName = SpriteName;
m_CachedSize = CRect();
m_DrawCallCache.clear();
m_CachedCellID = -1;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -76,12 +76,6 @@ public:
// is the real texture
CRect m_TexturePlacementInFile;
// For textures that contain a collection of icons (e.g. unit portraits), this
// will be set to the size of one icon. An object's cell-id will determine
// which part of the texture is used.
// Equal to CSize(0,0) for non-celled textures.
CSize m_CellSize;
/**
* If non-zero, then the image's width will be adjusted when rendering so that
* the width:height ratio equals this value.
@ -156,7 +150,7 @@ public:
CGUISpriteInstance();
CGUISpriteInstance(const CStr& SpriteName);
void Draw(CGUI& pGUI, const CRect& Size, int CellID, std::map<CStr, const CGUISprite*>& Sprites, float Z) const;
void Draw(CGUI& pGUI, const CRect& Size, std::map<CStr, const CGUISprite*>& Sprites, float Z) const;
/**
* Whether this Sprite has no texture name set.
@ -192,7 +186,6 @@ private:
// Relevant details of previously rendered sprite; the cache is invalidated
// whenever any of these values changes.
mutable CRect m_CachedSize;
mutable int m_CachedCellID;
};
#endif // INCLUDED_CGUISPRITE

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -35,7 +35,7 @@ extern float g_GuiScale;
// TODO Gee: CRect => CPoint ?
void SGenerateTextImage::SetupSpriteCall(
const bool Left, CGUIText::SSpriteCall& SpriteCall, const float width, const float y,
const CSize& Size, const CStr& TextureName, const float BufferZone, const int CellID)
const CSize& Size, const CStr& TextureName, const float BufferZone)
{
// TODO Gee: Temp hardcoded values
SpriteCall.m_Area.top = y + BufferZone;
@ -52,7 +52,6 @@ void SGenerateTextImage::SetupSpriteCall(
SpriteCall.m_Area.right = width-BufferZone;
}
SpriteCall.m_CellID = CellID;
SpriteCall.m_Sprite = TextureName;
m_YFrom = SpriteCall.m_Area.top - BufferZone;
@ -145,7 +144,7 @@ void CGUIText::SetupSpriteCalls(
_y = y;
const SGUIIcon& icon = pGUI.GetIcon(imgname);
Image.SetupSpriteCall(j == CGUIString::SFeedback::Left, SpriteCall, Width, _y, icon.m_Size, icon.m_SpriteName, BufferZone, icon.m_CellID);
Image.SetupSpriteCall(j == CGUIString::SFeedback::Left, SpriteCall, Width, _y, icon.m_Size, icon.m_SpriteName, BufferZone);
// Check if image is the lowest thing.
m_Size.cy = std::max(m_Size.cy, Image.m_YTo);
@ -462,7 +461,7 @@ void CGUIText::Draw(CGUI& pGUI, const CGUIColor& DefaultColor, const CPos& pos,
textRenderer.Render();
for (const SSpriteCall& sc : m_SpriteCalls)
pGUI.DrawSprite(sc.m_Sprite, sc.m_CellID, z, sc.m_Area + pos);
pGUI.DrawSprite(sc.m_Sprite, z, sc.m_Area + pos);
if (isClipped)
glDisable(GL_SCISSOR_TEST);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -62,7 +62,7 @@ public:
NONCOPYABLE(SSpriteCall);
MOVABLE(SSpriteCall);
SSpriteCall() : m_CellID(0) {}
SSpriteCall() {}
/**
* Size and position of sprite
@ -74,8 +74,6 @@ public:
*/
CGUISpriteInstance m_Sprite;
int m_CellID;
/**
* Tooltip text
*/
@ -279,7 +277,7 @@ struct SGenerateTextImage
void SetupSpriteCall(
const bool Left, CGUIText::SSpriteCall& SpriteCall, const float width, const float y,
const CSize& Size, const CStr& TextureName, const float BufferZone, const int CellID);
const CSize& Size, const CStr& TextureName, const float BufferZone);
};
#endif // INCLUDED_GUITEXT

View File

@ -58,7 +58,7 @@ DrawCalls& DrawCalls::operator=(const DrawCalls&)
}
void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr& SpriteName, const CRect& Size, int CellID, std::map<CStr, const CGUISprite*>& Sprites)
void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr& SpriteName, const CRect& Size, std::map<CStr, const CGUISprite*>& Sprites)
{
// This is called only when something has changed (like the size of the
// sprite), so it doesn't need to be particularly efficient.
@ -209,7 +209,6 @@ void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const
Call.m_EnableBlending = false; // will be overridden if the texture has an alpha channel
Call.m_ObjectSize = ObjectSize;
Call.m_CellID = CellID;
}
else
{
@ -287,17 +286,6 @@ CRect SDrawCall::ComputeTexCoords() const
{
BlockTex = m_Image->m_TexturePlacementInFile;
}
// Check whether this sprite has "cell_size" set (and non-zero)
else if ((int)m_Image->m_CellSize.cx)
{
int cols = (int)TexWidth / (int)m_Image->m_CellSize.cx;
if (cols == 0)
cols = 1; // avoid divide-by-zero
int col = m_CellID % cols;
int row = m_CellID / cols;
BlockTex = CRect(m_Image->m_CellSize.cx*col, m_Image->m_CellSize.cy*row,
m_Image->m_CellSize.cx*(col+1), m_Image->m_CellSize.cy*(row+1));
}
// Use the whole texture
else
BlockTex = CRect(0, 0, TexWidth, TexHeight);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -46,7 +46,6 @@ namespace GUIRenderer
CTexturePtr m_Texture;
CRect m_ObjectSize;
int m_CellID;
bool m_EnableBlending;
@ -69,7 +68,7 @@ namespace GUIRenderer
DrawCalls& operator=(const DrawCalls&);
};
void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr8& SpriteName, const CRect& Size, int CellID, std::map<CStr8, const CGUISprite*>& Sprites);
void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr8& SpriteName, const CRect& Size, std::map<CStr8, const CGUISprite*>& Sprites);
void Draw(DrawCalls& Calls, float Z);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -29,7 +29,6 @@ CButton::CButton(CGUI& pGUI)
IGUIButtonBehavior(*static_cast<IGUIObject*>(this)),
IGUITextOwner(*static_cast<IGUIObject*>(this)),
m_BufferZone(),
m_CellID(),
m_Caption(),
m_Font(),
m_Sprite(),
@ -44,7 +43,6 @@ CButton::CButton(CGUI& pGUI)
m_TextColorDisabled()
{
RegisterSetting("buffer_zone", m_BufferZone);
RegisterSetting("cell_id", m_CellID);
RegisterSetting("caption", m_Caption);
RegisterSetting("font", m_Font);
RegisterSetting("sprite", m_Sprite);
@ -98,7 +96,6 @@ void CButton::Draw()
m_pGUI.DrawSprite(
GetButtonSprite(m_Sprite, m_SpriteOver, m_SpritePressed, m_SpriteDisabled),
m_CellID,
bz,
m_CachedActualSize);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -77,7 +77,6 @@ protected:
// Settings
float m_BufferZone;
i32 m_CellID;
CGUIString m_Caption;
CStrW m_Font;
CGUISpriteInstance m_Sprite;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -24,7 +24,6 @@
CCheckBox::CCheckBox(CGUI& pGUI)
: IGUIObject(pGUI),
IGUIButtonBehavior(*static_cast<IGUIObject*>(this)),
m_CellID(),
m_Checked(),
m_SpriteUnchecked(),
m_SpriteUncheckedOver(),
@ -35,7 +34,6 @@ CCheckBox::CCheckBox(CGUI& pGUI)
m_SpriteCheckedPressed(),
m_SpriteCheckedDisabled()
{
RegisterSetting("cell_id", m_CellID);
RegisterSetting("checked", m_Checked),
RegisterSetting("sprite", m_SpriteUnchecked);
RegisterSetting("sprite_over", m_SpriteUncheckedOver);
@ -81,7 +79,6 @@ void CCheckBox::Draw()
m_Checked ?
GetButtonSprite(m_SpriteChecked, m_SpriteCheckedOver, m_SpriteCheckedPressed, m_SpriteCheckedDisabled) :
GetButtonSprite(m_SpriteUnchecked, m_SpriteUncheckedOver, m_SpriteUncheckedPressed, m_SpriteUncheckedDisabled),
m_CellID,
GetBufferedZ(),
m_CachedActualSize);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -47,7 +47,6 @@ public:
protected:
// Settings
i32 m_CellID;
bool m_Checked;
CGUISpriteInstance m_SpriteUnchecked;
CGUISpriteInstance m_SpriteUncheckedOver;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -444,7 +444,7 @@ void CDropDown::Draw()
const float bz = GetBufferedZ();
const CGUISpriteInstance& sprite = m_Enabled ? m_Sprite : m_SpriteDisabled;
m_pGUI.DrawSprite(sprite, m_CellID, bz, m_CachedActualSize);
m_pGUI.DrawSprite(sprite, bz, m_CachedActualSize);
if (m_ButtonWidth > 0.f)
{
@ -453,18 +453,18 @@ void CDropDown::Draw()
if (!m_Enabled)
{
m_pGUI.DrawSprite(m_Sprite2Disabled || m_Sprite2, m_CellID, bz + 0.05f, rect);
m_pGUI.DrawSprite(m_Sprite2Disabled || m_Sprite2, bz + 0.05f, rect);
}
else if (m_Open)
{
m_pGUI.DrawSprite(m_Sprite2Pressed || m_Sprite2, m_CellID, bz + 0.05f, rect);
m_pGUI.DrawSprite(m_Sprite2Pressed || m_Sprite2, bz + 0.05f, rect);
}
else if (m_MouseHovering)
{
m_pGUI.DrawSprite(m_Sprite2Over || m_Sprite2, m_CellID, bz + 0.05f, rect);
m_pGUI.DrawSprite(m_Sprite2Over || m_Sprite2, bz + 0.05f, rect);
}
else
m_pGUI.DrawSprite(m_Sprite2, m_CellID, bz + 0.05f, rect);
m_pGUI.DrawSprite(m_Sprite2, bz + 0.05f, rect);
}
if (m_Selected != -1) // TODO: Maybe check validity completely?

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -23,11 +23,9 @@
CImage::CImage(CGUI& pGUI)
: IGUIObject(pGUI),
m_Sprite(),
m_CellID()
m_Sprite()
{
RegisterSetting("sprite", m_Sprite);
RegisterSetting("cell_id", m_CellID);
}
CImage::~CImage()
@ -36,5 +34,5 @@ CImage::~CImage()
void CImage::Draw()
{
m_pGUI.DrawSprite(m_Sprite, m_CellID, GetBufferedZ(), m_CachedActualSize);
m_pGUI.DrawSprite(m_Sprite, GetBufferedZ(), m_CachedActualSize);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -47,7 +47,6 @@ protected:
// Settings
CGUISpriteInstance m_Sprite;
i32 m_CellID;
};
#endif // INCLUDED_CIMAGE

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -59,7 +59,6 @@ CInput::CInput(CGUI& pGUI)
m_BufferPosition(),
m_BufferZone(),
m_Caption(),
m_CellID(),
m_Font(),
m_MaskChar(),
m_Mask(),
@ -76,7 +75,6 @@ CInput::CInput(CGUI& pGUI)
RegisterSetting("buffer_position", m_BufferPosition);
RegisterSetting("buffer_zone", m_BufferZone);
RegisterSetting("caption", m_Caption);
RegisterSetting("cell_id", m_CellID);
RegisterSetting("font", m_Font);
RegisterSetting("mask_char", m_MaskChar);
RegisterSetting("mask", m_Mask);
@ -1206,7 +1204,7 @@ void CInput::Draw()
if (m_Mask && m_MaskChar.length() > 0)
mask_char = m_MaskChar[0];
m_pGUI.DrawSprite(m_Sprite, m_CellID, bz, m_CachedActualSize);
m_pGUI.DrawSprite(m_Sprite, bz, m_CachedActualSize);
float scroll = 0.f;
if (m_ScrollBar && m_MultiLine)
@ -1395,7 +1393,7 @@ void CInput::Draw()
rect.right = m_CachedActualSize.right;
}
m_pGUI.DrawSprite(m_SpriteSelectArea, m_CellID, bz + 0.05f, rect);
m_pGUI.DrawSprite(m_SpriteSelectArea, bz + 0.05f, rect);
}
if (i < (int)it->m_ListOfX.size())

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -221,7 +221,6 @@ protected:
float m_BufferZone;
CStrW m_Caption;
CGUIString m_PlaceholderText;
i32 m_CellID;
CStrW m_Font;
CStrW m_MaskChar;
bool m_Mask;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -48,7 +48,6 @@ CList::CList(CGUI& pGUI)
m_SoundSelected(),
m_Sprite(),
m_SpriteSelectArea(),
m_CellID(),
m_TextAlign(),
m_TextColor(),
m_TextColorSelected(),
@ -68,7 +67,6 @@ CList::CList(CGUI& pGUI)
RegisterSetting("sprite", m_Sprite);
// Add sprite_disabled! TODO
RegisterSetting("sprite_selectarea", m_SpriteSelectArea);
RegisterSetting("cell_id", m_CellID);
RegisterSetting("text_align", m_TextAlign);
RegisterSetting("textcolor", m_TextColor);
RegisterSetting("textcolor_selected", m_TextColorSelected);
@ -340,7 +338,7 @@ void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, cons
{
CRect rect = GetListRect();
m_pGUI.DrawSprite(sprite, m_CellID, bz, rect);
m_pGUI.DrawSprite(sprite, bz, rect);
float scroll = 0.f;
if (m_ScrollBar)
@ -372,7 +370,7 @@ void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, cons
rect_sel.left = GetScrollBar(0).GetOuterRect().right;
}
m_pGUI.DrawSprite(sprite_selectarea, m_CellID, bz + 0.05f, rect_sel);
m_pGUI.DrawSprite(sprite_selectarea, bz + 0.05f, rect_sel);
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -131,7 +131,6 @@ protected:
CStrW m_SoundSelected;
CGUISpriteInstance m_Sprite;
CGUISpriteInstance m_SpriteSelectArea;
i32 m_CellID;
EAlign m_TextAlign;
CGUIColor m_TextColor;
CGUIColor m_TextColorSelected;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -300,7 +300,7 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
CRect rect = GetListRect();
m_pGUI.DrawSprite(sprite, m_CellID, bz, rect);
m_pGUI.DrawSprite(sprite, bz, rect);
float scroll = 0.f;
if (m_ScrollBar)
@ -336,14 +336,14 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
}
// Draw item selection
m_pGUI.DrawSprite(sprite_selected, m_CellID, bz + 0.05f, rect_sel);
m_pGUI.DrawSprite(sprite_selected, bz + 0.05f, rect_sel);
}
}
// Draw line above column header
CRect rect_head(m_CachedActualSize.left, m_CachedActualSize.top, m_CachedActualSize.right,
m_CachedActualSize.top + m_HeadingHeight);
m_pGUI.DrawSprite(m_SpriteHeading, m_CellID, bz, rect_head);
m_pGUI.DrawSprite(m_SpriteHeading, bz, rect_head);
// Draw column headers
float xpos = 0;
@ -380,7 +380,7 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
else
pSprite = &m_SpriteNotSorted;
m_pGUI.DrawSprite(*pSprite, m_CellID, bz + 0.1f, CRect(leftTopCorner + CPos(width - SORT_SPRITE_DIM, 0), leftTopCorner + CPos(width, SORT_SPRITE_DIM)));
m_pGUI.DrawSprite(*pSprite, bz + 0.1f, CRect(leftTopCorner + CPos(width - SORT_SPRITE_DIM, 0), leftTopCorner + CPos(width, SORT_SPRITE_DIM)));
}
// Draw column header text

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -59,12 +59,11 @@ void CProgressBar::HandleMessage(SGUIMessage& Message)
void CProgressBar::Draw()
{
float bz = GetBufferedZ();
int cell_id = 0;
m_pGUI.DrawSprite(m_SpriteBackground, cell_id, bz, m_CachedActualSize);
m_pGUI.DrawSprite(m_SpriteBackground, bz, m_CachedActualSize);
// Get size of bar (notice it is drawn slightly closer, to appear above the background)
CRect size = m_CachedActualSize;
size.right = size.left + m_CachedActualSize.GetWidth() * (m_Progress / 100.f),
m_pGUI.DrawSprite(m_SpriteBar, cell_id, bz + 0.01f, size);
m_pGUI.DrawSprite(m_SpriteBar, bz + 0.01f, size);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -28,7 +28,6 @@ CSlider::CSlider(CGUI& pGUI)
: IGUIObject(pGUI),
IGUIButtonBehavior(*static_cast<IGUIObject*>(this)),
m_ButtonSide(),
m_CellID(),
m_MaxValue(),
m_MinValue(),
m_Sprite(),
@ -36,7 +35,6 @@ CSlider::CSlider(CGUI& pGUI)
m_Value()
{
RegisterSetting("button_width", m_ButtonSide);
RegisterSetting("cell_id", m_CellID);
RegisterSetting("max_value", m_MaxValue);
RegisterSetting("min_value", m_MinValue);
RegisterSetting("sprite", m_Sprite);
@ -115,8 +113,8 @@ void CSlider::Draw()
slider_line.left += m_ButtonSide / 2.0f;
slider_line.right -= m_ButtonSide / 2.0f;
float bz = GetBufferedZ();
m_pGUI.DrawSprite(m_SpriteBar, m_CellID, bz, slider_line);
m_pGUI.DrawSprite(m_Sprite, m_CellID, bz, GetButtonRect());
m_pGUI.DrawSprite(m_SpriteBar, bz, slider_line);
m_pGUI.DrawSprite(m_Sprite, bz, GetButtonRect());
}
void CSlider::UpdateValue()

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -61,7 +61,6 @@ protected:
// Settings
float m_ButtonSide;
i32 m_CellID;
float m_MinValue;
float m_MaxValue;
CGUISpriteInstance m_Sprite;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -31,7 +31,6 @@ CText::CText(CGUI& pGUI)
IGUITextOwner(*static_cast<IGUIObject*>(this)),
m_BufferZone(),
m_Caption(),
m_CellID(),
m_Clip(),
m_Font(),
m_ScrollBar(),
@ -48,7 +47,6 @@ CText::CText(CGUI& pGUI)
{
RegisterSetting("buffer_zone", m_BufferZone);
RegisterSetting("caption", m_Caption);
RegisterSetting("cell_id", m_CellID);
RegisterSetting("clip", m_Clip);
RegisterSetting("font", m_Font);
RegisterSetting("scrollbar", m_ScrollBar);
@ -198,7 +196,7 @@ void CText::Draw()
if (m_ScrollBar)
IGUIScrollBarOwner::Draw();
m_pGUI.DrawSprite(m_Sprite, m_CellID, bz, m_CachedActualSize);
m_pGUI.DrawSprite(m_Sprite, bz, m_CachedActualSize);
float scroll = 0.f;
if (m_ScrollBar)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -80,7 +80,6 @@ protected:
// Settings
float m_BufferZone;
CGUIString m_Caption;
i32 m_CellID;
bool m_Clip;
CStrW m_Font;
bool m_ScrollBar;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -157,7 +157,7 @@ void CTooltip::Draw()
m_GeneratedTextsValid = true;
}
m_pGUI.DrawSprite(m_Sprite, 0, z, m_CachedActualSize);
m_pGUI.DrawSprite(m_Sprite, z, m_CachedActualSize);
DrawText(0, m_TextColor, m_CachedActualSize.TopLeft(), z + 0.1f);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -31,16 +31,13 @@ struct SGUIIcon
NONCOPYABLE(SGUIIcon);
MOVABLE(SGUIIcon);
SGUIIcon() : m_CellID(0) {}
SGUIIcon() {}
// Sprite name of icon
CStr m_SpriteName;
// Size
CSize m_Size;
// Cell of texture to use; ignored unless the texture has specified cell-size
int m_CellID;
};
#endif // INCLUDED_SGUIICON

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -159,7 +159,6 @@ void CGUIString::GenerateTextCall(const CGUI& pGUI, SFeedback& Feedback, CStrInt
}
SpriteCall.m_Sprite = icon.m_SpriteName;
SpriteCall.m_CellID = icon.m_CellID;
// Add sprite call
Feedback.m_SpriteCalls.push_back(std::move(SpriteCall));