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); SGUIIcon icon = GetIcon(*it);
CSize size = icon.m_Size; 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. // Check if image is the lowest thing.
Text.m_Size.cy = MAX(Text.m_Size.cy, Image.m_YTo); 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") if (attr_name == "name")
name = attr_value; name = attr_value;
else else
if (attr_name == "texture") if (attr_name == "sprite")
icon.m_TextureName = attr_value; icon.m_SpriteName = attr_value;
else else
if (attr_name == "size") if (attr_name == "size")
{ {

View File

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

View File

@ -677,6 +677,41 @@ void CInput::Draw()
glPushMatrix(); 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. // These are useful later.
int VirtualFrom, VirtualTo; int VirtualFrom, VirtualTo;
@ -790,7 +825,6 @@ void CInput::Draw()
// and actually add a white space! yes, this is done in any common input // and actually add a white space! yes, this is done in any common input
x_pointer += (float)font.GetCharacterWidth(L' '); x_pointer += (float)font.GetCharacterWidth(L' ');
} }
// TODO: Make sure x_pointer isn't sticking out of the edge!
} }
else else
{ {
@ -832,13 +866,14 @@ void CInput::Draw()
glPushMatrix(); glPushMatrix();
guiLoadIdentity(); guiLoadIdentity();
glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
if (sprite_selectarea) if (sprite_selectarea)
GetGUI()->DrawSprite(*sprite_selectarea, cell_id, bz+0.05f, rect); GetGUI()->DrawSprite(*sprite_selectarea, cell_id, bz+0.05f, rect);
// Blend can have been reset
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
@ -963,6 +998,9 @@ void CInput::Draw()
glPopMatrix(); glPopMatrix();
// Disable clipping
for (int i=0; i<4; ++i)
glDisable(GL_CLIP_PLANE0+i);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
} }

View File

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

View File

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