view LightClone/Source/GuiInterface.cpp @ 18:33cb6979ac51

More work on GUI system
author koryspansel
date Wed, 14 Sep 2011 17:24:49 -0700
parents 4951acfe92fc
children 51718795f019
line wrap: on
line source

/*
 * GuiInterface
 */

#include "GuiInterface.h"

/*
 * GuiInterface
 */
GuiInterface::GuiInterface()
{
	pRoot = new GuiContainer();
}

/*
 * ~GuiInterface
 */
GuiInterface::~GuiInterface()
{
	delete pRoot;
	pRoot = NULL;
}

/*
 * Initialize
 */
ErrorCode GuiInterface::Initialize(ResourceManager* pResourceManager)
{
	return pRoot->Initialize(pResourceManager);
}

/*
 * Terminate
 */
void GuiInterface::Terminate()
{
	pRoot->Terminate();
}

/*
 * Update
 */
void GuiInterface::Update(float fElapsed)
{
	pRoot->Update(fElapsed);
}

/*
 * Render
 */
void GuiInterface::Render(RenderContext& kContext, Camera& kCamera)
{
	//TODO: Should I send the camera down the tree?  Ideally I would have a
	//		single VB for all UI quads, so really the interface could setup
	//		the camera and effect at this point.  May also need a wrapper
	//		around render context (GuiRenderContext)

	pRoot->Render(kContext, kCamera);
}

/*
 * Pick
 */
GuiElement* GuiInterface::Pick(float fX, float fY)
{
	return pRoot->Pick(fX, fY);
}

/*
 * GetRoot
 */
GuiContainer* GuiInterface::GetRoot()
{
	return pRoot;
}