the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 109 lines 3.0 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIControl_CheckBox.h" 4 5UIControl_CheckBox::UIControl_CheckBox() 6{ 7} 8 9bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) 10{ 11 UIControl::setControlType(UIControl::eCheckBox); 12 bool success = UIControl_Base::setupControl(scene,parent,controlName); 13 14 //CheckBox specific initialisers 15 m_checkedProp = registerFastName(L"Checked"); 16 m_funcEnable = registerFastName(L"EnableCheckBox"); 17 m_funcSetCheckBox = registerFastName(L"SetCheckBox"); 18 19 m_bEnabled = true; 20 21 return success; 22} 23 24void UIControl_CheckBox::init(UIString label, int id, bool checked) 25{ 26 m_label = label; 27 m_id = id; 28 m_bChecked = checked; 29 30 IggyDataValue result; 31 IggyDataValue value[3]; 32 value[0].type = IGGY_DATATYPE_string_UTF16; 33 IggyStringUTF16 stringVal; 34 35 stringVal.string = (IggyUTF16*)label.c_str(); 36 stringVal.length = label.length(); 37 value[0].string16 = stringVal; 38 39 value[1].type = IGGY_DATATYPE_number; 40 value[1].number = (int)id; 41 42 value[2].type = IGGY_DATATYPE_boolean; 43 value[2].boolval = checked; 44 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 3 , value ); 45 46#ifdef __PSVITA__ 47 // 4J-TomK - add checkbox to the vita touch box list 48 49 switch(m_parentScene->GetParentLayer()->m_iLayer) 50 { 51 case eUILayer_Fullscreen: 52 case eUILayer_Scene: 53 case eUILayer_HUD: 54 ui.TouchBoxAdd(this,m_parentScene); 55 break; 56} 57#endif 58} 59 60bool UIControl_CheckBox::IsChecked() 61{ 62 rrbool checked = false; 63 IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, NULL, &checked ); 64 m_bChecked = checked; 65 return checked; 66} 67 68bool UIControl_CheckBox::IsEnabled() 69{ 70 return m_bEnabled; 71} 72 73void UIControl_CheckBox::SetEnable(bool enable) 74{ 75 m_bEnabled = enable; 76 77 IggyDataValue result; 78 IggyDataValue value[1]; 79 value[0].type = IGGY_DATATYPE_boolean; 80 value[0].boolval = enable; 81 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcEnable , 1 , value ); 82} 83 84// 4J HEG - this is only ever used when required, most of this should happen in the flash 85void UIControl_CheckBox::setChecked(bool checked) 86{ 87 IggyDataValue result; 88 IggyDataValue value[1]; 89 value[0].type = IGGY_DATATYPE_boolean; 90 value[0].boolval = checked; 91 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCheckBox , 1 , value ); 92} 93 94// 4J-TomK we need to trigger this one via function instead of key down event because of how it works 95void UIControl_CheckBox::TouchSetCheckbox(bool checked) 96{ 97 IggyDataValue result; 98 IggyDataValue value[1]; 99 value[0].type = IGGY_DATATYPE_boolean; 100 value[0].boolval = checked; 101 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCheckBox , 1 , value ); 102} 103 104void UIControl_CheckBox::ReInit() 105{ 106 UIControl_Base::ReInit(); 107 108 init(m_label, m_id, m_bChecked); 109}