Changed <icon>'s property 'texture' to 'sprite'. Better late than never. Fixed a bug in the Input rendering code. Minor changes.

This was SVN commit r2539.
This commit is contained in:
Gee 2005-07-25 00:52:03 +00:00
parent cdfabb9acc
commit 727d2035d3
5 changed files with 49 additions and 11 deletions

View File

@ -666,7 +666,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string,
SGUIIcon icon = GetIcon(*it);
CSize size = icon.m_Size;
Image.SetupSpriteCall((j==CGUIString::SFeedback::Left), SpriteCall, Width, _y, size, icon.m_TextureName, BufferZone, icon.m_CellID);
Image.SetupSpriteCall((j==CGUIString::SFeedback::Left), SpriteCall, Width, _y, size, icon.m_SpriteName, BufferZone, icon.m_CellID);
// Check if image is the lowest thing.
Text.m_Size.cy = MAX(Text.m_Size.cy, Image.m_YTo);
@ -1758,8 +1758,8 @@ void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
if (attr_name == "name")
name = attr_value;
else
if (attr_name == "texture")
icon.m_TextureName = attr_value;
if (attr_name == "sprite")
icon.m_SpriteName = attr_value;
else
if (attr_name == "size")
{

View File

@ -19,8 +19,8 @@ CImage::CImage()
{
AddSetting(GUIST_CGUISpriteInstance, "sprite");
AddSetting(GUIST_int, "cell_id");
AddSetting(GUIST_CStr, "tooltip");
AddSetting(GUIST_CStr, "tooltip_style");
AddSetting(GUIST_CStr, "tooltip");
AddSetting(GUIST_CStr, "tooltip_style");
}
CImage::~CImage()

View File

@ -677,6 +677,41 @@ void CInput::Draw()
glPushMatrix();
// We'll have to setup clipping manually, since we're doing the rendering manually.
CRect cliparea(m_CachedActualSize);
// First we'll figure out the clipping area, which is the cached actual size
// substracted by an optional scrollbar
if (scrollbar)
{
scroll = GetScrollBar(0).GetPos();
// substract scrollbar from cliparea
if (cliparea.right > GetScrollBar(0).GetOuterRect().left &&
cliparea.right <= GetScrollBar(0).GetOuterRect().right)
cliparea.right = GetScrollBar(0).GetOuterRect().left;
if (cliparea.left >= GetScrollBar(0).GetOuterRect().left &&
cliparea.left < GetScrollBar(0).GetOuterRect().right)
cliparea.left = GetScrollBar(0).GetOuterRect().right;
}
if (cliparea != CRect())
{
double eq[4][4] =
{
{ 0.0, 1.0, 0.0, -cliparea.top },
{ 1.0, 0.0, 0.0, -cliparea.left },
{ 0.0, -1.0, 0.0, cliparea.bottom },
{ -1.0, 0.0, 0.0, cliparea.right }
};
for (int i=0; i<4; ++i)
{
glClipPlane(GL_CLIP_PLANE0+i, eq[i]);
glEnable(GL_CLIP_PLANE0+i);
}
}
// These are useful later.
int VirtualFrom, VirtualTo;
@ -790,7 +825,6 @@ void CInput::Draw()
// and actually add a white space! yes, this is done in any common input
x_pointer += (float)font.GetCharacterWidth(L' ');
}
// TODO: Make sure x_pointer isn't sticking out of the edge!
}
else
{
@ -832,13 +866,14 @@ void CInput::Draw()
glPushMatrix();
guiLoadIdentity();
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
if (sprite_selectarea)
GetGUI()->DrawSprite(*sprite_selectarea, cell_id, bz+0.05f, rect);
// Blend can have been reset
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
@ -963,6 +998,9 @@ void CInput::Draw()
glPopMatrix();
// Disable clipping
for (int i=0; i<4; ++i)
glDisable(GL_CLIP_PLANE0+i);
glDisable(GL_TEXTURE_2D);
}
}

View File

@ -153,7 +153,7 @@ void CGUIString::GenerateTextCall(SFeedback &Feedback,
SpriteCall.m_Area += displacement;
}
SpriteCall.m_Sprite = icon.m_TextureName;
SpriteCall.m_Sprite = icon.m_SpriteName;
SpriteCall.m_CellID = icon.m_CellID;
// Add sprite call

View File

@ -47,8 +47,8 @@ struct SGUIIcon
{
SGUIIcon() : m_CellID(0) {}
// Texture name of icon
CStr m_TextureName;
// Sprite name of icon
CStr m_SpriteName;
// Size
CSize m_Size;