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_HTMLLabel.h"
4
5UIControl_HTMLLabel::UIControl_HTMLLabel()
6{
7}
8
9bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
10{
11 UIControl::setControlType(UIControl::eHTMLLabel);
12 bool success = UIControl_Base::setupControl(scene,parent,controlName);
13
14 //Label specific initialisers
15 m_funcStartAutoScroll = registerFastName(L"StartAutoScroll");
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_HTMLLabel::startAutoScroll()
24{
25 IggyDataValue result;
26 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , NULL );
27}
28
29void UIControl_HTMLLabel::ReInit()
30{
31 UIControl_Base::ReInit();
32 // Don't set the label, HTML sizes will have changed. Let the scene update us.
33 init(L"");
34}
35
36void UIControl_HTMLLabel::setLabel(const string &label)
37{
38 IggyDataValue result;
39 IggyDataValue value[1];
40 value[0].type = IGGY_DATATYPE_string_UTF8;
41 IggyStringUTF8 stringVal;
42
43 stringVal.string = (char *) label.c_str();
44 stringVal.length = label.length();
45 value[0].string8 = stringVal;
46
47 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
48}
49
50void UIControl_HTMLLabel::SetupTouch()
51{
52 #ifdef __PSVITA__
53 // 4J-TomK - add this dynamic label to the vita touch box list
54
55 switch(m_parentScene->GetParentLayer()->m_iLayer)
56 {
57 case eUILayer_Fullscreen:
58 case eUILayer_Scene:
59 case eUILayer_HUD:
60 ui.TouchBoxAdd(this,m_parentScene);
61 break;
62 }
63 #endif
64}
65
66void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive)
67{
68 IggyDataValue result;
69 IggyDataValue value[2];
70
71 value[0].type = IGGY_DATATYPE_number;
72 value[0].number = iY;
73 value[1].type = IGGY_DATATYPE_boolean;
74 value[1].boolval = bActive;
75
76 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcTouchScroll, 2 , value );
77}
78
79S32 UIControl_HTMLLabel::GetRealWidth()
80{
81 IggyDataValue result;
82 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL );
83
84 S32 iRealWidth = m_width;
85 if(result.type == IGGY_DATATYPE_number)
86 {
87 iRealWidth = (S32)result.number;
88 }
89 return iRealWidth;
90}
91
92S32 UIControl_HTMLLabel::GetRealHeight()
93{
94 IggyDataValue result;
95 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL );
96
97 S32 iRealHeight = m_height;
98 if(result.type == IGGY_DATATYPE_number)
99 {
100 iRealHeight = (S32)result.number;
101 }
102 return iRealHeight;
103}