All pastes #829239 Raw Edit

Unnamed

public cpp v1 · immutable
#829239 ·published 2007-12-23 00:45 UTC
rendered paste body
#include "cGUI.h"// Console variablesint consoleId;int btnSubmit;int lstConsole;int txtInput;void ConsoleProc(cbParam Param){	if(Param.type == GUI_OBJECT && Param.id == btnSubmit)	{		Object *list;		Object *input;		list = gGUI->GetObjectPointer(lstConsole, Param.pId);		input = gGUI->GetObjectPointer(txtInput, Param.pId);		list->listBox.AddItem(input->textBox.value);	} else if(Param.type == GUI_WINDOW && Param.iParam == GUI_RESIZE)	{		// Resize		Window *window;		window = Param.window;		Param.window->x = Param.window->x + 40;	}}cbParam::cbParam(int itemID, int itemPID, int itemType, int intParam, Object *obj, Window *wndw, string itemParam){	id = itemID;	pId = itemPID;	type = itemType;	Param = itemParam;	iParam = intParam;}int ListBox::AddItem(string value){	list.push_back(value.c_str());	return 1;}int ListBox::AddItem(int value){	char *dest;	itoa(value, dest, 10);	this->list.push_back(dest);	return 1;}int ListBox::AddItem(ostringstream value){	this->list.push_back(value.str().c_str());	return 1;}void Window::Hide(){	visible = false;}void Window::Show(){	visible = true;}void cGUI::Init(){	vertexAttribute texturedVA[] =	{		{VERT_USAGE_POSITION, VERT_FORMAT_FLOAT3, 1},		{VERT_USAGE_TEXCOORD, VERT_FORMAT_FLOAT2, 1},	};	texturedVertexFormatIndex = g3D->addVertexFormat( texturedVA, 2 );	vertexAttribute coloredVA[] =	{		{VERT_USAGE_POSITION, VERT_FORMAT_FLOAT3, 1},		{VERT_USAGE_COLOR, VERT_FORMAT_COLOR, 1},	};	coloredVertexFormatIndex = g3D->addVertexFormat( coloredVA, 2 );	// Setup the default vertex lists		// Textured Vertex setup	// Top Left	texturedVertexList[0].u = 0.0f;						texturedVertexList[0].v = 1.0f;	texturedVertexList[0].x = -1.0f;	texturedVertexList[0].y = -1.0f;	texturedVertexList[0].z = 0.1f;	// Bottom Left	texturedVertexList[1].u = 0.0f;						texturedVertexList[1].v = 0.0f;	texturedVertexList[1].x = -1.0f;	texturedVertexList[1].y = 1.0f;	texturedVertexList[1].z = 0.1f;	// Bottom Right	texturedVertexList[2].u = 1.0f;						texturedVertexList[2].v = 0.0f;	texturedVertexList[2].x = 1.0f;	texturedVertexList[2].y = 1.0f;	texturedVertexList[2].z = 0.1f;	// Bottom Right	texturedVertexList[3].u = 1.0f;						texturedVertexList[3].v = 0.0f;	texturedVertexList[3].x = 1.0f;	texturedVertexList[3].y = 1.0f;	texturedVertexList[3].z = 0.1f;	// Top Right	texturedVertexList[4].u = 1.0f;	texturedVertexList[4].v = 1.0f;	texturedVertexList[4].x = 1.0f;	texturedVertexList[4].y = -1.0f;	texturedVertexList[4].z = 0.1f;	// Top Left	texturedVertexList[5].u = 0.0f;						texturedVertexList[5].v = 1.0f;	texturedVertexList[5].x = -1.0f; 	texturedVertexList[5].y = -1.0f;	texturedVertexList[5].z = 0.1f;	texturedVertexBufferIndex = g3D->addVertexBuffer( sizeof( texture_vertex_format ) * 6, &texturedVertexList[0], SMS_VBO_STATIC );	// Colored Vertex setup	// Top Left					coloredVertexList[0].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[0].x = -1.0f;	coloredVertexList[0].y = -1.0f;	coloredVertexList[0].z = 0.1f;	// Bottom Left					coloredVertexList[1].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[1].x = -1.0f;	coloredVertexList[1].y = 1.0f;	coloredVertexList[1].z = 0.1f;	// Bottom Right					coloredVertexList[2].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[2].x = 1.0f;	coloredVertexList[2].y = 1.0f;	coloredVertexList[2].z = 0.1f;	// Bottom Right					coloredVertexList[3].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[3].x = 1.0f;	coloredVertexList[3].y = 1.0f;	coloredVertexList[3].z = 0.1f;	// Top Right	coloredVertexList[4].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[4].x = 1.0f;	coloredVertexList[4].y = -1.0f;	coloredVertexList[4].z = 0.1f;	// Top Left					coloredVertexList[5].color = MAKE_ARGB(55, 255, 255, 255);	coloredVertexList[5].x = -1.0f; 	coloredVertexList[5].y = -1.0f;	coloredVertexList[5].z = 0.1f;	coloredVertexBufferIndex = g3D->addVertexBuffer( sizeof( color_vertex_format ) * 6, &coloredVertexList[0], SMS_VBO_STATIC );	// Load Textures	g3D->addTexture( "textures/gui/center.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/side.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/side2.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/min.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/max.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/close.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/bottom-corner.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/bottom-corner2.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/top.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/top-corner.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/top-corner2.dds", SMS_TEX_FILTER_BILINEAR );	g3D->addTexture( "textures/gui/bottom.dds", SMS_TEX_FILTER_BILINEAR );	// Create the console	consoleId = gGUI->CreateGUIWindow( 20, 20, 540, 580, "Console", &ConsoleProc, true );	lstConsole = gGUI->CreateGUIObject(consoleId, GUI_OBJECT_LISTBOX, 8, 34, 526, 510, "Log", &ConsoleProc, true);	txtInput = gGUI->CreateGUIObject(consoleId, GUI_OBJECT_TEXTBOX, 8, 548, 443, 20, "Input", &ConsoleProc, true);	btnSubmit = gGUI->CreateGUIObject(consoleId, GUI_OBJECT_BUTTON, 454, 548, 80, 19, "Submit", &ConsoleProc, true);	// Welcome messages in the console	Object *con;	con = gGUI->GetObjectPointer(lstConsole, consoleId);	con->listBox.AddItem("Welcome to the Xomni Engine!");	con->listBox.AddItem("Engine Build: 1. DEBUG");}void cGUI::Render(){	// Ortho Projection Setup	mat4 prevMV, prevPROJ, mv, proj;	g3D->getMatrix( SMS_MATRIX_MODELVIEW, prevMV );	g3D->getMatrix( SMS_MATRIX_PROJECTION, prevPROJ );	g3D->genLookAtMatrix( mv, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f );	g3D->genOrthoMatrix( proj, -1.0, 1.0, -1.0, 1.0, 0.1, 1.0 );	g3D->setMatrix( SMS_MATRIX_MODELVIEW, mv );	g3D->setMatrix( SMS_MATRIX_PROJECTION, proj );	g3D->changeDepthMode( SMS_ZBUFFER_DISABLE );	g3D->changeCullMode( SMS_CULL_NONE );	// Renderings	//renderSquare(500,100, 100, 100);	//renderSquare(600,300, 100, 100);	//RenderWindow(100, 100, 200, 200, "sggs");	for(int i = windowLst.size() - 1; i >= 0; i--)	{		if(windowLst[i].visible)		{			RenderWindow( windowLst[i].x, windowLst[i].y, windowLst[i].width, windowLst[i].height, windowLst[i].name );			/*for(int o = 0; o < windowLst[i].objects.size(); o++)			{				Object tmpObject = windowLst[i].objects[o];				switch(tmpObject.type)				{					case(GUI_OBJECT_BUTTON):					{						RenderButton(&windowLst[i], &tmpObject);						break;					}					case(GUI_OBJECT_TEXTBOX):					{						RenderTextBox(&windowLst[i], &tmpObject);						break;					}					case(GUI_OBJECT_LISTBOX):					{						RenderListBox(&windowLst[i], &tmpObject);						break;					}					case(GUI_OBJECT_LABEL):					{						RenderLabel(&windowLst[i], &tmpObject);						break;					}				}			}*/		}	}	// Return everything to how it was	g3D->changeDepthMode( SMS_ZBUFFER_DEFAULT );	g3D->changeCullMode( SMS_CULL_DEFAULT );		g3D->setMatrix( SMS_MATRIX_MODELVIEW, prevMV );	g3D->setMatrix( SMS_MATRIX_PROJECTION, prevPROJ );	g3D->resetViewport();}void cGUI::renderQuad(int x, int y, int width, int height, int color){	g3D->setViewport( x, y, width,  height);	if(color != 0)	{		setVertexFormat(GUI_FORMAT_COLOR);		setVertexBufferColor(coloredVertexList, color);	}	else		setVertexFormat(GUI_FORMAT_TEXTURED);	g3D->renderTriStripFromVBO( 0, 5 );	//	g3D->renderLine( vec3f( -1, -1, 0.5 ), vec3f( 1, 1, 0.5 ), 0xFFFFFFFF );	g3D->changeDepthMode( SMS_ZBUFFER_DEFAULT );	g3D->changeCullMode( SMS_CULL_DEFAULT );}void cGUI::RenderWindow( int x, int y, int width, int height, string name ){	// Top Left	//g3D->changeTexture( "textures/gui/top-corner.dds", 0 );	renderQuad(x, y, 28, 28, MAKE_ARGB(255, 255, 0, 0));	// Top	//g3D->changeTexture( "textures/gui/top.dds", 0 );	renderQuad(x + 28, y, width - 56, 28, MAKE_ARGB(255, 255, 0, 0));	// Top Right	//g3D->changeTexture( "textures/gui/top-corner2.dds", 0 );	renderQuad(x + width - 28, y, 28, 28, MAKE_ARGB(255, 255, 0, 0));	// Bottom Left	//g3D->changeTexture( "textures/gui/bottom-corner.dds", 0 );	renderQuad(x, y + height - 28, 28, 28, MAKE_ARGB(255, 255, 0, 0));	// Bottom	//g3D->changeTexture( "textures/gui/bottom.dds", 0 );	renderQuad(x + 28, y + height - 28, width - 56, 28, MAKE_ARGB(255, 255, 0, 0));	// Bottom Right	//g3D->changeTexture( "textures/gui/bottom-corner2.dds", 0 );	renderQuad(x + width - 28, y + height - 28, 28, 28, MAKE_ARGB(255, 255, 0, 0));	// Center	//g3D->changeTexture( "textures/gui/center.dds", 0 );	renderQuad(x, y + 28, width - 28, height - 56, MAKE_ARGB(255, 255, 0, 0));	// Left	//g3D->changeTexture( "textures/gui/side.dds", 0 );	renderQuad(x, y + 28, 28, height - 56, MAKE_ARGB(255, 255, 0, 0));	// Right	//g3D->changeTexture( "textures/gui/side2.dds", 0 );	renderQuad(x + width - 28, y + 28, 28, height - 56, MAKE_ARGB(255, 255, 0, 0));}void cGUI::RenderButton( int x, int y, int width, int height, string name, bool enabled ){	// Top Left		renderQuad(x, y, width + 2, height + 2, MAKE_ARGB(55, 255, 255, 255));	//g3D->changeTexture( "textures/gui/center.dds", 0 );	//renderQuad(x, y, width, height);	renderBitmapString(x + 4, y + (height / 2 + 5), 0, 1, (char *)name.c_str());}void cGUI::RenderButton(Window *wndw, Object *obj){	int x = wndw->x + obj->x;	int y = wndw->y + obj->y;	int width = obj->width;	int height = obj->height;	string name = obj->name;	bool active = true;	bool enabled = obj->enabled;	renderQuad(x - 1, y - 1, width + 2, height + 2, MAKE_ARGB(255, 0, 0, 0));	//g3D->changeTexture( "textures/gui/center.dds", 0 );	//renderQuad(x, y, width, height);	renderBitmapString(x + 4, y + (height / 2 + 5), 0, 1, (char *)name.c_str());}void cGUI::RenderTextBox( int x, int y, int width, int height, string name, string value, bool active, bool enabled ){	g3D->changeTexture( "textures/gui/center.dds", 0 );	renderQuad(x - 2, y - 2, width + 1, height + 1);	renderQuad(x, y, width, height);	if(active)	{		ostringstream val;		val << value << "|";		renderBitmapString(x + 3, y + 15, 0, 1, (char *)val.str().c_str());	}else		renderBitmapString(x + 3, y + 15, 0, 1, (char *)value.c_str());}void cGUI::RenderTextBox(Window *wndw, Object *obj){	int x = wndw->x + obj->x;	int y = wndw->y + obj->y;	int width = obj->width;	int height = obj->height;	string name = obj->name;	string value = obj->textBox.value;	bool active;	bool enabled = obj->enabled;	if(wndw->activeObjID == obj->id)		active = true;	else		active = false;	g3D->changeTexture( "textures/gui/center.dds", 0 );	renderQuad(x - 2, y - 2, width + 1, height + 1);	renderQuad(x, y, width, height);	if(active)	{		ostringstream val;		val << value << "|";		renderBitmapString(x + 3, y + 15, 0, 1, (char *)val.str().c_str());	}else		renderBitmapString(x + 3, y + 15, 0, 1, (char *)value.c_str());}void cGUI::RenderListBox(Window *wndw, Object *obj){	int x = wndw->x + obj->x;	int y = wndw->y + obj->y;	int width = obj->width;	int height = obj->height;	string name = obj->name;	bool active = true;	bool enabled = obj->enabled;	g3D->changeTexture( "textures/gui/center.dds", 0 );	renderQuad(x - 2, y - 2, width + 1, height + 1);	renderQuad(x, y, width, height);	vector <string> tmpList = obj->listBox.list;	y += 11;	for(int i = 0; i < tmpList.size(); i++)	{		renderBitmapString(x + 3, (10 * i) + y, 0, 1, (char *)tmpList[i].c_str());	}}void cGUI::RenderLabel(Window *wndw, Object *obj){	int x = wndw->x + obj->x;	int y = wndw->y + obj->y;	int width = obj->width;	int height = obj->height;	string value = obj->name;	bool active;	bool enabled = obj->enabled;	if(wndw->activeObjID == obj->id)		active = true;	else		active = false;	g3D->changeTexture( "textures/gui/center.dds", 0 );	renderQuad(x, y, width, height);	if(active)	{		ostringstream val;		val << value << "|";		renderBitmapString(x, y, 0, 1, (char *)val.str().c_str());	}else		renderBitmapString(x, y, 0, 1, (char *)value.c_str());}void cGUI::renderBitmapString(float x, float y, float z, int font, char *string) {  	}int cGUI::CreateGUIWindow( int x, int y, int width, int height, string name, void (*cbFunc)(cbParam), bool visible ){	Window tmp;	curWindowID++;	tmp.id = curWindowID;	tmp.x = x;	tmp.y = y;	tmp.width = width;	tmp.height = height;	tmp.minHeight = 100;	tmp.minWidth = 100;	tmp.name = name;	tmp.visible = visible;	tmp.cbFunc = cbFunc;	tmp.currentObjectID=0;	tmp.activeObjID = -1;	windowLst.insert(windowLst.begin(), tmp);	return curWindowID;}int cGUI::CreateGUIWindow(Window window){	curWindowID++;	window.id = curWindowID;	window.currentObjectID=0;	window.activeObjID = -1;	windowLst.insert(windowLst.begin(), window);	return curWindowID;}int cGUI::CreateGUIObject( int hWnd, int type, int x, int y, int width, int height, string name, void (*cbFunc)(cbParam), bool visible ){	int Index;	for(int i = 0; i < windowLst.size(); i++)	{		if(windowLst[i].id == hWnd)		{			Index = i;			break;		}	}	Object tmp;	windowLst[Index].currentObjectID++;	tmp.id = windowLst[Index].currentObjectID;	tmp.x = x;	tmp.y = y;	tmp.width = width;	tmp.height = height;	tmp.name = name;	tmp.visible = visible;	tmp.cbFunc = cbFunc;	tmp.type = type;	tmp.enabled = true;	tmp.pId = hWnd;	windowLst[Index].objects.insert(windowLst[Index].objects.begin(), tmp);	return windowLst[Index].currentObjectID;}int cGUI::CreateGUIObject(Window *window, Object object){	window->currentObjectID++;	object.id = window->currentObjectID;	object.pId = window->id;	window->objects.insert(window->objects.begin(), object);	return window->currentObjectID;}int cGUI::ChangeWindowProperty( int prop, int id, int value ){	int windx;	for(int i = 0; i < windowLst.size(); ++i)	{		if(windowLst[i].id == id)		{			windx = i;			break;		}	}	switch(prop)	{	case GUI_PROP_VISIBLE:		{			windowLst[windx].visible=value;		}	}	return 1;}int cGUI::ChangeWindowProperty( int prop, int id, string value ){	return 1;}int cGUI::MouseUp( WPARAM param, int x, int y ){	bool itemFound = false;;	vector<Window>::iterator tempIterator;	tempIterator = windowLst.begin();	if( dragId != -1 || resizeId != -1)	{		dragId=-1;		resizeId=-1;		return 1;	}	for(int i = 0; i < windowLst.size(); ++i)	{		if(windowLst[i].visible)		{			if(x > windowLst[i].x && x < (windowLst[i].x + windowLst[i].width) && y > windowLst[i].y && y < (windowLst[i].y + windowLst[i].height))			{				itemFound=true;				for(int o = 0; o < windowLst[i].objects.size(); ++o)				{					if((x - windowLst[i].x) > windowLst[i].objects[o].x && (x - windowLst[i].x) < (windowLst[i].objects[o].x + windowLst[i].objects[o].width) && (y - windowLst[i].y) > windowLst[i].objects[o].y && (y - windowLst[i].y) < (windowLst[i].objects[o].y + windowLst[i].objects[o].height))					{						int ids = windowLst[i].objects[o].id;						windowLst[i].objects[o].cbFunc(cbParam(windowLst[i].objects[o].id, windowLst[i].id, GUI_OBJECT, GUI_MOUSEUP, &windowLst[i].objects[o]));						windowLst[i].activeObjID = windowLst[i].objects[o].id;						break;					}				}				windowLst[i].cbFunc(cbParam(windowLst[i].id, 0, GUI_WINDOW, GUI_MOUSEUP, NULL, &windowLst[i]));				MakeActive( windowLst[i].id, tempIterator );				break;			}		}		tempIterator++;	}	if(itemFound)		return 1;	else	{		// Nothing was clicked, so we set the activeObjId of the active window to -1 because the user clicked outside of all windows		windowLst[0].activeObjID = -1;		return 0;	}}int cGUI::MouseDown ( WPARAM param, int x, int y ){	return 0;}int cGUI::MouseMove( WPARAM param, int x, int y ){	vector<Window>::iterator tempIterator;	tempIterator = windowLst.begin();	for(int i = 0; i < windowLst.size(); ++i)	{		if(windowLst[i].visible)		{			if(dragId==windowLst[i].id)			{				windowLst[i].x = x - windowLst[i].dragX;				windowLst[i].y = y - windowLst[i].dragY;				MakeActive( windowLst[i].id, tempIterator );				break;			} else if ( resizeId == windowLst[i].id )			{				int newWidth, newHeight;				newWidth = x - windowLst[i].x;				newHeight = y - windowLst[i].y;				if(newWidth > windowLst[i].minWidth)					windowLst[i].width = newWidth;				if(newHeight > windowLst[i].minHeight)					windowLst[i].height = newHeight;								MakeActive( windowLst[i].id, tempIterator );				break;			}else if(param==MK_LBUTTON && dragId == -1 && resizeId == -1 && x > windowLst[i].x && x < (windowLst[i].x + windowLst[i].width) && y > windowLst[i].y && y < (windowLst[i].y + windowLst[i].height))			{				// Resize/Drag				int tmpX = windowLst[i].height;				if( x > (windowLst[i].x + windowLst[i].width - 40) && y > (windowLst[i].y + windowLst[i].height - 40))				{					// Resize					resizeId = windowLst[i].id;					windowLst[i].dragX = x - windowLst[i].x;					windowLst[i].dragY = y - windowLst[i].y;					MakeActive( windowLst[i].id, tempIterator );					windowLst[i].cbFunc(cbParam(windowLst[i].id, 0, GUI_WINDOW, GUI_RESIZE, NULL, &windowLst[i]));					break;				} else {					// Drag					dragId = windowLst[i].id;					windowLst[i].dragX = x - windowLst[i].x;					windowLst[i].dragY = y - windowLst[i].y;					MakeActive( windowLst[i].id, tempIterator );					if(windowLst[i].cbFunc!=NULL)						windowLst[i].cbFunc(cbParam(windowLst[i].id, 0, GUI_WINDOW, GUI_DRAG, NULL, &windowLst[i]));					break;				}			}						}		tempIterator = windowLst.begin() + i + 1;	}	return 1;}int cGUI::KeyUp(WPARAM param){	return 0;}int cGUI::KeyPress(WPARAM param){	if(param == 96)	// `/~	{		if(windowLst[GetIndex(GUI_WINDOW, consoleId)].visible)			windowLst[GetIndex(GUI_WINDOW, consoleId)].Hide();		else			windowLst[GetIndex(GUI_WINDOW, consoleId)].Show();	}	if(windowLst[0].activeObjID == -1)		return false;	int oIndex = GetIndex(GUI_OBJECT, windowLst[0].activeObjID, windowLst[0].id);	if(windowLst[0].objects[oIndex].type == GUI_OBJECT_TEXTBOX)		windowLst[0].objects[oIndex].textBox.value += param;	return 1;}int cGUI::MakeActive( int id, vector<Window>::iterator Iterator ){	// This MUST be the last item in a for loop because it will change the indexes	if(windowLst[0].id==id)		return 1;	windowLst[0].activeObjID = -1;	Window tmpWnd = windowLst[GetIndex(GUI_WINDOW, id)];	windowLst.erase(Iterator);	windowLst.insert(windowLst.begin(), tmpWnd);	return 1;}int cGUI::GetIndex(int type, int id, int pID){	// Returns -1 if somethign is wrong.	// Careful with this function, don't get the value and store it for later use, because this changes often	if(type==GUI_OBJECT)	{		if(pID == -1)			return -1;		int pIndex = GetIndex(GUI_WINDOW, pID);		for(int i = 0; i < windowLst[pIndex].objects.size(); i++)		{			if(windowLst[pIndex].objects[i].id == id)				return i;		}	} else if(type==GUI_WINDOW)	{		for(int w = 0; w < windowLst.size(); w++)		{			if(windowLst[w].id == id)				return w;		}	}}Object *cGUI::GetObjectPointer(int id, int pId){	return &windowLst[GetIndex(GUI_WINDOW, pId)].objects[GetIndex(GUI_OBJECT, id, pId)];}Window *cGUI::GetWindowPointer(int id){	return &windowLst[GetIndex(GUI_WINDOW, id)];}/////////////////////////////////////////////////////// setVertexFormat//  This function is internal and is meant to provide an easy way to switch between a textured// vertex format and a color based one.int cGUI::setVertexFormat(int format){	switch(format)	{		case GUI_FORMAT_TEXTURED:			{				g3D->changeVertexFormat( texturedVertexFormatIndex );				g3D->changeVertexBuffer( texturedVertexBufferIndex );				break;			}		case GUI_FORMAT_COLOR:			{				g3D->changeVertexFormat( coloredVertexFormatIndex );				g3D->changeVertexBuffer( coloredVertexBufferIndex );				break;			}	}	return 1;}/////////////////////////////////////////////////////// setVertexBufferColor//  This function allows you to change the color of a vertex buffer, though it MUST be of the// type 'color_vertex_format'!!!int cGUI::setVertexBufferColor(color_vertex_format *bufferIndex, int color){	// Colored Vertex setup	// Top Left					coloredVertexList[0].color = color;	// Bottom Left					coloredVertexList[1].color = color;	// Bottom Right					coloredVertexList[2].color = color;	// Bottom Right					coloredVertexList[3].color = color;	// Top Right	coloredVertexList[4].color = color;	// Top Left					coloredVertexList[5].color = color;	//coloredVertexBufferIndex = g3D->addVertexBuffer( sizeof( color_vertex_format ) * 6, coloredVertexList[0], SMS_VBO_STATIC );	return 1;}