aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIComponent_DebugUIConsole.cpp
blob: 7436d79604d2500f3d1662c5b3944427df5c19db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "stdafx.h"
#include "UI.h"
#include "UIComponent_DebugUIConsole.h"

UIComponent_DebugUIConsole::UIComponent_DebugUIConsole(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
	// Setup all the Iggy references we need for this scene
	initialiseMovie();

	m_bTextChanged = false;
}

wstring UIComponent_DebugUIConsole::getMoviePath()
{
	return L"DebugUIConsoleComponent";
}

void UIComponent_DebugUIConsole::tick()
{
	UIScene::tick();
	if(m_bTextChanged)
	{
		m_bTextChanged = false;
		for(unsigned int i = 0; i < 10 && i < m_textList.size(); ++i)
		{
			m_labels[i].setLabel(m_textList[i]);
		}
	}
}

void UIComponent_DebugUIConsole::addText(const string &text)
{
	if(!text.empty() && text.compare("\n") != 0)
	{
		if(m_textList.size() >= 10) m_textList.pop_front();
		m_textList.push_back(text);
		m_bTextChanged = true;
	}
}