1
0
forked from 0ad/0ad
0ad/source/gui/CGUISprite.cpp

42 lines
1.1 KiB
C++
Raw Normal View History

/*
CGUISprite
by Gustav Larsson
gee@pyro.nu
*/
//#include "stdafx.h"
#include "GUI.h"
using namespace std;
//-------------------------------------------------------------------
// Draw this sprite
// Input:
// rect Rectangle where the sprite should be drawn
// z Same as above only with Z-value
// clipping The clipping rectangle, things should only
// be drawn within these perimeters.
//-------------------------------------------------------------------
void CGUISprite::Draw(const float &z, const CRect &rect, const CRect &clipping=CRect(0,0,0,0))
{
bool DoClipping = (clipping != CRect(0,0,0,0));
// Iterate all images and request them being drawn be the
// CRenderer
std::vector<SGUIImage>::iterator it;
for (it=m_Images.begin(); it!=m_Images.end(); ++it)
{
glPushMatrix();
glTranslatef(0.0f, 0.0f, z);
// Do this
glBegin(GL_QUADS);
glVertex2i(rect.right, rect.bottom);
glVertex2i(rect.left, rect.bottom);
glVertex2i(rect.left, rect.top);
glVertex2i(rect.right, rect.top);
glEnd();
glPopMatrix();
}
}