the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 83 lines 2.1 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIControl_TextInput.h" 4 5UIControl_TextInput::UIControl_TextInput() 6{ 7 m_bHasFocus = false; 8} 9 10bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) 11{ 12 UIControl::setControlType(UIControl::eTextInput); 13 bool success = UIControl_Base::setupControl(scene,parent,controlName); 14 15 //TextInput specific initialisers 16 m_textName = registerFastName(L"text"); 17 m_funcChangeState = registerFastName(L"ChangeState"); 18 m_funcSetCharLimit = registerFastName(L"SetCharLimit"); 19 20 return success; 21} 22 23void UIControl_TextInput::init(UIString label, int id) 24{ 25 m_label = label; 26 m_id = id; 27 28 IggyDataValue result; 29 IggyDataValue value[2]; 30 value[0].type = IGGY_DATATYPE_string_UTF16; 31 IggyStringUTF16 stringVal; 32 33 stringVal.string = (IggyUTF16*)label.c_str(); 34 stringVal.length = label.length(); 35 value[0].string16 = stringVal; 36 37 value[1].type = IGGY_DATATYPE_number; 38 value[1].number = id; 39 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 2 , value ); 40 41 #ifdef __PSVITA__ 42 // 4J-TomK - add this buttonlist to the vita touch box list 43 44 switch(m_parentScene->GetParentLayer()->m_iLayer) 45 { 46 case eUILayer_Fullscreen: 47 case eUILayer_Scene: 48 case eUILayer_HUD: 49 ui.TouchBoxAdd(this,m_parentScene); 50 break; 51 } 52 #endif 53} 54 55void UIControl_TextInput::ReInit() 56{ 57 UIControl_Base::ReInit(); 58 59 init(m_label, m_id); 60} 61 62void UIControl_TextInput::setFocus(bool focus) 63{ 64 if(m_bHasFocus != focus) 65 { 66 m_bHasFocus = focus; 67 68 IggyDataValue result; 69 IggyDataValue value[1]; 70 value[0].type = IGGY_DATATYPE_number; 71 value[0].number = focus?0:1; 72 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value ); 73 } 74} 75 76void UIControl_TextInput::SetCharLimit(int iLimit) 77{ 78 IggyDataValue result; 79 IggyDataValue value[1]; 80 value[0].type = IGGY_DATATYPE_number; 81 value[0].number = iLimit; 82 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCharLimit , 1 , value ); 83}