mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Finished implementing keyboard
This commit is contained in:
parent
540e33d787
commit
f189d1e3bd
|
|
@ -327,7 +327,15 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
|
||||||
void UIScene_AnvilMenu::handleEditNamePressed()
|
void UIScene_AnvilMenu::handleEditNamePressed()
|
||||||
{
|
{
|
||||||
setIgnoreInput(true);
|
setIgnoreInput(true);
|
||||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
#ifdef _WINDOWS64
|
||||||
|
KeyboardInitData kbData;
|
||||||
|
kbData.title = app.GetString(IDS_TITLE_RENAME);
|
||||||
|
kbData.initialText = m_textInputAnvil.getLabel();
|
||||||
|
kbData.charLimit = 30;
|
||||||
|
kbData.lpParam = this;
|
||||||
|
kbData.Func = &UIScene_AnvilMenu::KeyboardCompleteCallbackNew;
|
||||||
|
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||||
|
#elif defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||||
int language = XGetLanguage();
|
int language = XGetLanguage();
|
||||||
switch(language)
|
switch(language)
|
||||||
{
|
{
|
||||||
|
|
@ -346,6 +354,21 @@ void UIScene_AnvilMenu::handleEditNamePressed()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int UIScene_AnvilMenu::KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted)
|
||||||
|
{
|
||||||
|
UIScene_AnvilMenu *pClass = (UIScene_AnvilMenu *)lpParam;
|
||||||
|
pClass->setIgnoreInput(false);
|
||||||
|
if(bAccepted)
|
||||||
|
{
|
||||||
|
pClass->setEditNameValue(text);
|
||||||
|
pClass->m_itemName = text;
|
||||||
|
pClass->updateItemName();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void UIScene_AnvilMenu::setEditNameValue(const wstring &name)
|
void UIScene_AnvilMenu::setEditNameValue(const wstring &name)
|
||||||
{
|
{
|
||||||
m_textInputAnvil.setLabel(name);
|
m_textInputAnvil.setLabel(name);
|
||||||
|
|
@ -357,6 +380,8 @@ void UIScene_AnvilMenu::setEditNameEditable(bool enabled)
|
||||||
|
|
||||||
void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
||||||
{
|
{
|
||||||
|
if(!getMovie()) return;
|
||||||
|
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
IggyDataValue value[2];
|
IggyDataValue value[2];
|
||||||
|
|
||||||
|
|
@ -373,6 +398,8 @@ void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
||||||
|
|
||||||
void UIScene_AnvilMenu::showCross(bool show)
|
void UIScene_AnvilMenu::showCross(bool show)
|
||||||
{
|
{
|
||||||
|
if(!getMovie()) return;
|
||||||
|
|
||||||
if(m_showingCross != show)
|
if(m_showingCross != show)
|
||||||
{
|
{
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "UIScene_AbstractContainerMenu.h"
|
#include "UIScene_AbstractContainerMenu.h"
|
||||||
#include "IUIScene_AnvilMenu.h"
|
#include "IUIScene_AnvilMenu.h"
|
||||||
|
#include "UIStructs.h"
|
||||||
#include "..\Minecraft.World\MerchantMenu.h"
|
#include "..\Minecraft.World\MerchantMenu.h"
|
||||||
|
|
||||||
class InventoryMenu;
|
class InventoryMenu;
|
||||||
|
|
@ -55,7 +56,10 @@ protected:
|
||||||
|
|
||||||
virtual UIControl *getSection(ESceneSection eSection);
|
virtual UIControl *getSection(ESceneSection eSection);
|
||||||
|
|
||||||
static int KeyboardCompleteCallback(LPVOID lpParam,bool bRes);
|
static int KeyboardCompleteCallback(LPVOID lpParam, const bool bRes);
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
static int KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
virtual void handleEditNamePressed();
|
virtual void handleEditNamePressed();
|
||||||
virtual void setEditNameValue(const wstring &name);
|
virtual void setEditNameValue(const wstring &name);
|
||||||
virtual void setEditNameEditable(bool enabled);
|
virtual void setEditNameEditable(bool enabled);
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,17 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
|
||||||
case eControl_EditWorldName:
|
case eControl_EditWorldName:
|
||||||
{
|
{
|
||||||
m_bIgnoreInput=true;
|
m_bIgnoreInput=true;
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
KeyboardInitData kbData;
|
||||||
|
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD);
|
||||||
|
kbData.initialText = m_worldName;
|
||||||
|
kbData.charLimit = 25;
|
||||||
|
kbData.lpParam = this;
|
||||||
|
kbData.Func = &UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallbackNew;
|
||||||
|
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||||
|
#else
|
||||||
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
|
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eControl_GameModeToggle:
|
case eControl_GameModeToggle:
|
||||||
|
|
@ -488,7 +498,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
|
||||||
|
|
||||||
if(pTexturePack==NULL)
|
if(pTexturePack==NULL)
|
||||||
{
|
{
|
||||||
#if TO_BE_IMPLEMENTED
|
#if TO_BE IMPLEMENTED
|
||||||
// They've selected a texture pack they don't have yet
|
// They've selected a texture pack they don't have yet
|
||||||
// upsell
|
// upsell
|
||||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||||
|
|
@ -712,11 +722,15 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern char chGlobalText[256];
|
||||||
|
|
||||||
void UIScene_CreateWorldMenu::handleGainFocus(bool navBack)
|
void UIScene_CreateWorldMenu::handleGainFocus(bool navBack)
|
||||||
{
|
{
|
||||||
if(navBack)
|
if(navBack)
|
||||||
{
|
{
|
||||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||||
|
|
||||||
|
m_bIgnoreInput = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -742,6 +756,23 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted)
|
||||||
|
{
|
||||||
|
UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)lpParam;
|
||||||
|
pClass->m_bIgnoreInput = false;
|
||||||
|
|
||||||
|
if(bAccepted && !text.empty())
|
||||||
|
{
|
||||||
|
pClass->m_editWorldName.setLabel(text.c_str());
|
||||||
|
pClass->m_worldName = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
pClass->m_buttonCreateWorld.setEnable(!pClass->m_worldName.empty());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
||||||
{
|
{
|
||||||
int primaryPad = ProfileManager.GetPrimaryPad();
|
int primaryPad = ProfileManager.GetPrimaryPad();
|
||||||
|
|
@ -778,7 +809,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
||||||
// 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK
|
// 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_OK;
|
uiIDA[0]=IDS_OK;
|
||||||
ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive);
|
ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -962,7 +993,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
||||||
// On Windows64, Xbox Live is unavailable. Skip QuadrantSignin and start directly.
|
// On Windows64, Xbox Live is unavailable. Skip QuadrantSignin and start directly.
|
||||||
CreateGame(this, 0);
|
CreateGame(this, 0);
|
||||||
#else
|
#else
|
||||||
//ProfileManager.RequestSignInUI(false, false, false, true, false,&CScene_MultiGameCreate::StartGame_SignInReturned, this,ProfileManager.GetPrimaryPad());
|
//ProfileManager.RequestSignInUI(false, false, false, true, false,&UIScene_CreateWorldMenu::StartGame_SignInReturned, this,ProfileManager.GetPrimaryPad());
|
||||||
SignInInfo info;
|
SignInInfo info;
|
||||||
info.Func = &UIScene_CreateWorldMenu::StartGame_SignInReturned;
|
info.Func = &UIScene_CreateWorldMenu::StartGame_SignInReturned;
|
||||||
info.lpParam = this;
|
info.lpParam = this;
|
||||||
|
|
@ -1077,7 +1108,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// random
|
// random
|
||||||
wSeed=L"";
|
wSeed=L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the game
|
// start the game
|
||||||
|
|
|
||||||
|
|
@ -67,39 +67,42 @@ public:
|
||||||
|
|
||||||
virtual void handleTouchBoxRebuild();
|
virtual void handleTouchBoxRebuild();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// TODO: This should be pure virtual in this class
|
// TODO: This should be pure virtual in this class
|
||||||
virtual wstring getMoviePath();
|
virtual wstring getMoviePath();
|
||||||
|
|
||||||
virtual void handleTimerComplete(int id);
|
virtual void handleTimerComplete(int id);
|
||||||
virtual void handleGainFocus(bool navBack);
|
virtual void handleGainFocus(bool navBack);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// INPUT
|
// INPUT
|
||||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void StartSharedLaunchFlow();
|
void StartSharedLaunchFlow();
|
||||||
bool IsLocalMultiplayerAvailable();
|
bool IsLocalMultiplayerAvailable();
|
||||||
|
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
|
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes);
|
static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes);
|
||||||
void handlePress(F64 controlId, F64 childId);
|
#ifdef _WINDOWS64
|
||||||
void handleSliderMove(F64 sliderId, F64 currentValue);
|
static int KeyboardCompleteWorldNameCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
static void CreateGame(UIScene_CreateWorldMenu* pClass, DWORD dwLocalUsersMask);
|
void handlePress(F64 controlId, F64 childId);
|
||||||
static int ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
void handleSliderMove(F64 sliderId, F64 currentValue);
|
||||||
static int StartGame_SignInReturned(void *pParam,bool bContinue, int iPad);
|
|
||||||
static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
static void CreateGame(UIScene_CreateWorldMenu* pClass, DWORD dwLocalUsersMask);
|
||||||
|
static int ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
|
static int StartGame_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||||
|
static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
|
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
//static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
//static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
static int ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
static int ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void checkStateAndStartGame();
|
virtual void checkStateAndStartGame();
|
||||||
};
|
};
|
||||||
|
|
@ -112,8 +112,20 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
|
||||||
case eControl_EndX:
|
case eControl_EndX:
|
||||||
case eControl_EndY:
|
case eControl_EndY:
|
||||||
case eControl_EndZ:
|
case eControl_EndZ:
|
||||||
m_keyboardCallbackControl = (eControls)((int)controlId);
|
m_keyboardCallbackControl = (eControls)((int)controlId);
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
{
|
||||||
|
KeyboardInitData kbData;
|
||||||
|
kbData.title = L"Enter something";
|
||||||
|
kbData.initialText = L"";
|
||||||
|
kbData.charLimit = 25;
|
||||||
|
kbData.lpParam = this;
|
||||||
|
kbData.Func = &UIScene_DebugCreateSchematic::KeyboardCompleteCallbackNew;
|
||||||
|
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||||
|
}
|
||||||
|
#else
|
||||||
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -213,4 +225,53 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int UIScene_DebugCreateSchematic::KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted)
|
||||||
|
{
|
||||||
|
UIScene_DebugCreateSchematic *pClass = (UIScene_DebugCreateSchematic *)lpParam;
|
||||||
|
if(!text.empty())
|
||||||
|
{
|
||||||
|
int iVal = _fromString<int>(text);
|
||||||
|
switch(pClass->m_keyboardCallbackControl)
|
||||||
|
{
|
||||||
|
case eControl_Name:
|
||||||
|
pClass->m_textInputName.setLabel(text.c_str());
|
||||||
|
swprintf(pClass->m_data->name, 64, L"%ls", text.c_str());
|
||||||
|
break;
|
||||||
|
case eControl_StartX:
|
||||||
|
pClass->m_textInputStartX.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->startX = iVal;
|
||||||
|
break;
|
||||||
|
case eControl_StartY:
|
||||||
|
pClass->m_textInputStartY.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->startY = iVal;
|
||||||
|
break;
|
||||||
|
case eControl_StartZ:
|
||||||
|
pClass->m_textInputStartZ.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->startZ = iVal;
|
||||||
|
break;
|
||||||
|
case eControl_EndX:
|
||||||
|
pClass->m_textInputEndX.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->endX = iVal;
|
||||||
|
break;
|
||||||
|
case eControl_EndY:
|
||||||
|
pClass->m_textInputEndY.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->endY = iVal;
|
||||||
|
break;
|
||||||
|
case eControl_EndZ:
|
||||||
|
pClass->m_textInputEndZ.setLabel(text.c_str());
|
||||||
|
if(iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||||
|
pClass->m_data->endZ = iVal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -68,6 +68,9 @@ protected:
|
||||||
virtual void handleCheckboxToggled(F64 controlId, bool selected);
|
virtual void handleCheckboxToggled(F64 controlId, bool selected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
|
static int KeyboardCompleteCallback(LPVOID lpParam, const bool bRes);
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
static int KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,19 +1,28 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIScene_Keyboard.h"
|
#include "UIScene_Keyboard.h"
|
||||||
|
#include "..\..\Tesselator.h"
|
||||||
|
|
||||||
#define KEYBOARD_DONE_TIMER_ID 0
|
#define KEYBOARD_DONE_TIMER_ID 0
|
||||||
#define KEYBOARD_DONE_TIMER_TIME 100
|
#define KEYBOARD_DONE_TIMER_TIME 100
|
||||||
|
|
||||||
|
extern char chGlobalText[256];
|
||||||
|
|
||||||
UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||||
{
|
{
|
||||||
// Setup all the Iggy references we need for this scene
|
// Setup all the Iggy references we need for this scene
|
||||||
initialiseMovie();
|
initialiseMovie();
|
||||||
|
|
||||||
m_EnterTextLabel.init(L"Enter Sign Text");
|
if (initData != NULL)
|
||||||
|
{
|
||||||
|
m_initData = *((KeyboardInitData *)initData);
|
||||||
|
}
|
||||||
|
|
||||||
m_KeyboardTextInput.init(L"", -1);
|
wstring labelText = m_initData.title.empty() ? L"Enter Text" : m_initData.title;
|
||||||
m_KeyboardTextInput.SetCharLimit(15);
|
m_EnterTextLabel.init(labelText);
|
||||||
|
|
||||||
|
m_KeyboardTextInput.init(m_initData.initialText.empty() ? L"" : m_initData.initialText, -1);
|
||||||
|
m_KeyboardTextInput.SetCharLimit(m_initData.charLimit > 0 ? m_initData.charLimit : 15);
|
||||||
|
|
||||||
m_ButtonSpace.init(L"Space", -1);
|
m_ButtonSpace.init(L"Space", -1);
|
||||||
m_ButtonCursorLeft.init(L"Cursor Left", -1);
|
m_ButtonCursorLeft.init(L"Cursor Left", -1);
|
||||||
|
|
@ -90,6 +99,12 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed,
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case ACTION_MENU_CANCEL:
|
case ACTION_MENU_CANCEL:
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
if(m_initData.Func != NULL)
|
||||||
|
{
|
||||||
|
m_initData.Func(m_initData.lpParam, L"", false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
navigateBack();
|
navigateBack();
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -176,6 +191,41 @@ void UIScene_Keyboard::KeyboardDonePressed()
|
||||||
// Debug
|
// Debug
|
||||||
app.DebugPrintf("UI Keyboard - DONE - [%ls]\n", m_KeyboardTextInput.getLabel());
|
app.DebugPrintf("UI Keyboard - DONE - [%ls]\n", m_KeyboardTextInput.getLabel());
|
||||||
|
|
||||||
// ToDo: Keyboard can now pass on its final string value and close itself down
|
// Capture the final string value from the keyboard text input
|
||||||
|
m_capturedText = m_KeyboardTextInput.getLabel();
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
// Invoke the callback if one was provided
|
||||||
|
if(m_initData.Func != NULL)
|
||||||
|
{
|
||||||
|
m_initData.Func(m_initData.lpParam, m_capturedText, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
navigateBack();
|
navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIScene_Keyboard::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||||
|
{
|
||||||
|
ui.setupRenderPosition(viewport);
|
||||||
|
|
||||||
|
// Draw a semi transparent dark overlay behind the keyboard
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
Tesselator *t = Tesselator::getInstance();
|
||||||
|
t->begin();
|
||||||
|
t->vertex(0.0f, (float)height, 0.0f);
|
||||||
|
t->vertex((float)width, (float)height, 0.0f);
|
||||||
|
t->vertex((float)width, 0.0f, 0.0f);
|
||||||
|
t->vertex(0.0f, 0.0f, 0.0f);
|
||||||
|
t->end();
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
UIScene::render(width, height, viewport);
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "UIScene.h"
|
#include "UIScene.h"
|
||||||
|
#include "UIStructs.h"
|
||||||
|
|
||||||
class UIScene_Keyboard : public UIScene
|
class UIScene_Keyboard : public UIScene
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool m_bKeyboardDonePressed;
|
bool m_bKeyboardDonePressed;
|
||||||
|
KeyboardInitData m_initData;
|
||||||
|
wstring m_capturedText;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UIControl_Label m_EnterTextLabel;
|
UIControl_Label m_EnterTextLabel;
|
||||||
|
|
@ -58,22 +61,25 @@ protected:
|
||||||
// TODO: This should be pure virtual in this class
|
// TODO: This should be pure virtual in this class
|
||||||
virtual wstring getMoviePath();
|
virtual wstring getMoviePath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void KeyboardDonePressed();
|
void KeyboardDonePressed();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual EUIScene getSceneType() { return eUIScene_Keyboard;}
|
virtual EUIScene getSceneType() { return eUIScene_Keyboard;}
|
||||||
|
|
||||||
// Returns true if this scene handles input
|
// RENDERING
|
||||||
//virtual bool stealsFocus() { return false; }
|
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||||
|
|
||||||
// Returns true if this scene has focus for the pad passed in
|
// Returns true if this scene handles input
|
||||||
//virtual bool hasFocus(int iPad) { return false; }
|
//virtual bool stealsFocus() { return false; }
|
||||||
// Returns true if this scene has focus for the pad passed in
|
|
||||||
|
// Returns true if this scene has focus for the pad passed in
|
||||||
|
//virtual bool hasFocus(int iPad) { return false; }
|
||||||
|
// Returns true if this scene has focus for the pad passed in
|
||||||
#ifndef __PS3__
|
#ifndef __PS3__
|
||||||
virtual bool hasFocus(int iPad) { return bHasFocus; }
|
virtual bool hasFocus(int iPad) { return bHasFocus; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
|
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
|
||||||
virtual bool hidesLowerScenes() { return false; }
|
virtual bool hidesLowerScenes() { return true; }
|
||||||
};
|
};
|
||||||
|
|
@ -573,7 +573,15 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
|
||||||
case eControl_EditSeed:
|
case eControl_EditSeed:
|
||||||
{
|
{
|
||||||
m_bIgnoreInput=true;
|
m_bIgnoreInput=true;
|
||||||
#ifdef __PS3__
|
#ifdef _WINDOWS64
|
||||||
|
KeyboardInitData kbData;
|
||||||
|
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD_SEED);
|
||||||
|
kbData.initialText = m_editSeed.getLabel();
|
||||||
|
kbData.charLimit = 60;
|
||||||
|
kbData.lpParam = this;
|
||||||
|
kbData.Func = &UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallbackNew;
|
||||||
|
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||||
|
#elif defined(__PS3__)
|
||||||
int language = XGetLanguage();
|
int language = XGetLanguage();
|
||||||
switch(language)
|
switch(language)
|
||||||
{
|
{
|
||||||
|
|
@ -595,6 +603,19 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted)
|
||||||
|
{
|
||||||
|
UIScene_LaunchMoreOptionsMenu *pClass = (UIScene_LaunchMoreOptionsMenu *)lpParam;
|
||||||
|
pClass->m_bIgnoreInput = false;
|
||||||
|
if(bAccepted)
|
||||||
|
{
|
||||||
|
pClass->m_editSeed.setLabel(text.c_str());
|
||||||
|
pClass->m_params->seed = text;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue)
|
void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "UIScene.h"
|
#include "UIScene.h"
|
||||||
|
#include "UIStructs.h"
|
||||||
|
|
||||||
class UIScene_LaunchMoreOptionsMenu : public UIScene
|
class UIScene_LaunchMoreOptionsMenu : public UIScene
|
||||||
{
|
{
|
||||||
|
|
@ -145,6 +146,9 @@ public:
|
||||||
virtual void handleFocusChange(F64 controlId, F64 childId);
|
virtual void handleFocusChange(F64 controlId, F64 childId);
|
||||||
virtual void handleTimerComplete(int id);
|
virtual void handleTimerComplete(int id);
|
||||||
static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes);
|
static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes);
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
static int KeyboardCompleteSeedCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
virtual void handlePress(F64 controlId, F64 childId);
|
virtual void handlePress(F64 controlId, F64 childId);
|
||||||
virtual void handleSliderMove(F64 sliderId, F64 currentValue);
|
virtual void handleSliderMove(F64 sliderId, F64 currentValue);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,15 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
||||||
{
|
{
|
||||||
m_iEditingLine = (int)controlId;
|
m_iEditingLine = (int)controlId;
|
||||||
m_bIgnoreInput = true;
|
m_bIgnoreInput = true;
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _WINDOWS64
|
||||||
|
KeyboardInitData kbData;
|
||||||
|
kbData.title = app.GetString(IDS_SIGN_TITLE);
|
||||||
|
kbData.initialText = m_textInputLines[m_iEditingLine].getLabel();
|
||||||
|
kbData.charLimit = 15;
|
||||||
|
kbData.lpParam = this;
|
||||||
|
kbData.Func = &UIScene_SignEntryMenu::KeyboardCompleteCallbackNew;
|
||||||
|
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
|
||||||
|
#elif defined(_XBOX_ONE)
|
||||||
// 4J-PB - Xbox One uses the Windows virtual keyboard, and doesn't have the Xbox 360 Latin keyboard type, so we can't restrict the input set to alphanumeric. The closest we get is the emailSmtpAddress type.
|
// 4J-PB - Xbox One uses the Windows virtual keyboard, and doesn't have the Xbox 360 Latin keyboard type, so we can't restrict the input set to alphanumeric. The closest we get is the emailSmtpAddress type.
|
||||||
int language = XGetLanguage();
|
int language = XGetLanguage();
|
||||||
switch(language)
|
switch(language)
|
||||||
|
|
@ -193,6 +201,19 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int UIScene_SignEntryMenu::KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted)
|
||||||
|
{
|
||||||
|
UIScene_SignEntryMenu *pClass = (UIScene_SignEntryMenu *)lpParam;
|
||||||
|
pClass->m_bIgnoreInput = false;
|
||||||
|
if(bAccepted)
|
||||||
|
{
|
||||||
|
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(text.c_str());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void UIScene_SignEntryMenu::handleDestroy()
|
void UIScene_SignEntryMenu::handleDestroy()
|
||||||
{
|
{
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "UIScene.h"
|
#include "UIScene.h"
|
||||||
|
#include "UIStructs.h"
|
||||||
|
|
||||||
class SignTileEntity;
|
class SignTileEntity;
|
||||||
|
|
||||||
|
|
@ -54,5 +55,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void handlePress(F64 controlId, F64 childId);
|
void handlePress(F64 controlId, F64 childId);
|
||||||
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
|
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
static int KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
virtual void handleDestroy();
|
virtual void handleDestroy();
|
||||||
};
|
};
|
||||||
|
|
@ -422,6 +422,27 @@ typedef struct _SignInInfo
|
||||||
bool requireOnline;
|
bool requireOnline;
|
||||||
} SignInInfo;
|
} SignInInfo;
|
||||||
|
|
||||||
|
// Keyboard
|
||||||
|
typedef struct _KeyboardInitData
|
||||||
|
{
|
||||||
|
wstring initialText;
|
||||||
|
wstring title;
|
||||||
|
int charLimit;
|
||||||
|
LPVOID lpParam;
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
int( *Func)(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_KeyboardInitData()
|
||||||
|
{
|
||||||
|
charLimit = 25;
|
||||||
|
lpParam = NULL;
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
Func = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} KeyboardInitData;
|
||||||
|
|
||||||
// Credits
|
// Credits
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ void KeyboardMouseInput::OnKeyDown(WPARAM vk)
|
||||||
{
|
{
|
||||||
if (vk < 256)
|
if (vk < 256)
|
||||||
{
|
{
|
||||||
if (!m_keyState[vk]) m_keyPressedAccum[vk] = true;
|
|
||||||
m_keyState[vk] = true;
|
m_keyState[vk] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -103,12 +102,9 @@ void KeyboardMouseInput::OnRawMouseInput(LPARAM lParam)
|
||||||
|
|
||||||
void KeyboardMouseInput::OnMouseButton(int button, bool down)
|
void KeyboardMouseInput::OnMouseButton(int button, bool down)
|
||||||
{
|
{
|
||||||
if (button >= 0 && button < 3)
|
if (button < 0 || button >= 3) return;
|
||||||
{
|
|
||||||
if (down && !m_mouseButtons[button]) m_mousePressedAccum[button] = true;
|
m_mouseButtons[button] = down;
|
||||||
if (!down && m_mouseButtons[button]) m_mouseReleasedAccum[button] = true;
|
|
||||||
m_mouseButtons[button] = down;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyboardMouseInput::OnMouseWheel(int delta)
|
void KeyboardMouseInput::OnMouseWheel(int delta)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Minecraft.cpp : Defines the entry point for the application.
|
// Minecraft.cpp : Defines the entry point for the application.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
@ -512,17 +512,31 @@ void ClearGlobalText()
|
||||||
uint16_t *GetGlobalText()
|
uint16_t *GetGlobalText()
|
||||||
{
|
{
|
||||||
//copy the ch text to ui16
|
//copy the ch text to ui16
|
||||||
char * pchBuffer=(char *)ui16GlobalText;
|
char * pchBuffer=(char *)ui16GlobalText;
|
||||||
for(int i=0;i<256;i++)
|
for(int i=0;i<256;i++)
|
||||||
{
|
{
|
||||||
pchBuffer[i*2]=chGlobalText[i];
|
pchBuffer[i*2]=chGlobalText[i];
|
||||||
}
|
}
|
||||||
return ui16GlobalText;
|
return ui16GlobalText;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeedEditBox()
|
void SeedEditBox()
|
||||||
{
|
{
|
||||||
DialogBox(hMyInst, MAKEINTRESOURCE(IDD_SEED),
|
KeyboardInitData kbData;
|
||||||
g_hWnd, reinterpret_cast<DLGPROC>(DlgProc));
|
|
||||||
|
kbData.title =
|
||||||
|
reinterpret_cast<wchar_t*>(chGlobalText);
|
||||||
|
|
||||||
|
kbData.initialText =
|
||||||
|
reinterpret_cast<wchar_t*>(chGlobalText);
|
||||||
|
|
||||||
|
kbData.charLimit = 25;
|
||||||
|
kbData.lpParam = nullptr;
|
||||||
|
|
||||||
|
ui.NavigateToScene(
|
||||||
|
ProfileManager.GetPrimaryPad(),
|
||||||
|
eUIScene_Keyboard,
|
||||||
|
&kbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue