the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "UI.h"
3#include "UIControl_DynamicLabel.h"
4
5UIControl_DynamicLabel::UIControl_DynamicLabel()
6{
7}
8
9bool UIControl_DynamicLabel::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
10{
11 UIControl::setControlType(UIControl::eDynamicLabel);
12 bool success = UIControl_Base::setupControl(scene,parent,controlName);
13
14 //Label specific initialisers
15 m_funcAddText = registerFastName(L"AddText");
16 m_funcTouchScroll = registerFastName(L"TouchScroll");
17 m_funcGetRealWidth = registerFastName(L"GetRealWidth");
18 m_funcGetRealHeight = registerFastName(L"GetRealHeight");
19
20 return success;
21}
22
23void UIControl_DynamicLabel::addText(const wstring &text, bool bLastEntry)
24{
25 IggyDataValue result;
26 IggyDataValue value[2];
27
28 IggyStringUTF16 stringVal;
29 stringVal.string = (IggyUTF16*)text.c_str();
30 stringVal.length = text.length();
31 value[0].type = IGGY_DATATYPE_string_UTF16;
32 value[0].string16 = stringVal;
33
34 value[1].type = IGGY_DATATYPE_boolean;
35 value[1].boolval = bLastEntry;
36
37 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcAddText , 2 , value );
38}
39
40void UIControl_DynamicLabel::ReInit()
41{
42 UIControl_Base::ReInit();
43}
44
45void UIControl_DynamicLabel::SetupTouch()
46{
47 #ifdef __PSVITA__
48 // 4J-TomK - add this dynamic label to the vita touch box list
49
50 switch(m_parentScene->GetParentLayer()->m_iLayer)
51 {
52 case eUILayer_Fullscreen:
53 case eUILayer_Scene:
54 case eUILayer_HUD:
55 ui.TouchBoxAdd(this,m_parentScene);
56 break;
57 }
58 #endif
59}
60
61void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive)
62{
63 IggyDataValue result;
64 IggyDataValue value[2];
65
66 value[0].type = IGGY_DATATYPE_number;
67 value[0].number = iY;
68 value[1].type = IGGY_DATATYPE_boolean;
69 value[1].boolval = bActive;
70
71 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcTouchScroll, 2 , value );
72}
73
74S32 UIControl_DynamicLabel::GetRealWidth()
75{
76 IggyDataValue result;
77 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL );
78
79 S32 iRealWidth = m_width;
80 if(result.type == IGGY_DATATYPE_number)
81 {
82 iRealWidth = (S32)result.number;
83 }
84 return iRealWidth;
85}
86
87S32 UIControl_DynamicLabel::GetRealHeight()
88{
89 IggyDataValue result;
90 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL );
91
92 S32 iRealHeight = m_height;
93 if(result.type == IGGY_DATATYPE_number)
94 {
95 iRealHeight = (S32)result.number;
96 }
97 return iRealHeight;
98}