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()
|
||||
{
|
||||
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();
|
||||
switch(language)
|
||||
{
|
||||
|
|
@ -346,6 +354,21 @@ void UIScene_AnvilMenu::handleEditNamePressed()
|
|||
#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)
|
||||
{
|
||||
m_textInputAnvil.setLabel(name);
|
||||
|
|
@ -357,6 +380,8 @@ void UIScene_AnvilMenu::setEditNameEditable(bool enabled)
|
|||
|
||||
void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
||||
{
|
||||
if(!getMovie()) return;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
|
|
@ -373,6 +398,8 @@ void UIScene_AnvilMenu::setCostLabel(const wstring &label, bool canAfford)
|
|||
|
||||
void UIScene_AnvilMenu::showCross(bool show)
|
||||
{
|
||||
if(!getMovie()) return;
|
||||
|
||||
if(m_showingCross != show)
|
||||
{
|
||||
IggyDataValue result;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "UIScene_AbstractContainerMenu.h"
|
||||
#include "IUIScene_AnvilMenu.h"
|
||||
#include "UIStructs.h"
|
||||
#include "..\Minecraft.World\MerchantMenu.h"
|
||||
|
||||
class InventoryMenu;
|
||||
|
|
@ -55,7 +56,10 @@ protected:
|
|||
|
||||
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 setEditNameValue(const wstring &name);
|
||||
virtual void setEditNameEditable(bool enabled);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,17 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_EditWorldName:
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case eControl_GameModeToggle:
|
||||
|
|
@ -488,7 +498,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
|
|||
|
||||
if(pTexturePack==NULL)
|
||||
{
|
||||
#if TO_BE_IMPLEMENTED
|
||||
#if TO_BE IMPLEMENTED
|
||||
// They've selected a texture pack they don't have yet
|
||||
// upsell
|
||||
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)
|
||||
{
|
||||
if(navBack)
|
||||
{
|
||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||
|
||||
m_bIgnoreInput = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -742,6 +756,23 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
|
|||
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()
|
||||
{
|
||||
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
|
||||
UINT uiIDA[1];
|
||||
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
|
||||
{
|
||||
|
|
@ -962,7 +993,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
|
|||
// On Windows64, Xbox Live is unavailable. Skip QuadrantSignin and start directly.
|
||||
CreateGame(this, 0);
|
||||
#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;
|
||||
info.Func = &UIScene_CreateWorldMenu::StartGame_SignInReturned;
|
||||
info.lpParam = this;
|
||||
|
|
@ -1077,7 +1108,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
|
|||
else
|
||||
{
|
||||
// random
|
||||
wSeed=L"";
|
||||
wSeed=L"";
|
||||
}
|
||||
|
||||
// start the game
|
||||
|
|
|
|||
|
|
@ -67,39 +67,42 @@ public:
|
|||
|
||||
virtual void handleTouchBoxRebuild();
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual wstring getMoviePath();
|
||||
|
||||
virtual void handleTimerComplete(int id);
|
||||
virtual void handleGainFocus(bool navBack);
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual wstring getMoviePath();
|
||||
|
||||
virtual void handleTimerComplete(int id);
|
||||
virtual void handleGainFocus(bool navBack);
|
||||
|
||||
public:
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
public:
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
|
||||
private:
|
||||
void StartSharedLaunchFlow();
|
||||
bool IsLocalMultiplayerAvailable();
|
||||
private:
|
||||
void StartSharedLaunchFlow();
|
||||
bool IsLocalMultiplayerAvailable();
|
||||
|
||||
#ifdef _DURANGO
|
||||
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
|
||||
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes);
|
||||
void handlePress(F64 controlId, F64 childId);
|
||||
void handleSliderMove(F64 sliderId, F64 currentValue);
|
||||
|
||||
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);
|
||||
protected:
|
||||
static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes);
|
||||
#ifdef _WINDOWS64
|
||||
static int KeyboardCompleteWorldNameCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||
#endif
|
||||
void handlePress(F64 controlId, F64 childId);
|
||||
void handleSliderMove(F64 sliderId, F64 currentValue);
|
||||
|
||||
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__
|
||||
//static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ContinueOffline(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);
|
||||
#endif
|
||||
|
||||
virtual void checkStateAndStartGame();
|
||||
virtual void checkStateAndStartGame();
|
||||
};
|
||||
|
|
@ -112,8 +112,20 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_EndX:
|
||||
case eControl_EndY:
|
||||
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);
|
||||
#endif
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
@ -213,4 +225,53 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b
|
|||
|
||||
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
|
||||
|
|
@ -68,6 +68,9 @@ protected:
|
|||
virtual void handleCheckboxToggled(F64 controlId, bool selected);
|
||||
|
||||
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
|
||||
|
|
@ -1,19 +1,28 @@
|
|||
#include "stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "UIScene_Keyboard.h"
|
||||
#include "..\..\Tesselator.h"
|
||||
|
||||
#define KEYBOARD_DONE_TIMER_ID 0
|
||||
#define KEYBOARD_DONE_TIMER_TIME 100
|
||||
|
||||
extern char chGlobalText[256];
|
||||
|
||||
UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_EnterTextLabel.init(L"Enter Sign Text");
|
||||
if (initData != NULL)
|
||||
{
|
||||
m_initData = *((KeyboardInitData *)initData);
|
||||
}
|
||||
|
||||
m_KeyboardTextInput.init(L"", -1);
|
||||
m_KeyboardTextInput.SetCharLimit(15);
|
||||
wstring labelText = m_initData.title.empty() ? L"Enter Text" : m_initData.title;
|
||||
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_ButtonCursorLeft.init(L"Cursor Left", -1);
|
||||
|
|
@ -90,6 +99,12 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed,
|
|||
switch(key)
|
||||
{
|
||||
case ACTION_MENU_CANCEL:
|
||||
#ifdef _WINDOWS64
|
||||
if(m_initData.Func != NULL)
|
||||
{
|
||||
m_initData.Func(m_initData.lpParam, L"", false);
|
||||
}
|
||||
#endif
|
||||
navigateBack();
|
||||
handled = true;
|
||||
break;
|
||||
|
|
@ -176,6 +191,41 @@ void UIScene_Keyboard::KeyboardDonePressed()
|
|||
// Debug
|
||||
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();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "UIStructs.h"
|
||||
|
||||
class UIScene_Keyboard : public UIScene
|
||||
{
|
||||
private:
|
||||
bool m_bKeyboardDonePressed;
|
||||
KeyboardInitData m_initData;
|
||||
wstring m_capturedText;
|
||||
|
||||
protected:
|
||||
UIControl_Label m_EnterTextLabel;
|
||||
|
|
@ -58,22 +61,25 @@ protected:
|
|||
// TODO: This should be pure virtual in this class
|
||||
virtual wstring getMoviePath();
|
||||
|
||||
private:
|
||||
void KeyboardDonePressed();
|
||||
private:
|
||||
void KeyboardDonePressed();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIScene_Keyboard;}
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIScene_Keyboard;}
|
||||
|
||||
// Returns true if this scene handles input
|
||||
//virtual bool stealsFocus() { return false; }
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
|
||||
// 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
|
||||
// Returns true if this scene handles input
|
||||
//virtual bool stealsFocus() { return false; }
|
||||
|
||||
// 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__
|
||||
virtual bool hasFocus(int iPad) { return bHasFocus; }
|
||||
#endif
|
||||
|
||||
// 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; }
|
||||
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
|
||||
virtual bool hidesLowerScenes() { return true; }
|
||||
};
|
||||
|
|
@ -573,7 +573,15 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId)
|
|||
case eControl_EditSeed:
|
||||
{
|
||||
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();
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "UIStructs.h"
|
||||
|
||||
class UIScene_LaunchMoreOptionsMenu : public UIScene
|
||||
{
|
||||
|
|
@ -145,6 +146,9 @@ public:
|
|||
virtual void handleFocusChange(F64 controlId, F64 childId);
|
||||
virtual void handleTimerComplete(int id);
|
||||
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 handleSliderMove(F64 sliderId, F64 currentValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,15 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId)
|
|||
{
|
||||
m_iEditingLine = (int)controlId;
|
||||
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.
|
||||
int language = XGetLanguage();
|
||||
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()
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "UIStructs.h"
|
||||
|
||||
class SignTileEntity;
|
||||
|
||||
|
|
@ -54,5 +55,8 @@ public:
|
|||
protected:
|
||||
void handlePress(F64 controlId, F64 childId);
|
||||
static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes);
|
||||
#ifdef _WINDOWS64
|
||||
static int KeyboardCompleteCallbackNew(LPVOID lpParam, const wstring &text, bool bAccepted);
|
||||
#endif
|
||||
virtual void handleDestroy();
|
||||
};
|
||||
|
|
@ -422,6 +422,27 @@ typedef struct _SignInInfo
|
|||
bool requireOnline;
|
||||
} 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
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ void KeyboardMouseInput::OnKeyDown(WPARAM vk)
|
|||
{
|
||||
if (vk < 256)
|
||||
{
|
||||
if (!m_keyState[vk]) m_keyPressedAccum[vk] = true;
|
||||
m_keyState[vk] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,12 +102,9 @@ void KeyboardMouseInput::OnRawMouseInput(LPARAM lParam)
|
|||
|
||||
void KeyboardMouseInput::OnMouseButton(int button, bool down)
|
||||
{
|
||||
if (button >= 0 && button < 3)
|
||||
{
|
||||
if (down && !m_mouseButtons[button]) m_mousePressedAccum[button] = true;
|
||||
if (!down && m_mouseButtons[button]) m_mouseReleasedAccum[button] = true;
|
||||
m_mouseButtons[button] = down;
|
||||
}
|
||||
if (button < 0 || button >= 3) return;
|
||||
|
||||
m_mouseButtons[button] = down;
|
||||
}
|
||||
|
||||
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"
|
||||
|
|
@ -512,17 +512,31 @@ void ClearGlobalText()
|
|||
uint16_t *GetGlobalText()
|
||||
{
|
||||
//copy the ch text to ui16
|
||||
char * pchBuffer=(char *)ui16GlobalText;
|
||||
char * pchBuffer=(char *)ui16GlobalText;
|
||||
for(int i=0;i<256;i++)
|
||||
{
|
||||
pchBuffer[i*2]=chGlobalText[i];
|
||||
}
|
||||
return ui16GlobalText;
|
||||
}
|
||||
|
||||
void SeedEditBox()
|
||||
{
|
||||
DialogBox(hMyInst, MAKEINTRESOURCE(IDD_SEED),
|
||||
g_hWnd, reinterpret_cast<DLGPROC>(DlgProc));
|
||||
KeyboardInitData kbData;
|
||||
|
||||
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