added some kbm stuff

This commit is contained in:
2026-09-13 19:41:44 -07:00
parent 82e802873f
commit 5023e0a8d6
217 changed files with 3744 additions and 235 deletions
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "UI.h"
#include "UIScene_CreateWorldMenu.h"
#include "DirectTextEdit.h"
#include "..\..\MinecraftServer.h"
#include "..\..\Minecraft.h"
#include "..\..\Options.h"
@@ -81,6 +82,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_MoreOptionsParams.bDoDaylightCycle = true;
m_bGameModeCreative = false;
m_lastPackSelId = -1;
m_bPackSelTracked = false;
m_iGameModeId = GameType::SURVIVAL->getId();
m_pDLCPack = NULL;
m_bRebuildTouchBoxes = false;
@@ -298,6 +301,7 @@ void UIScene_CreateWorldMenu::tick()
{
slideLeft();
m_texturePackDescDisplayed = true;
handleTouchBoxRebuild();
m_bShowTexturePackDescription = false;
}
@@ -386,8 +390,16 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
case ACTION_MENU_RIGHT:
case ACTION_MENU_OTHER_STICK_UP:
case ACTION_MENU_OTHER_STICK_DOWN:
sendInputToMovie(key, repeat, pressed, released);
if (pressed && (key == ACTION_MENU_OTHER_STICK_UP || key == ACTION_MENU_OTHER_STICK_DOWN)
&& MouseHoversTexturePackList())
{
StepTexturePack(key == ACTION_MENU_OTHER_STICK_UP ? -1 : +1);
}
else
{
sendInputToMovie(key, repeat, pressed, released);
}
bool bOnlineGame = m_checkboxOnline.IsChecked();
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame)
{
@@ -416,8 +428,14 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{
case eControl_EditWorldName:
{
#ifdef _WINDOWS64
DirectTextEdit::Begin(&m_editWorldName, &m_controlMainPanel, m_editWorldName.getLabel(), 25,
C_4JInput::EKeyboardMode_Default,
&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback, this);
#else
m_bIgnoreInput=true;
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:
@@ -622,7 +640,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue)
void UIScene_CreateWorldMenu::handleTimerComplete(int id)
{
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
// we cannot rebuild touch boxes in an iggy callback because it requires further iggy calls
if(m_bRebuildTouchBoxes)
{
@@ -729,7 +747,10 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
{
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
InputManager.GetText(pchText);
#ifdef _WINDOWS64
if (!DirectTextEdit::TakeText(pchText, 128))
#endif
InputManager.GetText(pchText);
if(pchText[0]!=0)
{
@@ -742,6 +763,54 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
return 0;
}
void UIScene_CreateWorldMenu::handleSelectionChanged(F64 selectedId)
{
m_lastPackSelId = (int)selectedId;
m_bPackSelTracked = true;
IUIScene_StartGame::handleSelectionChanged(selectedId);
}
bool UIScene_CreateWorldMenu::MouseHoversTexturePackList()
{
m_controlMainPanel.UpdateControl();
m_texturePackList.UpdateControl();
float x = (float)m_controlMainPanel.getXPos() + (float)m_texturePackList.getXPos();
float y = (float)m_controlMainPanel.getYPos() + (float)m_texturePackList.getYPos();
float w = (float)m_texturePackList.getWidth();
float h = (float)m_texturePackList.getHeight();
if (w < 4.0f || h < 4.0f)
return false;
float fx = 0.0f, fy = 0.0f;
ui.GetMovieMousePos(this, fx, fy);
return fx >= x && fx < x + w && fy >= y && fy < y + h;
}
void UIScene_CreateWorldMenu::StepTexturePack(int iDir)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
if (!pMinecraft || !pMinecraft->skins)
return;
int count = (int)pMinecraft->skins->getTexturePackCount();
if (count < 2)
return;
int step = (iDir < 0 ? -1 : +1);
int idx = m_bPackSelTracked ? m_lastPackSelId : (int)m_currentTexturePackIndex;
for (;;)
{
idx += step;
if (idx < 0 || idx >= count)
return;
if (pMinecraft->skins->getTexturePackByIndex(idx) != NULL)
break;
}
m_lastPackSelId = idx;
m_bPackSelTracked = true;
m_texturePackList.selectSlot(idx);
UpdateCurrentTexturePack(idx);
UpdateTexturePackDescription(idx);
ui.PlayUISFX(eSFX_Scroll);
}
void UIScene_CreateWorldMenu::checkStateAndStartGame()
{
int primaryPad = ProfileManager.GetPrimaryPad();
@@ -1441,4 +1510,5 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
void UIScene_CreateWorldMenu::handleTouchBoxRebuild()
{
m_bRebuildTouchBoxes = true;
UIScene::handleTouchBoxRebuild();
}