format Platform/Common/UI
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,223 +1,260 @@
|
||||
#pragma once
|
||||
|
||||
// Uncomment to enable tap input detection to jump 1 slot. Doesn't work particularly well yet, and I feel the system does not need it.
|
||||
// Would probably be required if we decide to slow down the pointer movement.
|
||||
// 4J Stu - There was a request to be able to navigate the scenes with the dpad, so I have used much of the TAP_DETECTION
|
||||
// code as it worked well for that situation. This #define should still stop the same things happening when using the
|
||||
// stick though when not defined
|
||||
// Uncomment to enable tap input detection to jump 1 slot. Doesn't work
|
||||
// particularly well yet, and I feel the system does not need it. Would probably
|
||||
// be required if we decide to slow down the pointer movement. 4J Stu - There
|
||||
// was a request to be able to navigate the scenes with the dpad, so I have used
|
||||
// much of the TAP_DETECTION code as it worked well for that situation. This
|
||||
// #define should still stop the same things happening when using the stick
|
||||
// though when not defined
|
||||
#define TAP_DETECTION
|
||||
|
||||
// Uncomment to enable acceleration on pointer input.
|
||||
//#define USE_POINTER_ACCEL
|
||||
// #define USE_POINTER_ACCEL
|
||||
|
||||
#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID.
|
||||
#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer.
|
||||
//#define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of panel which pointer can go over to drop items. - comes from the pointer size in the scene
|
||||
#define POINTER_INPUT_TIMER_ID (0) // Arbitrary timer ID.
|
||||
#define POINTER_SPEED_FACTOR (13.0f) // Speed of pointer.
|
||||
// #define POINTER_PANEL_OVER_REACH (42.0f) // Amount beyond edge of
|
||||
// panel which pointer can go over to drop items. - comes from the pointer size
|
||||
// in the scene
|
||||
|
||||
#define MAX_INPUT_TICKS_FOR_SCALING (7)
|
||||
#define MAX_INPUT_TICKS_FOR_TAPPING (15)
|
||||
#define MAX_INPUT_TICKS_FOR_SCALING (7)
|
||||
#define MAX_INPUT_TICKS_FOR_TAPPING (15)
|
||||
|
||||
class AbstractContainerMenu;
|
||||
class Slot;
|
||||
|
||||
class IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
// Sections of this scene containing items selectable by the pointer.
|
||||
// 4J Stu - Always make the Using section the first one
|
||||
enum ESceneSection
|
||||
{
|
||||
eSectionNone = -1,
|
||||
eSectionContainerUsing = 0,
|
||||
eSectionContainerInventory,
|
||||
eSectionContainerChest,
|
||||
eSectionContainerMax,
|
||||
|
||||
eSectionFurnaceUsing,
|
||||
eSectionFurnaceInventory,
|
||||
eSectionFurnaceIngredient,
|
||||
eSectionFurnaceFuel,
|
||||
eSectionFurnaceResult,
|
||||
eSectionFurnaceMax,
|
||||
|
||||
eSectionInventoryUsing,
|
||||
eSectionInventoryInventory,
|
||||
eSectionInventoryArmor,
|
||||
eSectionInventoryMax,
|
||||
|
||||
eSectionTrapUsing,
|
||||
eSectionTrapInventory,
|
||||
eSectionTrapTrap,
|
||||
eSectionTrapMax,
|
||||
// Sections of this scene containing items selectable by the pointer.
|
||||
// 4J Stu - Always make the Using section the first one
|
||||
enum ESceneSection {
|
||||
eSectionNone = -1,
|
||||
eSectionContainerUsing = 0,
|
||||
eSectionContainerInventory,
|
||||
eSectionContainerChest,
|
||||
eSectionContainerMax,
|
||||
|
||||
eSectionInventoryCreativeUsing,
|
||||
eSectionInventoryCreativeSelector,
|
||||
eSectionFurnaceUsing,
|
||||
eSectionFurnaceInventory,
|
||||
eSectionFurnaceIngredient,
|
||||
eSectionFurnaceFuel,
|
||||
eSectionFurnaceResult,
|
||||
eSectionFurnaceMax,
|
||||
|
||||
eSectionInventoryUsing,
|
||||
eSectionInventoryInventory,
|
||||
eSectionInventoryArmor,
|
||||
eSectionInventoryMax,
|
||||
|
||||
eSectionTrapUsing,
|
||||
eSectionTrapInventory,
|
||||
eSectionTrapTrap,
|
||||
eSectionTrapMax,
|
||||
|
||||
eSectionInventoryCreativeUsing,
|
||||
eSectionInventoryCreativeSelector,
|
||||
#ifndef _XBOX
|
||||
eSectionInventoryCreativeTab_0,
|
||||
eSectionInventoryCreativeTab_1,
|
||||
eSectionInventoryCreativeTab_2,
|
||||
eSectionInventoryCreativeTab_3,
|
||||
eSectionInventoryCreativeTab_4,
|
||||
eSectionInventoryCreativeTab_5,
|
||||
eSectionInventoryCreativeTab_6,
|
||||
eSectionInventoryCreativeTab_7,
|
||||
eSectionInventoryCreativeSlider,
|
||||
eSectionInventoryCreativeTab_0,
|
||||
eSectionInventoryCreativeTab_1,
|
||||
eSectionInventoryCreativeTab_2,
|
||||
eSectionInventoryCreativeTab_3,
|
||||
eSectionInventoryCreativeTab_4,
|
||||
eSectionInventoryCreativeTab_5,
|
||||
eSectionInventoryCreativeTab_6,
|
||||
eSectionInventoryCreativeTab_7,
|
||||
eSectionInventoryCreativeSlider,
|
||||
#endif
|
||||
eSectionInventoryCreativeMax,
|
||||
|
||||
eSectionEnchantUsing,
|
||||
eSectionEnchantInventory,
|
||||
eSectionEnchantSlot,
|
||||
eSectionEnchantButton1,
|
||||
eSectionEnchantButton2,
|
||||
eSectionEnchantButton3,
|
||||
eSectionEnchantMax,
|
||||
eSectionInventoryCreativeMax,
|
||||
|
||||
eSectionBrewingUsing,
|
||||
eSectionBrewingInventory,
|
||||
eSectionBrewingBottle1,
|
||||
eSectionBrewingBottle2,
|
||||
eSectionBrewingBottle3,
|
||||
eSectionBrewingIngredient,
|
||||
eSectionBrewingMax,
|
||||
eSectionEnchantUsing,
|
||||
eSectionEnchantInventory,
|
||||
eSectionEnchantSlot,
|
||||
eSectionEnchantButton1,
|
||||
eSectionEnchantButton2,
|
||||
eSectionEnchantButton3,
|
||||
eSectionEnchantMax,
|
||||
|
||||
eSectionAnvilUsing,
|
||||
eSectionAnvilInventory,
|
||||
eSectionAnvilItem1,
|
||||
eSectionAnvilItem2,
|
||||
eSectionAnvilResult,
|
||||
eSectionAnvilName,
|
||||
eSectionAnvilMax,
|
||||
};
|
||||
eSectionBrewingUsing,
|
||||
eSectionBrewingInventory,
|
||||
eSectionBrewingBottle1,
|
||||
eSectionBrewingBottle2,
|
||||
eSectionBrewingBottle3,
|
||||
eSectionBrewingIngredient,
|
||||
eSectionBrewingMax,
|
||||
|
||||
AbstractContainerMenu* m_menu;
|
||||
bool m_autoDeleteMenu;
|
||||
eSectionAnvilUsing,
|
||||
eSectionAnvilInventory,
|
||||
eSectionAnvilItem1,
|
||||
eSectionAnvilItem2,
|
||||
eSectionAnvilResult,
|
||||
eSectionAnvilName,
|
||||
eSectionAnvilMax,
|
||||
};
|
||||
|
||||
eTutorial_State m_previousTutorialState;
|
||||
AbstractContainerMenu* m_menu;
|
||||
bool m_autoDeleteMenu;
|
||||
|
||||
UIVec2D m_pointerPos;
|
||||
eTutorial_State m_previousTutorialState;
|
||||
|
||||
// Offset from pointer image top left to centre (we use the centre as the actual pointer).
|
||||
float m_fPointerImageOffsetX;
|
||||
float m_fPointerImageOffsetY;
|
||||
UIVec2D m_pointerPos;
|
||||
|
||||
// Min and max extents for the pointer.
|
||||
float m_fPointerMinX;
|
||||
float m_fPointerMaxX;
|
||||
float m_fPointerMinY;
|
||||
float m_fPointerMaxY;
|
||||
// Offset from pointer image top left to centre (we use the centre as the
|
||||
// actual pointer).
|
||||
float m_fPointerImageOffsetX;
|
||||
float m_fPointerImageOffsetY;
|
||||
|
||||
// Min and max extents of the panel.
|
||||
float m_fPanelMinX;
|
||||
float m_fPanelMaxX;
|
||||
float m_fPanelMinY;
|
||||
float m_fPanelMaxY;
|
||||
// Min and max extents for the pointer.
|
||||
float m_fPointerMinX;
|
||||
float m_fPointerMaxX;
|
||||
float m_fPointerMinY;
|
||||
float m_fPointerMaxY;
|
||||
|
||||
int m_iConsectiveInputTicks;
|
||||
// Min and max extents of the panel.
|
||||
float m_fPanelMinX;
|
||||
float m_fPanelMaxX;
|
||||
float m_fPanelMinY;
|
||||
float m_fPanelMaxY;
|
||||
|
||||
// Used for detecting quick "taps" in a direction, should jump cursor to next slot.
|
||||
enum ETapState
|
||||
{
|
||||
eTapStateNoInput = 0,
|
||||
eTapStateUp,
|
||||
eTapStateDown,
|
||||
eTapStateLeft,
|
||||
eTapStateRight,
|
||||
eTapStateJump,
|
||||
eTapNone
|
||||
};
|
||||
int m_iConsectiveInputTicks;
|
||||
|
||||
ETapState m_eCurrTapState;
|
||||
ESceneSection m_eCurrSection;
|
||||
int m_iCurrSlotX;
|
||||
int m_iCurrSlotY;
|
||||
// Used for detecting quick "taps" in a direction, should jump cursor to
|
||||
// next slot.
|
||||
enum ETapState {
|
||||
eTapStateNoInput = 0,
|
||||
eTapStateUp,
|
||||
eTapStateDown,
|
||||
eTapStateLeft,
|
||||
eTapStateRight,
|
||||
eTapStateJump,
|
||||
eTapNone
|
||||
};
|
||||
|
||||
ETapState m_eCurrTapState;
|
||||
ESceneSection m_eCurrSection;
|
||||
int m_iCurrSlotX;
|
||||
int m_iCurrSlotY;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
bool m_bFirstTouchStored[XUSER_MAX_COUNT]; // monitor the first position of a touch, so we can use relative distances of movement
|
||||
UIVec2D m_oldvPointerPos;
|
||||
UIVec2D m_oldvTouchPos;
|
||||
// store the multipliers to map the UI window to the touchpad window
|
||||
float m_fTouchPadMulX;
|
||||
float m_fTouchPadMulY;
|
||||
float m_fTouchPadDeadZoneX; // usese the multipliers
|
||||
float m_fTouchPadDeadZoneY;
|
||||
|
||||
bool
|
||||
m_bFirstTouchStored[XUSER_MAX_COUNT]; // monitor the first position of
|
||||
// a touch, so we can use
|
||||
// relative distances of movement
|
||||
UIVec2D m_oldvPointerPos;
|
||||
UIVec2D m_oldvTouchPos;
|
||||
// store the multipliers to map the UI window to the touchpad window
|
||||
float m_fTouchPadMulX;
|
||||
float m_fTouchPadMulY;
|
||||
float m_fTouchPadDeadZoneX; // usese the multipliers
|
||||
float m_fTouchPadDeadZoneY;
|
||||
|
||||
#endif
|
||||
|
||||
// ENum indexes of the first section for this scene, and 1+the last section
|
||||
ESceneSection m_eFirstSection, m_eMaxSection;
|
||||
// ENum indexes of the first section for this scene, and 1+the last section
|
||||
ESceneSection m_eFirstSection, m_eMaxSection;
|
||||
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Current tooltip settings.
|
||||
EToolTipItem m_aeToolTipSettings[ eToolTipNumButtons ];
|
||||
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Indicates if pointer is outside UI window (used to drop items).
|
||||
bool m_bPointerOutsideMenu;
|
||||
Slot *m_lastPointerLabelSlot;
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Current tooltip settings.
|
||||
EToolTipItem m_aeToolTipSettings[eToolTipNumButtons];
|
||||
|
||||
bool m_bSplitscreen;
|
||||
bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back on exit?
|
||||
|
||||
virtual bool IsSectionSlotList( ESceneSection eSection ) { return eSection != eSectionNone; }
|
||||
virtual bool CanHaveFocus( ESceneSection eSection ) { return true; }
|
||||
int GetSectionDimensions( ESceneSection eSection, int* piNumColumns, int* piNumRows );
|
||||
virtual int getSectionColumns(ESceneSection eSection) = 0;
|
||||
virtual int getSectionRows(ESceneSection eSection) = 0;
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) = 0;
|
||||
virtual void GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) = 0;
|
||||
virtual void GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) = 0;
|
||||
void updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset );
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
// Indicates if pointer is outside UI window (used to drop items).
|
||||
bool m_bPointerOutsideMenu;
|
||||
Slot* m_lastPointerLabelSlot;
|
||||
|
||||
#ifdef TAP_DETECTION
|
||||
ETapState GetTapInputType( float fInputX, float fInputY );
|
||||
#endif
|
||||
bool m_bSplitscreen;
|
||||
bool m_bNavigateBack; // should we exit the xuiscenes or just navigate back
|
||||
// on exit?
|
||||
|
||||
// Current tooltip settings.
|
||||
void SetToolTip( EToolTipButton eButton, EToolTipItem eItem );
|
||||
void UpdateTooltips();
|
||||
virtual bool IsSectionSlotList(ESceneSection eSection) {
|
||||
return eSection != eSectionNone;
|
||||
}
|
||||
virtual bool CanHaveFocus(ESceneSection eSection) { return true; }
|
||||
int GetSectionDimensions(ESceneSection eSection, int* piNumColumns,
|
||||
int* piNumRows);
|
||||
virtual int getSectionColumns(ESceneSection eSection) = 0;
|
||||
virtual int getSectionRows(ESceneSection eSection) = 0;
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) = 0;
|
||||
virtual void GetPositionOfSection(ESceneSection eSection,
|
||||
UIVec2D* pPosition) = 0;
|
||||
virtual void GetItemScreenData(ESceneSection eSection, int iItemIndex,
|
||||
UIVec2D* pPosition, UIVec2D* pSize) = 0;
|
||||
void updateSlotPosition(ESceneSection eSection, ESceneSection newSection,
|
||||
ETapState eTapDirection, int* piTargetX,
|
||||
int* piTargetY, int xOffset);
|
||||
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
void SetPointerOutsideMenu( bool bOutside ) { m_bPointerOutsideMenu = bOutside; }
|
||||
|
||||
void Initialize(int m_iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack=false);
|
||||
virtual void PlatformInitialize(int iPad, int startIndex) = 0;
|
||||
virtual void InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex = 0) = 0;
|
||||
#ifdef TAP_DETECTION
|
||||
ETapState GetTapInputType(float fInputX, float fInputY);
|
||||
#endif
|
||||
|
||||
void onMouseTick();
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld);
|
||||
virtual void handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey);
|
||||
virtual void handleAdditionalKeyPress(int iAction);
|
||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld);
|
||||
virtual void handleSectionClick(ESceneSection eSection) = 0;
|
||||
void slotClicked(int slotId, int buttonNum, bool quickKey);
|
||||
int getCurrentIndex(ESceneSection eSection);
|
||||
virtual int getSectionStartOffset(ESceneSection eSection) = 0;
|
||||
virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) = 0;
|
||||
virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0;
|
||||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
|
||||
virtual void setFocusToPointer(int iPad) = 0;
|
||||
virtual void SetPointerText(const std::wstring &description, std::vector<std::wstring> &unformattedStrings, bool newSlot) = 0;
|
||||
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual void adjustPointerForSafeZone() = 0;
|
||||
// Current tooltip settings.
|
||||
void SetToolTip(EToolTipButton eButton, EToolTipItem eItem);
|
||||
void UpdateTooltips();
|
||||
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
|
||||
// 4J - WESTY - Added for pointer prototype.
|
||||
void SetPointerOutsideMenu(bool bOutside) {
|
||||
m_bPointerOutsideMenu = bOutside;
|
||||
}
|
||||
|
||||
void Initialize(int m_iPad, AbstractContainerMenu* menu,
|
||||
bool autoDeleteMenu, int startIndex,
|
||||
ESceneSection firstSection, ESceneSection maxSection,
|
||||
bool bNavigateBack = false);
|
||||
virtual void PlatformInitialize(int iPad, int startIndex) = 0;
|
||||
virtual void InitDataAssociations(int iPad, AbstractContainerMenu* menu,
|
||||
int startIndex = 0) = 0;
|
||||
|
||||
void onMouseTick();
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
virtual bool handleValidKeyPress(int iUserIndex, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
virtual void handleOutsideClicked(int iPad, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey);
|
||||
virtual void handleAdditionalKeyPress(int iAction);
|
||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
virtual void handleSectionClick(ESceneSection eSection) = 0;
|
||||
void slotClicked(int slotId, int buttonNum, bool quickKey);
|
||||
int getCurrentIndex(ESceneSection eSection);
|
||||
virtual int getSectionStartOffset(ESceneSection eSection) = 0;
|
||||
virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) = 0;
|
||||
virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0;
|
||||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x,
|
||||
int y) = 0;
|
||||
virtual void setFocusToPointer(int iPad) = 0;
|
||||
virtual void SetPointerText(const std::wstring& description,
|
||||
std::vector<std::wstring>& unformattedStrings,
|
||||
bool newSlot) = 0;
|
||||
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection,
|
||||
int iSlot) = 0;
|
||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual void adjustPointerForSafeZone() = 0;
|
||||
|
||||
virtual bool overrideTooltips(
|
||||
ESceneSection sectionUnderPointer,
|
||||
std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried,
|
||||
bool bSlotHasItem, bool bCarriedIsSameAsSlot,
|
||||
int iSlotStackSizeRemaining, EToolTipItem& buttonA,
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB);
|
||||
int GetEmptyStackSpace(Slot *slot);
|
||||
std::wstring GetItemDescription(Slot *slot, std::vector<std::wstring> &unformattedStrings);
|
||||
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA,
|
||||
std::shared_ptr<ItemInstance> itemB);
|
||||
int GetEmptyStackSpace(Slot* slot);
|
||||
std::wstring GetItemDescription(
|
||||
Slot* slot, std::vector<std::wstring>& unformattedStrings);
|
||||
|
||||
protected:
|
||||
|
||||
IUIScene_AbstractContainerMenu();
|
||||
virtual ~IUIScene_AbstractContainerMenu();
|
||||
IUIScene_AbstractContainerMenu();
|
||||
virtual ~IUIScene_AbstractContainerMenu();
|
||||
|
||||
public:
|
||||
virtual int getPad() = 0;
|
||||
virtual int getPad() = 0;
|
||||
};
|
||||
|
||||
@@ -7,270 +7,225 @@
|
||||
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
|
||||
#include "../../Minecraft.Client/Network/ClientConnection.h"
|
||||
|
||||
IUIScene_AnvilMenu::IUIScene_AnvilMenu()
|
||||
{
|
||||
m_inventory = nullptr;
|
||||
m_repairMenu = NULL;
|
||||
m_itemName = L"";
|
||||
IUIScene_AnvilMenu::IUIScene_AnvilMenu() {
|
||||
m_inventory = nullptr;
|
||||
m_repairMenu = NULL;
|
||||
m_itemName = L"";
|
||||
}
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_AnvilMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_AnvilMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionAnvilItem1:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_ITEM1_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionAnvilResult;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilItem2:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionAnvilItem1;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionAnvilResult;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilResult:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionAnvilItem1;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilName:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionAnvilUsing;
|
||||
xOffset = ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionAnvilUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
if( *piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilItem1;
|
||||
}
|
||||
else if( *piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
else if( *piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilResult;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilUsing:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionAnvilInventory;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
if( *piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilItem1;
|
||||
}
|
||||
else if( *piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
else if( *piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionAnvilItem1:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionAnvilName;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_ITEM1_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionAnvilResult;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilItem2:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionAnvilName;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionAnvilItem1;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionAnvilResult;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilResult:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionAnvilName;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionAnvilInventory;
|
||||
xOffset = ANVIL_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionAnvilItem2;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionAnvilItem1;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilName:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionAnvilUsing;
|
||||
xOffset = ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionAnvilItem2;
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionAnvilUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilItem1;
|
||||
} else if (*piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilItem2;
|
||||
} else if (*piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilResult;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionAnvilUsing:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionAnvilInventory;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
if (*piTargetX <= ANVIL_SCENE_ITEM1_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilItem1;
|
||||
} else if (*piTargetX <= ANVIL_SCENE_ITEM2_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilName;
|
||||
} else if (*piTargetX >= ANVIL_SCENE_RESULT_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionAnvilName;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_AnvilMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionAnvilItem1:
|
||||
offset = MerchantMenu::PAYMENT1_SLOT;
|
||||
break;
|
||||
case eSectionAnvilItem2:
|
||||
offset = MerchantMenu::PAYMENT2_SLOT;
|
||||
break;
|
||||
case eSectionAnvilResult:
|
||||
offset = MerchantMenu::RESULT_SLOT;
|
||||
break;
|
||||
case eSectionAnvilInventory:
|
||||
offset = MerchantMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionAnvilUsing:
|
||||
offset = MerchantMenu::USE_ROW_SLOT_START;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_AnvilMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionAnvilItem1:
|
||||
offset = MerchantMenu::PAYMENT1_SLOT;
|
||||
break;
|
||||
case eSectionAnvilItem2:
|
||||
offset = MerchantMenu::PAYMENT2_SLOT;
|
||||
break;
|
||||
case eSectionAnvilResult:
|
||||
offset = MerchantMenu::RESULT_SLOT;
|
||||
break;
|
||||
case eSectionAnvilInventory:
|
||||
offset = MerchantMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionAnvilUsing:
|
||||
offset = MerchantMenu::USE_ROW_SLOT_START;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey)
|
||||
{
|
||||
switch(eSection)
|
||||
{
|
||||
case eSectionAnvilName:
|
||||
handleEditNamePressed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
void IUIScene_AnvilMenu::handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey) {
|
||||
switch (eSection) {
|
||||
case eSectionAnvilName:
|
||||
handleEditNamePressed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
bool IUIScene_AnvilMenu::IsSectionSlotList( ESceneSection eSection )
|
||||
{
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionAnvilUsing:
|
||||
case eSectionAnvilInventory:
|
||||
case eSectionAnvilItem1:
|
||||
case eSectionAnvilItem2:
|
||||
case eSectionAnvilResult:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
bool IUIScene_AnvilMenu::IsSectionSlotList(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionAnvilUsing:
|
||||
case eSectionAnvilInventory:
|
||||
case eSectionAnvilItem1:
|
||||
case eSectionAnvilItem2:
|
||||
case eSectionAnvilResult:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::handleTick()
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
bool canAfford = true;
|
||||
std::wstring m_costString = L"";
|
||||
void IUIScene_AnvilMenu::handleTick() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
bool canAfford = true;
|
||||
std::wstring m_costString = L"";
|
||||
|
||||
if(m_repairMenu->cost > 0)
|
||||
{
|
||||
if(m_repairMenu->cost >= 40 && !pMinecraft->localplayers[getPad()]->abilities.instabuild)
|
||||
{
|
||||
m_costString = app.GetString(IDS_REPAIR_EXPENSIVE);
|
||||
canAfford = false;
|
||||
}
|
||||
else if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem())
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
const wchar_t *costString = app.GetString(IDS_REPAIR_COST);
|
||||
wchar_t temp[256];
|
||||
swprintf(temp, 256, costString, m_repairMenu->cost);
|
||||
m_costString = temp;
|
||||
if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(std::dynamic_pointer_cast<Player>(m_inventory->player->shared_from_this())))
|
||||
{
|
||||
canAfford = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
setCostLabel(m_costString, canAfford);
|
||||
if (m_repairMenu->cost > 0) {
|
||||
if (m_repairMenu->cost >= 40 &&
|
||||
!pMinecraft->localplayers[getPad()]->abilities.instabuild) {
|
||||
m_costString = app.GetString(IDS_REPAIR_EXPENSIVE);
|
||||
canAfford = false;
|
||||
} else if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem()) {
|
||||
// Do nothing
|
||||
} else {
|
||||
const wchar_t* costString = app.GetString(IDS_REPAIR_COST);
|
||||
wchar_t temp[256];
|
||||
swprintf(temp, 256, costString, m_repairMenu->cost);
|
||||
m_costString = temp;
|
||||
if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)
|
||||
->mayPickup(std::dynamic_pointer_cast<Player>(
|
||||
m_inventory->player->shared_from_this()))) {
|
||||
canAfford = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
setCostLabel(m_costString, canAfford);
|
||||
|
||||
bool crossVisible = (m_repairMenu->getSlot(RepairMenu::INPUT_SLOT)->hasItem() || m_repairMenu->getSlot(RepairMenu::ADDITIONAL_SLOT)->hasItem()) && !m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem();
|
||||
showCross(crossVisible);
|
||||
bool crossVisible =
|
||||
(m_repairMenu->getSlot(RepairMenu::INPUT_SLOT)->hasItem() ||
|
||||
m_repairMenu->getSlot(RepairMenu::ADDITIONAL_SLOT)->hasItem()) &&
|
||||
!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem();
|
||||
showCross(crossVisible);
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::updateItemName()
|
||||
{
|
||||
Slot *slot = m_repairMenu->getSlot(RepairMenu::INPUT_SLOT);
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0)
|
||||
{
|
||||
m_itemName = L"";
|
||||
}
|
||||
}
|
||||
void IUIScene_AnvilMenu::updateItemName() {
|
||||
Slot* slot = m_repairMenu->getSlot(RepairMenu::INPUT_SLOT);
|
||||
if (slot != NULL && slot->hasItem()) {
|
||||
if (!slot->getItem()->hasCustomHoverName() &&
|
||||
m_itemName.compare(slot->getItem()->getHoverName()) == 0) {
|
||||
m_itemName = L"";
|
||||
}
|
||||
}
|
||||
|
||||
m_repairMenu->setItemName(m_itemName);
|
||||
m_repairMenu->setItemName(m_itemName);
|
||||
|
||||
// Convert to byteArray
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
dos.writeUTF(m_itemName);
|
||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||
// Convert to byteArray
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
dos.writeUTF(m_itemName);
|
||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, std::vector<std::shared_ptr<ItemInstance> > *items)
|
||||
{
|
||||
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
|
||||
void IUIScene_AnvilMenu::refreshContainer(
|
||||
AbstractContainerMenu* container,
|
||||
std::vector<std::shared_ptr<ItemInstance> >* items) {
|
||||
slotChanged(container, RepairMenu::INPUT_SLOT,
|
||||
container->getSlot(0)->getItem());
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (slotIndex == RepairMenu::INPUT_SLOT)
|
||||
{
|
||||
m_itemName = item == NULL ? L"" : item->getHoverName();
|
||||
setEditNameValue(m_itemName);
|
||||
setEditNameEditable(item != NULL);
|
||||
if (item != NULL)
|
||||
{
|
||||
updateItemName();
|
||||
}
|
||||
}
|
||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu* container,
|
||||
int slotIndex,
|
||||
std::shared_ptr<ItemInstance> item) {
|
||||
if (slotIndex == RepairMenu::INPUT_SLOT) {
|
||||
m_itemName = item == NULL ? L"" : item->getHoverName();
|
||||
setEditNameValue(m_itemName);
|
||||
setEditNameEditable(item != NULL);
|
||||
if (item != NULL) {
|
||||
updateItemName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::setContainerData(AbstractContainerMenu *container, int id, int value)
|
||||
{
|
||||
}
|
||||
void IUIScene_AnvilMenu::setContainerData(AbstractContainerMenu* container,
|
||||
int id, int value) {}
|
||||
|
||||
@@ -13,33 +13,40 @@
|
||||
class Inventory;
|
||||
class RepairMenu;
|
||||
|
||||
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
|
||||
{
|
||||
class IUIScene_AnvilMenu
|
||||
: public virtual IUIScene_AbstractContainerMenu,
|
||||
public net_minecraft_world_inventory::ContainerListener {
|
||||
protected:
|
||||
std::shared_ptr<Inventory> m_inventory;
|
||||
RepairMenu *m_repairMenu;
|
||||
std::wstring m_itemName;
|
||||
std::shared_ptr<Inventory> m_inventory;
|
||||
RepairMenu* m_repairMenu;
|
||||
std::wstring m_itemName;
|
||||
|
||||
protected:
|
||||
IUIScene_AnvilMenu();
|
||||
IUIScene_AnvilMenu();
|
||||
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey);
|
||||
bool IsSectionSlotList( ESceneSection eSection );
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey);
|
||||
bool IsSectionSlotList(ESceneSection eSection);
|
||||
|
||||
void handleTick();
|
||||
void handleTick();
|
||||
|
||||
// Anvil only
|
||||
virtual void handleEditNamePressed() = 0;
|
||||
virtual void setEditNameValue(const std::wstring &name) = 0;
|
||||
virtual void setEditNameEditable(bool enabled) = 0;
|
||||
virtual void setCostLabel(const std::wstring &label, bool canAfford) = 0;
|
||||
virtual void showCross(bool show) = 0;
|
||||
void updateItemName();
|
||||
// Anvil only
|
||||
virtual void handleEditNamePressed() = 0;
|
||||
virtual void setEditNameValue(const std::wstring& name) = 0;
|
||||
virtual void setEditNameEditable(bool enabled) = 0;
|
||||
virtual void setCostLabel(const std::wstring& label, bool canAfford) = 0;
|
||||
virtual void showCross(bool show) = 0;
|
||||
void updateItemName();
|
||||
|
||||
// ContainerListenr
|
||||
void refreshContainer(AbstractContainerMenu *container, std::vector<std::shared_ptr<ItemInstance> > *items);
|
||||
void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item);
|
||||
void setContainerData(AbstractContainerMenu *container, int id, int value);
|
||||
// ContainerListenr
|
||||
void refreshContainer(AbstractContainerMenu* container,
|
||||
std::vector<std::shared_ptr<ItemInstance> >* items);
|
||||
void slotChanged(AbstractContainerMenu* container, int slotIndex,
|
||||
std::shared_ptr<ItemInstance> item);
|
||||
void setContainerData(AbstractContainerMenu* container, int id, int value);
|
||||
};
|
||||
@@ -3,149 +3,115 @@
|
||||
#include "IUIScene_BrewingMenu.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_BrewingMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionBrewingBottle1:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionBrewingIngredient;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionBrewingBottle3;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingBottle2:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionBrewingIngredient;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionBrewingBottle1;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionBrewingBottle3;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingBottle3:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionBrewingIngredient;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionBrewingBottle1;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingIngredient:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionBrewingUsing;
|
||||
xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionBrewingBottle1;
|
||||
}
|
||||
else if( *piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
else if( *piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionBrewingBottle3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingUsing:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionBrewingInventory;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionBrewingIngredient;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionBrewingBottle1:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBrewingIngredient;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionBrewingBottle3;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingBottle2:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBrewingIngredient;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionBrewingBottle1;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionBrewingBottle3;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingBottle3:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBrewingIngredient;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingInventory;
|
||||
xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionBrewingBottle2;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionBrewingBottle1;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingIngredient:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBrewingUsing;
|
||||
xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingBottle2;
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionBrewingBottle1;
|
||||
} else if (*piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionBrewingBottle2;
|
||||
} else if (*piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionBrewingBottle3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionBrewingUsing:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBrewingInventory;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBrewingIngredient;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionBrewingBottle1:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START;
|
||||
break;
|
||||
case eSectionBrewingBottle2:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START + 1;
|
||||
break;
|
||||
case eSectionBrewingBottle3:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START + 2;
|
||||
break;
|
||||
case eSectionBrewingIngredient:
|
||||
offset = BrewingStandMenu::INGREDIENT_SLOT;
|
||||
break;
|
||||
case eSectionBrewingInventory:
|
||||
offset = BrewingStandMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionBrewingUsing:
|
||||
offset = BrewingStandMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionBrewingBottle1:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START;
|
||||
break;
|
||||
case eSectionBrewingBottle2:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START + 1;
|
||||
break;
|
||||
case eSectionBrewingBottle3:
|
||||
offset = BrewingStandMenu::BOTTLE_SLOT_START + 2;
|
||||
break;
|
||||
case eSectionBrewingIngredient:
|
||||
offset = BrewingStandMenu::INGREDIENT_SLOT;
|
||||
break;
|
||||
case eSectionBrewingInventory:
|
||||
offset = BrewingStandMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionBrewingUsing:
|
||||
offset = BrewingStandMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@@ -11,9 +11,11 @@
|
||||
#define BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET 5
|
||||
#define BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET 5
|
||||
|
||||
class IUIScene_BrewingMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_BrewingMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
@@ -2,70 +2,62 @@
|
||||
#include "IUIScene_ContainerMenu.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_ContainerMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_ContainerMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionContainerChest:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionContainerInventory;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionContainerUsing;
|
||||
}
|
||||
break;
|
||||
case eSectionContainerInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionContainerUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionContainerChest;
|
||||
}
|
||||
break;
|
||||
case eSectionContainerUsing:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionContainerChest;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionContainerInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionContainerChest:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionContainerInventory;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionContainerUsing;
|
||||
}
|
||||
break;
|
||||
case eSectionContainerInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionContainerUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionContainerChest;
|
||||
}
|
||||
break;
|
||||
case eSectionContainerUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionContainerChest;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionContainerInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, 0);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_ContainerMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionContainerChest:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionContainerInventory:
|
||||
offset = m_menu->getSize() - (27+9);
|
||||
break;
|
||||
case eSectionContainerUsing:
|
||||
offset = m_menu->getSize() - 9;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_ContainerMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionContainerChest:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionContainerInventory:
|
||||
offset = m_menu->getSize() - (27 + 9);
|
||||
break;
|
||||
case eSectionContainerUsing:
|
||||
offset = m_menu->getSize() - 9;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
#include "IUIScene_AbstractContainerMenu.h"
|
||||
|
||||
class IUIScene_ContainerMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_ContainerMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,115 +5,115 @@
|
||||
class LocalPlayer;
|
||||
|
||||
// 4J Stu - Crafting menu code that's shared across Iggy and XUI
|
||||
class IUIScene_CraftingMenu
|
||||
{
|
||||
class IUIScene_CraftingMenu {
|
||||
protected:
|
||||
#define DISPLAY_INVENTORY 0
|
||||
#define DISPLAY_DESCRIPTION 1
|
||||
#define DISPLAY_INGREDIENTS 2
|
||||
#define DISPLAY_MAX 3
|
||||
|
||||
enum _eGroupTab
|
||||
{
|
||||
eGroupTab_Left,
|
||||
eGroupTab_Middle,
|
||||
eGroupTab_Right
|
||||
};
|
||||
enum _eGroupTab { eGroupTab_Left, eGroupTab_Middle, eGroupTab_Right };
|
||||
|
||||
static const int m_iMaxHSlotC = 12;
|
||||
static const int m_iMaxHCraftingSlotC = 10;
|
||||
static const int m_iMaxVSlotC = 17;
|
||||
static const int m_iMaxDisplayedVSlotC = 3;
|
||||
static const int m_iIngredients3x3SlotC = 9;
|
||||
static const int m_iIngredients2x2SlotC = 4;
|
||||
static const int m_iMaxHSlotC = 12;
|
||||
static const int m_iMaxHCraftingSlotC = 10;
|
||||
static const int m_iMaxVSlotC = 17;
|
||||
static const int m_iMaxDisplayedVSlotC = 3;
|
||||
static const int m_iIngredients3x3SlotC = 9;
|
||||
static const int m_iIngredients2x2SlotC = 4;
|
||||
|
||||
static const int m_iMaxHSlot3x3C = 12;
|
||||
static const int m_iMaxHSlot2x2C = 10;
|
||||
static const int m_iMaxHSlot3x3C = 12;
|
||||
static const int m_iMaxHSlot2x2C = 10;
|
||||
|
||||
static const int m_iMaxGroup3x3 = 7;
|
||||
static const int m_iMaxGroup2x2 = 6;
|
||||
static const int m_iMaxGroup3x3 = 7;
|
||||
static const int m_iMaxGroup2x2 = 6;
|
||||
|
||||
static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES];
|
||||
static int m_iBaseTypeMapA[Item::eBaseItemType_MAXTYPES];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int iCount;
|
||||
int iItemBaseType;
|
||||
int iRecipeA[m_iMaxVSlotC]; // tiers of item that can be made
|
||||
}
|
||||
CANBEMADE;
|
||||
typedef struct {
|
||||
int iCount;
|
||||
int iItemBaseType;
|
||||
int iRecipeA[m_iMaxVSlotC]; // tiers of item that can be made
|
||||
} CANBEMADE;
|
||||
|
||||
CANBEMADE CanBeMadeA[m_iMaxHSlotC];
|
||||
CANBEMADE CanBeMadeA[m_iMaxHSlotC];
|
||||
|
||||
int m_iCurrentSlotHIndex;
|
||||
int m_iCurrentSlotVIndex;
|
||||
int m_iRecipeC;
|
||||
int m_iContainerType; // 2x2 or 3x3
|
||||
std::shared_ptr<LocalPlayer> m_pPlayer;
|
||||
int m_iGroupIndex;
|
||||
int m_iCurrentSlotHIndex;
|
||||
int m_iCurrentSlotVIndex;
|
||||
int m_iRecipeC;
|
||||
int m_iContainerType; // 2x2 or 3x3
|
||||
std::shared_ptr<LocalPlayer> m_pPlayer;
|
||||
int m_iGroupIndex;
|
||||
|
||||
int iVSlotIndexA[3]; // index of the v slots currently displayed
|
||||
int iVSlotIndexA[3]; // index of the v slots currently displayed
|
||||
|
||||
static const wchar_t *m_GroupIconNameA[m_iMaxGroup3x3];
|
||||
static Recipy::_eGroupType m_GroupTypeMapping4GridA[m_iMaxGroup2x2];
|
||||
static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3];
|
||||
Recipy::_eGroupType *m_pGroupA;
|
||||
static const wchar_t* m_GroupIconNameA[m_iMaxGroup3x3];
|
||||
static Recipy::_eGroupType m_GroupTypeMapping4GridA[m_iMaxGroup2x2];
|
||||
static Recipy::_eGroupType m_GroupTypeMapping9GridA[m_iMaxGroup3x3];
|
||||
Recipy::_eGroupType* m_pGroupA;
|
||||
|
||||
static const wchar_t *m_GroupTabNameA[3];
|
||||
static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2];
|
||||
static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3];
|
||||
_eGroupTab *m_pGroupTabA;
|
||||
int m_iCraftablesMaxHSlotC;
|
||||
int m_iIngredientsMaxSlotC;
|
||||
int m_iDisplayDescription;
|
||||
int m_iIngredientsC;
|
||||
bool m_bIgnoreKeyPresses;
|
||||
bool m_bSplitscreen;
|
||||
static const wchar_t* m_GroupTabNameA[3];
|
||||
static _eGroupTab m_GroupTabBkgMapping2x2A[m_iMaxGroup2x2];
|
||||
static _eGroupTab m_GroupTabBkgMapping3x3A[m_iMaxGroup3x3];
|
||||
_eGroupTab* m_pGroupTabA;
|
||||
int m_iCraftablesMaxHSlotC;
|
||||
int m_iIngredientsMaxSlotC;
|
||||
int m_iDisplayDescription;
|
||||
int m_iIngredientsC;
|
||||
bool m_bIgnoreKeyPresses;
|
||||
bool m_bSplitscreen;
|
||||
|
||||
eTutorial_State m_previousTutorialState;
|
||||
eTutorial_State m_previousTutorialState;
|
||||
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
|
||||
public:
|
||||
IUIScene_CraftingMenu();
|
||||
IUIScene_CraftingMenu();
|
||||
|
||||
protected:
|
||||
const wchar_t *GetGroupNameText(int iGroupType);
|
||||
const wchar_t* GetGroupNameText(int iGroupType);
|
||||
|
||||
void CheckRecipesAvailable();
|
||||
void UpdateHighlight();
|
||||
void UpdateVerticalSlots();
|
||||
void DisplayIngredients();
|
||||
void UpdateTooltips();
|
||||
void UpdateDescriptionText(bool);
|
||||
void CheckRecipesAvailable();
|
||||
void UpdateHighlight();
|
||||
void UpdateVerticalSlots();
|
||||
void DisplayIngredients();
|
||||
void UpdateTooltips();
|
||||
void UpdateDescriptionText(bool);
|
||||
|
||||
public:
|
||||
Recipy::_eGroupType getCurrentGroup() { return m_pGroupA[m_iGroupIndex]; }
|
||||
bool isItemSelected(int itemId);
|
||||
Recipy::_eGroupType getCurrentGroup() { return m_pGroupA[m_iGroupIndex]; }
|
||||
bool isItemSelected(int itemId);
|
||||
|
||||
protected:
|
||||
virtual int getPad() = 0;
|
||||
virtual void hideAllHSlots() = 0;
|
||||
virtual void hideAllVSlots() = 0;
|
||||
virtual void hideAllIngredientsSlots() = 0;
|
||||
virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
||||
virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
||||
virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
|
||||
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionText(int index, const wchar_t *text) = 0;
|
||||
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;
|
||||
virtual void showTabHighlight(int iIndex, bool show) = 0;
|
||||
virtual void setGroupText(const wchar_t *text) = 0;
|
||||
virtual void setDescriptionText(const wchar_t *text) = 0;
|
||||
virtual void setItemText(const wchar_t *text) = 0;
|
||||
virtual void scrollDescriptionUp() = 0;
|
||||
virtual void scrollDescriptionDown() = 0;
|
||||
virtual void updateHighlightAndScrollPositions() = 0;
|
||||
virtual void updateVSlotPositions(int iSlots, int i) = 0;
|
||||
virtual int getPad() = 0;
|
||||
virtual void hideAllHSlots() = 0;
|
||||
virtual void hideAllVSlots() = 0;
|
||||
virtual void hideAllIngredientsSlots() = 0;
|
||||
virtual void setCraftHSlotItem(int iPad, int iIndex,
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
unsigned int uiAlpha) = 0;
|
||||
virtual void setCraftVSlotItem(int iPad, int iIndex,
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
unsigned int uiAlpha) = 0;
|
||||
virtual void setCraftingOutputSlotItem(
|
||||
int iPad, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
|
||||
virtual void setIngredientSlotItem(int iPad, int index,
|
||||
std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionItem(
|
||||
int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
|
||||
virtual void setIngredientDescriptionText(int index,
|
||||
const wchar_t* text) = 0;
|
||||
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;
|
||||
virtual void showTabHighlight(int iIndex, bool show) = 0;
|
||||
virtual void setGroupText(const wchar_t* text) = 0;
|
||||
virtual void setDescriptionText(const wchar_t* text) = 0;
|
||||
virtual void setItemText(const wchar_t* text) = 0;
|
||||
virtual void scrollDescriptionUp() = 0;
|
||||
virtual void scrollDescriptionDown() = 0;
|
||||
virtual void updateHighlightAndScrollPositions() = 0;
|
||||
virtual void updateVSlotPositions(int iSlots, int i) = 0;
|
||||
|
||||
virtual void UpdateMultiPanel() = 0;
|
||||
virtual void UpdateMultiPanel() = 0;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,120 +6,135 @@
|
||||
class SimpleContainer;
|
||||
class CreativeInventoryScreen;
|
||||
|
||||
class IUIScene_CreativeMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
friend class CreativeInventoryScreen;
|
||||
|
||||
public:
|
||||
// 4J Stu - These map directly to the tabs seenon the screen
|
||||
enum ECreativeInventoryTabs
|
||||
{
|
||||
eCreativeInventoryTab_BuildingBlocks = 0,
|
||||
eCreativeInventoryTab_Decorations,
|
||||
eCreativeInventoryTab_RedstoneAndTransport,
|
||||
eCreativeInventoryTab_Materials,
|
||||
eCreativeInventoryTab_Food,
|
||||
eCreativeInventoryTab_ToolsWeaponsArmor,
|
||||
eCreativeInventoryTab_Brewing,
|
||||
eCreativeInventoryTab_Misc,
|
||||
eCreativeInventoryTab_COUNT,
|
||||
};
|
||||
|
||||
// 4J Stu - These are logical groupings of items, and be be combined for tabs on-screen
|
||||
enum ECreative_Inventory_Groups
|
||||
{
|
||||
eCreativeInventory_BuildingBlocks,
|
||||
eCreativeInventory_Decoration,
|
||||
eCreativeInventory_Redstone,
|
||||
eCreativeInventory_Transport,
|
||||
eCreativeInventory_Materials,
|
||||
eCreativeInventory_Food,
|
||||
eCreativeInventory_ToolsArmourWeapons,
|
||||
eCreativeInventory_Brewing,
|
||||
eCreativeInventory_Potions_Basic,
|
||||
eCreativeInventory_Potions_Level2,
|
||||
eCreativeInventory_Potions_Extended,
|
||||
eCreativeInventory_Potions_Level2_Extended,
|
||||
eCreativeInventory_Misc,
|
||||
eCreativeInventoryGroupsCount
|
||||
};
|
||||
|
||||
// 4J JEV - Keeping all the tab specifications in one place.
|
||||
struct TabSpec
|
||||
{
|
||||
public:
|
||||
// 4J JEV - Layout
|
||||
static const int rows = 5;
|
||||
static const int columns = 10;
|
||||
static const int MAX_SIZE = rows * columns;
|
||||
|
||||
// 4J JEV - Images
|
||||
const wchar_t *m_icon;
|
||||
const int m_descriptionId;
|
||||
const int m_staticGroupsCount;
|
||||
ECreative_Inventory_Groups *m_staticGroupsA;
|
||||
const int m_dynamicGroupsCount;
|
||||
ECreative_Inventory_Groups *m_dynamicGroupsA;
|
||||
|
||||
private:
|
||||
unsigned int m_pages;
|
||||
unsigned int m_staticPerPage;
|
||||
unsigned int m_staticItems;
|
||||
|
||||
public:
|
||||
TabSpec( const wchar_t *icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups );
|
||||
~TabSpec();
|
||||
|
||||
void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page);
|
||||
unsigned int getPageCount();
|
||||
};
|
||||
|
||||
class ItemPickerMenu : public AbstractContainerMenu
|
||||
{
|
||||
protected:
|
||||
std::shared_ptr<SimpleContainer> creativeContainer;
|
||||
std::shared_ptr<Inventory> inventory;
|
||||
|
||||
public:
|
||||
ItemPickerMenu( std::shared_ptr<SimpleContainer> creativeContainer, std::shared_ptr<Inventory> inventory );
|
||||
|
||||
virtual bool stillValid(std::shared_ptr<Player> player);
|
||||
bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||
protected:
|
||||
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player) { } // do nothing
|
||||
} *itemPickerMenu;
|
||||
|
||||
protected:
|
||||
static std::vector< std::shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
|
||||
// 4J JEV - Tabs
|
||||
static TabSpec **specs;
|
||||
|
||||
bool m_bCarryingCreativeItem;
|
||||
int m_creativeSlotX, m_creativeSlotY, m_inventorySlotX, m_inventorySlotY;
|
||||
class IUIScene_CreativeMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
friend class CreativeInventoryScreen;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
IUIScene_CreativeMenu();
|
||||
// 4J Stu - These map directly to the tabs seenon the screen
|
||||
enum ECreativeInventoryTabs {
|
||||
eCreativeInventoryTab_BuildingBlocks = 0,
|
||||
eCreativeInventoryTab_Decorations,
|
||||
eCreativeInventoryTab_RedstoneAndTransport,
|
||||
eCreativeInventoryTab_Materials,
|
||||
eCreativeInventoryTab_Food,
|
||||
eCreativeInventoryTab_ToolsWeaponsArmor,
|
||||
eCreativeInventoryTab_Brewing,
|
||||
eCreativeInventoryTab_Misc,
|
||||
eCreativeInventoryTab_COUNT,
|
||||
};
|
||||
|
||||
// 4J Stu - These are logical groupings of items, and be be combined for
|
||||
// tabs on-screen
|
||||
enum ECreative_Inventory_Groups {
|
||||
eCreativeInventory_BuildingBlocks,
|
||||
eCreativeInventory_Decoration,
|
||||
eCreativeInventory_Redstone,
|
||||
eCreativeInventory_Transport,
|
||||
eCreativeInventory_Materials,
|
||||
eCreativeInventory_Food,
|
||||
eCreativeInventory_ToolsArmourWeapons,
|
||||
eCreativeInventory_Brewing,
|
||||
eCreativeInventory_Potions_Basic,
|
||||
eCreativeInventory_Potions_Level2,
|
||||
eCreativeInventory_Potions_Extended,
|
||||
eCreativeInventory_Potions_Level2_Extended,
|
||||
eCreativeInventory_Misc,
|
||||
eCreativeInventoryGroupsCount
|
||||
};
|
||||
|
||||
// 4J JEV - Keeping all the tab specifications in one place.
|
||||
struct TabSpec {
|
||||
public:
|
||||
// 4J JEV - Layout
|
||||
static const int rows = 5;
|
||||
static const int columns = 10;
|
||||
static const int MAX_SIZE = rows * columns;
|
||||
|
||||
// 4J JEV - Images
|
||||
const wchar_t* m_icon;
|
||||
const int m_descriptionId;
|
||||
const int m_staticGroupsCount;
|
||||
ECreative_Inventory_Groups* m_staticGroupsA;
|
||||
const int m_dynamicGroupsCount;
|
||||
ECreative_Inventory_Groups* m_dynamicGroupsA;
|
||||
|
||||
private:
|
||||
unsigned int m_pages;
|
||||
unsigned int m_staticPerPage;
|
||||
unsigned int m_staticItems;
|
||||
|
||||
public:
|
||||
TabSpec(const wchar_t* icon, int descriptionId, int staticGroupsCount,
|
||||
ECreative_Inventory_Groups* staticGroups,
|
||||
int dynamicGroupsCount,
|
||||
ECreative_Inventory_Groups* dynamicGroups);
|
||||
~TabSpec();
|
||||
|
||||
void populateMenu(AbstractContainerMenu* menu, int dynamicIndex,
|
||||
unsigned int page);
|
||||
unsigned int getPageCount();
|
||||
};
|
||||
|
||||
class ItemPickerMenu : public AbstractContainerMenu {
|
||||
protected:
|
||||
std::shared_ptr<SimpleContainer> creativeContainer;
|
||||
std::shared_ptr<Inventory> inventory;
|
||||
|
||||
public:
|
||||
ItemPickerMenu(std::shared_ptr<SimpleContainer> creativeContainer,
|
||||
std::shared_ptr<Inventory> inventory);
|
||||
|
||||
virtual bool stillValid(std::shared_ptr<Player> player);
|
||||
bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||
|
||||
protected:
|
||||
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in
|
||||
// creative
|
||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld,
|
||||
std::shared_ptr<Player> player) {} // do nothing
|
||||
}* itemPickerMenu;
|
||||
|
||||
protected:
|
||||
ECreativeInventoryTabs m_curTab;
|
||||
int m_tabDynamicPos[eCreativeInventoryTab_COUNT];
|
||||
int m_tabPage[eCreativeInventoryTab_COUNT];
|
||||
static std::vector<std::shared_ptr<ItemInstance> >
|
||||
categoryGroups[eCreativeInventoryGroupsCount];
|
||||
// 4J JEV - Tabs
|
||||
static TabSpec** specs;
|
||||
|
||||
void switchTab(ECreativeInventoryTabs tab);
|
||||
virtual void updateTabHighlightAndText(ECreativeInventoryTabs tab) = 0;
|
||||
virtual void updateScrollCurrentPage(int currentPage, int pageCount) = 0;
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, bool quickKeyHeld);
|
||||
virtual void handleOutsideClicked(int iPad, int buttonNum, bool quickKeyHeld);
|
||||
virtual void handleAdditionalKeyPress(int iAction);
|
||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, bool quickKeyHeld);
|
||||
bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual bool IsSectionSlotList( ESceneSection eSection );
|
||||
virtual bool CanHaveFocus( ESceneSection eSection );
|
||||
bool m_bCarryingCreativeItem;
|
||||
int m_creativeSlotX, m_creativeSlotY, m_inventorySlotX, m_inventorySlotY;
|
||||
|
||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
|
||||
public:
|
||||
static void staticCtor();
|
||||
IUIScene_CreativeMenu();
|
||||
|
||||
protected:
|
||||
ECreativeInventoryTabs m_curTab;
|
||||
int m_tabDynamicPos[eCreativeInventoryTab_COUNT];
|
||||
int m_tabPage[eCreativeInventoryTab_COUNT];
|
||||
|
||||
void switchTab(ECreativeInventoryTabs tab);
|
||||
virtual void updateTabHighlightAndText(ECreativeInventoryTabs tab) = 0;
|
||||
virtual void updateScrollCurrentPage(int currentPage, int pageCount) = 0;
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
virtual bool handleValidKeyPress(int iUserIndex, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
virtual void handleOutsideClicked(int iPad, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
virtual void handleAdditionalKeyPress(int iAction);
|
||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum,
|
||||
bool quickKeyHeld);
|
||||
bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int& slotX);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual bool IsSectionSlotList(ESceneSection eSection);
|
||||
virtual bool CanHaveFocus(ESceneSection eSection);
|
||||
|
||||
virtual bool overrideTooltips(
|
||||
ESceneSection sectionUnderPointer,
|
||||
std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried,
|
||||
bool bSlotHasItem, bool bCarriedIsSameAsSlot,
|
||||
int iSlotStackSizeRemaining, EToolTipItem& buttonA,
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT);
|
||||
};
|
||||
|
||||
@@ -3,75 +3,67 @@
|
||||
#include "IUIScene_DispenserMenu.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_DispenserMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_DispenserMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionTrapTrap:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionTrapInventory;
|
||||
xOffset = -TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionTrapUsing;
|
||||
xOffset = -TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
break;
|
||||
case eSectionTrapInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionTrapUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionTrapTrap;
|
||||
xOffset = TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
break;
|
||||
case eSectionTrapUsing:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionTrapTrap;
|
||||
xOffset = TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionTrapInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionTrapTrap:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionTrapInventory;
|
||||
xOffset = -TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionTrapUsing;
|
||||
xOffset = -TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
break;
|
||||
case eSectionTrapInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionTrapUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionTrapTrap;
|
||||
xOffset = TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
}
|
||||
break;
|
||||
case eSectionTrapUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionTrapTrap;
|
||||
xOffset = TRAP_SCENE_TRAP_SLOT_OFFSET;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionTrapInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_DispenserMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionTrapTrap:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionTrapInventory:
|
||||
offset = 9;
|
||||
break;
|
||||
case eSectionTrapUsing:
|
||||
offset = 9 + 27;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_DispenserMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionTrapTrap:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionTrapInventory:
|
||||
offset = 9;
|
||||
break;
|
||||
case eSectionTrapUsing:
|
||||
offset = 9 + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@@ -4,9 +4,11 @@
|
||||
// The 0-indexed slot in the inventory list that lines up with the result slot
|
||||
#define TRAP_SCENE_TRAP_SLOT_OFFSET 3
|
||||
|
||||
class IUIScene_DispenserMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_DispenserMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
@@ -4,122 +4,97 @@
|
||||
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
|
||||
#include "IUIScene_EnchantingMenu.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_EnchantingMenu::GetSectionAndSlotInDirection( IUIScene_AbstractContainerMenu::ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
IUIScene_AbstractContainerMenu::ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_EnchantingMenu::GetSectionAndSlotInDirection(
|
||||
IUIScene_AbstractContainerMenu::ESceneSection eSection,
|
||||
ETapState eTapDirection, int* piTargetX, int* piTargetY) {
|
||||
IUIScene_AbstractContainerMenu::ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionEnchantInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionEnchantUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
if( *piTargetX >= ENCHANT_SCENE_ENCHANT_BUTTONS_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionEnchantButton3;
|
||||
}
|
||||
else
|
||||
{
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantUsing:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
if( *piTargetX >= ENCHANT_SCENE_ENCHANT_BUTTONS_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionEnchantButton1;
|
||||
}
|
||||
else
|
||||
{
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionEnchantInventory;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantSlot:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionEnchantInventory;
|
||||
xOffset = ENCHANT_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionEnchantUsing;
|
||||
xOffset = ENCHANT_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft || eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionEnchantButton1;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton1:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionEnchantButton2;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionEnchantUsing;
|
||||
xOffset = ENCHANT_SCENE_ENCHANT_BUTTONS_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft || eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton2:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionEnchantButton3;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionEnchantButton1;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft || eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton3:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionEnchantInventory;
|
||||
xOffset = ENCHANT_SCENE_ENCHANT_BUTTONS_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionEnchantButton2;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft || eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionEnchantInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionEnchantUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX >= ENCHANT_SCENE_ENCHANT_BUTTONS_UP_OFFSET) {
|
||||
newSection = eSectionEnchantButton3;
|
||||
} else {
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (*piTargetX >= ENCHANT_SCENE_ENCHANT_BUTTONS_UP_OFFSET) {
|
||||
newSection = eSectionEnchantButton1;
|
||||
} else {
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionEnchantInventory;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantSlot:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionEnchantInventory;
|
||||
xOffset = ENCHANT_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionEnchantUsing;
|
||||
xOffset = ENCHANT_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft ||
|
||||
eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionEnchantButton1;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton1:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionEnchantButton2;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionEnchantUsing;
|
||||
xOffset = ENCHANT_SCENE_ENCHANT_BUTTONS_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft ||
|
||||
eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton2:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionEnchantButton3;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionEnchantButton1;
|
||||
} else if (eTapDirection == eTapStateLeft ||
|
||||
eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
case eSectionEnchantButton3:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionEnchantInventory;
|
||||
xOffset = ENCHANT_SCENE_ENCHANT_BUTTONS_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionEnchantButton2;
|
||||
} else if (eTapDirection == eTapStateLeft ||
|
||||
eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionEnchantSlot;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
void IUIScene_EnchantingMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey)
|
||||
{
|
||||
int index = -1;
|
||||
// Old xui code
|
||||
void IUIScene_EnchantingMenu::handleOtherClicked(int iPad,
|
||||
ESceneSection eSection,
|
||||
int buttonNum, bool quickKey) {
|
||||
int index = -1;
|
||||
// Old xui code
|
||||
#if 0
|
||||
HXUIOBJ hFocusObject = GetFocus(iPad);
|
||||
if(hFocusObject == m_enchant1->m_hObj) index = 0;
|
||||
@@ -127,63 +102,60 @@ void IUIScene_EnchantingMenu::handleOtherClicked(int iPad, ESceneSection eSectio
|
||||
else if(hFocusObject == m_enchant3->m_hObj) index = 2;
|
||||
#endif
|
||||
|
||||
switch(eSection)
|
||||
{
|
||||
case eSectionEnchantButton1:
|
||||
index = 0;
|
||||
break;
|
||||
case eSectionEnchantButton2:
|
||||
index = 1;
|
||||
break;
|
||||
case eSectionEnchantButton3:
|
||||
index = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if (index >= 0 && m_menu->clickMenuButton(std::dynamic_pointer_cast<Player>(pMinecraft->localplayers[iPad]), index))
|
||||
{
|
||||
pMinecraft->localgameModes[iPad]->handleInventoryButtonClick(m_menu->containerId, index);
|
||||
}
|
||||
switch (eSection) {
|
||||
case eSectionEnchantButton1:
|
||||
index = 0;
|
||||
break;
|
||||
case eSectionEnchantButton2:
|
||||
index = 1;
|
||||
break;
|
||||
case eSectionEnchantButton3:
|
||||
index = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (index >= 0 &&
|
||||
m_menu->clickMenuButton(
|
||||
std::dynamic_pointer_cast<Player>(pMinecraft->localplayers[iPad]),
|
||||
index)) {
|
||||
pMinecraft->localgameModes[iPad]->handleInventoryButtonClick(
|
||||
m_menu->containerId, index);
|
||||
}
|
||||
}
|
||||
|
||||
int IUIScene_EnchantingMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionEnchantSlot:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionEnchantInventory:
|
||||
offset = 1;
|
||||
break;
|
||||
case eSectionEnchantUsing:
|
||||
offset = 1 + 27;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
};
|
||||
return offset;
|
||||
int IUIScene_EnchantingMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionEnchantSlot:
|
||||
offset = 0;
|
||||
break;
|
||||
case eSectionEnchantInventory:
|
||||
offset = 1;
|
||||
break;
|
||||
case eSectionEnchantUsing:
|
||||
offset = 1 + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
return offset;
|
||||
}
|
||||
|
||||
bool IUIScene_EnchantingMenu::IsSectionSlotList( ESceneSection eSection )
|
||||
{
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionEnchantInventory:
|
||||
case eSectionEnchantUsing:
|
||||
case eSectionEnchantSlot:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
bool IUIScene_EnchantingMenu::IsSectionSlotList(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionEnchantInventory:
|
||||
case eSectionEnchantUsing:
|
||||
case eSectionEnchantSlot:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EnchantmentMenu *IUIScene_EnchantingMenu::getMenu()
|
||||
{
|
||||
return (EnchantmentMenu *)m_menu;
|
||||
EnchantmentMenu* IUIScene_EnchantingMenu::getMenu() {
|
||||
return (EnchantmentMenu*)m_menu;
|
||||
}
|
||||
|
||||
@@ -10,14 +10,17 @@
|
||||
|
||||
class EnchantmentMenu;
|
||||
|
||||
class IUIScene_EnchantingMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_EnchantingMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual bool IsSectionSlotList( ESceneSection eSection );
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual bool IsSectionSlotList(ESceneSection eSection);
|
||||
|
||||
public:
|
||||
EnchantmentMenu *getMenu();
|
||||
EnchantmentMenu* getMenu();
|
||||
};
|
||||
@@ -3,139 +3,107 @@
|
||||
#include "IUIScene_FurnaceMenu.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_FurnaceMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_FurnaceMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionFurnaceResult:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionFurnaceUsing;
|
||||
xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionFurnaceInventory;
|
||||
xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceIngredient:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionFurnaceUsing;
|
||||
xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionFurnaceFuel;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceFuel:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionFurnaceInventory;
|
||||
xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
else if(eTapDirection == eTapStateLeft)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
else if(eTapDirection == eTapStateRight)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionFurnaceUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
newSection = eSectionFurnaceFuel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceUsing:
|
||||
if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionFurnaceInventory;
|
||||
}
|
||||
else if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET)
|
||||
{
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionFurnaceResult:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFurnaceUsing;
|
||||
xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFurnaceInventory;
|
||||
xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceIngredient:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFurnaceUsing;
|
||||
xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFurnaceFuel;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceFuel:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFurnaceInventory;
|
||||
xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFurnaceUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
} else {
|
||||
newSection = eSectionFurnaceFuel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionFurnaceUsing:
|
||||
if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFurnaceInventory;
|
||||
} else if (eTapDirection == eTapStateDown) {
|
||||
if (*piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) {
|
||||
newSection = eSectionFurnaceResult;
|
||||
} else {
|
||||
newSection = eSectionFurnaceIngredient;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_FurnaceMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionFurnaceResult:
|
||||
offset = FurnaceMenu::RESULT_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceFuel:
|
||||
offset = FurnaceMenu::FUEL_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceIngredient:
|
||||
offset = FurnaceMenu::INGREDIENT_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceInventory:
|
||||
offset = FurnaceMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionFurnaceUsing:
|
||||
offset = FurnaceMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_FurnaceMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionFurnaceResult:
|
||||
offset = FurnaceMenu::RESULT_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceFuel:
|
||||
offset = FurnaceMenu::FUEL_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceIngredient:
|
||||
offset = FurnaceMenu::INGREDIENT_SLOT;
|
||||
break;
|
||||
case eSectionFurnaceInventory:
|
||||
offset = FurnaceMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionFurnaceUsing:
|
||||
offset = FurnaceMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@@ -7,9 +7,11 @@
|
||||
#define FURNACE_SCENE_FUEL_SLOT_UP_OFFSET 0
|
||||
#define FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET -3
|
||||
|
||||
class IUIScene_FurnaceMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_FurnaceMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
@@ -3,70 +3,62 @@
|
||||
#include "IUIScene_InventoryMenu.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_InventoryMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
|
||||
{
|
||||
ESceneSection newSection = eSection;
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_InventoryMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionInventoryArmor:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionInventoryInventory;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionInventoryUsing;
|
||||
}
|
||||
break;
|
||||
case eSectionInventoryInventory:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionInventoryUsing;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionInventoryArmor;
|
||||
}
|
||||
break;
|
||||
case eSectionInventoryUsing:
|
||||
if(eTapDirection == eTapStateDown)
|
||||
{
|
||||
newSection = eSectionInventoryArmor;
|
||||
}
|
||||
else if(eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionInventoryInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionInventoryArmor:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionInventoryInventory;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionInventoryUsing;
|
||||
}
|
||||
break;
|
||||
case eSectionInventoryInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionInventoryUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionInventoryArmor;
|
||||
}
|
||||
break;
|
||||
case eSectionInventoryUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionInventoryArmor;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionInventoryInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0);
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, 0);
|
||||
|
||||
return newSection;
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection)
|
||||
{
|
||||
int offset = 0;
|
||||
switch( eSection )
|
||||
{
|
||||
case eSectionInventoryArmor:
|
||||
offset = InventoryMenu::ARMOR_SLOT_START;
|
||||
break;
|
||||
case eSectionInventoryInventory:
|
||||
offset = InventoryMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionInventoryUsing:
|
||||
offset = InventoryMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionInventoryArmor:
|
||||
offset = InventoryMenu::ARMOR_SLOT_START;
|
||||
break;
|
||||
case eSectionInventoryInventory:
|
||||
offset = InventoryMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionInventoryUsing:
|
||||
offset = InventoryMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
#include "IUIScene_AbstractContainerMenu.h"
|
||||
|
||||
class IUIScene_InventoryMenu : public virtual IUIScene_AbstractContainerMenu
|
||||
{
|
||||
class IUIScene_InventoryMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
class IUIScene_PauseMenu
|
||||
{
|
||||
class IUIScene_PauseMenu {
|
||||
protected:
|
||||
DLCPack *m_pDLCPack;
|
||||
DLCPack* m_pDLCPack;
|
||||
|
||||
public:
|
||||
static int ExitGameDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameDeclineSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int SaveGameDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int EnableAutosaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int DisableAutosaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int ExitGameSaveDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int ExitGameAndSaveReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int ExitGameDeclineSaveReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int WarningTrialTexturePackReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result);
|
||||
static int SaveGameDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int EnableAutosaveDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int DisableAutosaveDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
|
||||
static int SaveWorldThreadProc( void* lpParameter );
|
||||
static int ExitWorldThreadProc( void* lpParameter );
|
||||
static void _ExitWorld(void *lpParameter); // Call only from a thread
|
||||
static int SaveWorldThreadProc(void* lpParameter);
|
||||
static int ExitWorldThreadProc(void* lpParameter);
|
||||
static void _ExitWorld(void* lpParameter); // Call only from a thread
|
||||
|
||||
protected:
|
||||
virtual void ShowScene(bool show) = 0;
|
||||
virtual void SetIgnoreInput(bool ignoreInput) = 0;
|
||||
virtual void ShowScene(bool show) = 0;
|
||||
virtual void SetIgnoreInput(bool ignoreInput) = 0;
|
||||
};
|
||||
|
||||
@@ -5,377 +5,354 @@
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "IUIScene_StartGame.h"
|
||||
|
||||
IUIScene_StartGame::IUIScene_StartGame(int iPad, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
m_bIgnoreInput = false;
|
||||
m_iTexturePacksNotInstalled=0;
|
||||
m_texturePackDescDisplayed = false;
|
||||
m_bShowTexturePackDescription = false;
|
||||
m_iSetTexturePackDescription = -1;
|
||||
IUIScene_StartGame::IUIScene_StartGame(int iPad, UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
m_bIgnoreInput = false;
|
||||
m_iTexturePacksNotInstalled = 0;
|
||||
m_texturePackDescDisplayed = false;
|
||||
m_bShowTexturePackDescription = false;
|
||||
m_iSetTexturePackDescription = -1;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
m_currentTexturePackIndex = pMinecraft->skins->getTexturePackIndex(0);
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
m_currentTexturePackIndex = pMinecraft->skins->getTexturePackIndex(0);
|
||||
}
|
||||
|
||||
void IUIScene_StartGame::HandleDLCMountingComplete()
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
// clear out the current texture pack list
|
||||
m_texturePackList.clearSlots();
|
||||
void IUIScene_StartGame::HandleDLCMountingComplete() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
// clear out the current texture pack list
|
||||
m_texturePackList.clearSlots();
|
||||
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
|
||||
|
||||
for(unsigned int i = 0; i < texturePacksCount; ++i)
|
||||
{
|
||||
TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
for (unsigned int i = 0; i < texturePacksCount; ++i) {
|
||||
TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
|
||||
std::uint32_t imageBytes = 0;
|
||||
std::uint8_t *imageData = tp->getPackIcon(imageBytes);
|
||||
std::uint32_t imageBytes = 0;
|
||||
std::uint8_t* imageData = tp->getPackIcon(imageBytes);
|
||||
|
||||
if(imageBytes > 0 && imageData)
|
||||
{
|
||||
wchar_t imageName[64];
|
||||
swprintf(imageName,64,L"tpack%08x",tp->getId());
|
||||
registerSubstitutionTexture(imageName, imageData, imageBytes);
|
||||
m_texturePackList.addPack(i,imageName);
|
||||
}
|
||||
}
|
||||
if (imageBytes > 0 && imageData) {
|
||||
wchar_t imageName[64];
|
||||
swprintf(imageName, 64, L"tpack%08x", tp->getId());
|
||||
registerSubstitutionTexture(imageName, imageData, imageBytes);
|
||||
m_texturePackList.addPack(i, imageName);
|
||||
}
|
||||
}
|
||||
|
||||
m_iTexturePacksNotInstalled=0;
|
||||
m_iTexturePacksNotInstalled = 0;
|
||||
|
||||
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
|
||||
// REMOVE UNTIL WORKING
|
||||
DLC_INFO *pDLCInfo=NULL;
|
||||
// 4J-PB - there may be texture packs we don't have, so use the info from
|
||||
// TMS for this REMOVE UNTIL WORKING
|
||||
DLC_INFO* pDLCInfo = NULL;
|
||||
|
||||
// first pass - look to see if there are any that are not in the list
|
||||
bool bTexturePackAlreadyListed;
|
||||
bool bNeedToGetTPD=false;
|
||||
// first pass - look to see if there are any that are not in the list
|
||||
bool bTexturePackAlreadyListed;
|
||||
bool bNeedToGetTPD = false;
|
||||
|
||||
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
||||
{
|
||||
bTexturePackAlreadyListed=false;
|
||||
for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) {
|
||||
bTexturePackAlreadyListed = false;
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
char *pchName=app.GetDLCInfoTextures(i);
|
||||
pDLCInfo=app.GetDLCInfo(pchName);
|
||||
char* pchName = app.GetDLCInfoTextures(i);
|
||||
pDLCInfo = app.GetDLCInfo(pchName);
|
||||
#elif defined _XBOX_ONE
|
||||
pDLCInfo=app.GetDLCInfoForFullOfferID(const_cast<wchar_t *>(app.GetDLCInfoTexturesFullOffer(i).c_str()));
|
||||
pDLCInfo = app.GetDLCInfoForFullOfferID(
|
||||
const_cast<wchar_t*>(app.GetDLCInfoTexturesFullOffer(i).c_str()));
|
||||
#else
|
||||
ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i);
|
||||
pDLCInfo=app.GetDLCInfoForFullOfferID(ull);
|
||||
ULONGLONG ull = app.GetDLCInfoTexturesFullOffer(i);
|
||||
pDLCInfo = app.GetDLCInfoForFullOfferID(ull);
|
||||
#endif
|
||||
for(unsigned int i = 0; i < texturePacksCount; ++i)
|
||||
{
|
||||
TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
if(pDLCInfo->iConfig==tp->getDLCParentPackId())
|
||||
{
|
||||
bTexturePackAlreadyListed=true;
|
||||
}
|
||||
}
|
||||
if(bTexturePackAlreadyListed==false)
|
||||
{
|
||||
// some missing
|
||||
bNeedToGetTPD=true;
|
||||
for (unsigned int i = 0; i < texturePacksCount; ++i) {
|
||||
TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
if (pDLCInfo->iConfig == tp->getDLCParentPackId()) {
|
||||
bTexturePackAlreadyListed = true;
|
||||
}
|
||||
}
|
||||
if (bTexturePackAlreadyListed == false) {
|
||||
// some missing
|
||||
bNeedToGetTPD = true;
|
||||
|
||||
m_iTexturePacksNotInstalled++;
|
||||
}
|
||||
}
|
||||
m_iTexturePacksNotInstalled++;
|
||||
}
|
||||
}
|
||||
|
||||
#if TO_BE_IMPLEMENTED
|
||||
if(bNeedToGetTPD==true)
|
||||
{
|
||||
// add a TMS request for them
|
||||
app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n");
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData);
|
||||
if(m_iConfigA!=NULL)
|
||||
{
|
||||
delete m_iConfigA;
|
||||
}
|
||||
m_iConfigA= new int [m_iTexturePacksNotInstalled];
|
||||
m_iTexturePacksNotInstalled=0;
|
||||
if (bNeedToGetTPD == true) {
|
||||
// add a TMS request for them
|
||||
app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n");
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData);
|
||||
if (m_iConfigA != NULL) {
|
||||
delete m_iConfigA;
|
||||
}
|
||||
m_iConfigA = new int[m_iTexturePacksNotInstalled];
|
||||
m_iTexturePacksNotInstalled = 0;
|
||||
|
||||
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
||||
{
|
||||
bTexturePackAlreadyListed=false;
|
||||
ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i);
|
||||
pDLCInfo=app.GetDLCInfoForFullOfferID(ull);
|
||||
for(unsigned int i = 0; i < texturePacksCount; ++i)
|
||||
{
|
||||
TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
if(pDLCInfo->iConfig==tp->getDLCParentPackId())
|
||||
{
|
||||
bTexturePackAlreadyListed=true;
|
||||
}
|
||||
}
|
||||
if(bTexturePackAlreadyListed==false)
|
||||
{
|
||||
m_iConfigA[m_iTexturePacksNotInstalled++]=pDLCInfo->iConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) {
|
||||
bTexturePackAlreadyListed = false;
|
||||
ULONGLONG ull = app.GetDLCInfoTexturesFullOffer(i);
|
||||
pDLCInfo = app.GetDLCInfoForFullOfferID(ull);
|
||||
for (unsigned int i = 0; i < texturePacksCount; ++i) {
|
||||
TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(i);
|
||||
if (pDLCInfo->iConfig == tp->getDLCParentPackId()) {
|
||||
bTexturePackAlreadyListed = true;
|
||||
}
|
||||
}
|
||||
if (bTexturePackAlreadyListed == false) {
|
||||
m_iConfigA[m_iTexturePacksNotInstalled++] = pDLCInfo->iConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
m_currentTexturePackIndex = pMinecraft->skins->getTexturePackIndex(0);
|
||||
UpdateTexturePackDescription(m_currentTexturePackIndex);
|
||||
m_currentTexturePackIndex = pMinecraft->skins->getTexturePackIndex(0);
|
||||
UpdateTexturePackDescription(m_currentTexturePackIndex);
|
||||
|
||||
m_texturePackList.selectSlot(m_currentTexturePackIndex);
|
||||
m_bIgnoreInput=false;
|
||||
app.m_dlcManager.checkForCorruptDLCAndAlert();
|
||||
m_texturePackList.selectSlot(m_currentTexturePackIndex);
|
||||
m_bIgnoreInput = false;
|
||||
app.m_dlcManager.checkForCorruptDLCAndAlert();
|
||||
}
|
||||
|
||||
void IUIScene_StartGame::handleSelectionChanged(F64 selectedId)
|
||||
{
|
||||
m_iSetTexturePackDescription = (int)selectedId;
|
||||
void IUIScene_StartGame::handleSelectionChanged(F64 selectedId) {
|
||||
m_iSetTexturePackDescription = (int)selectedId;
|
||||
|
||||
if(!m_texturePackDescDisplayed)
|
||||
{
|
||||
m_bShowTexturePackDescription = true;
|
||||
}
|
||||
if (!m_texturePackDescDisplayed) {
|
||||
m_bShowTexturePackDescription = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IUIScene_StartGame::UpdateTexturePackDescription(int index)
|
||||
{
|
||||
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(index);
|
||||
void IUIScene_StartGame::UpdateTexturePackDescription(int index) {
|
||||
TexturePack* tp =
|
||||
Minecraft::GetInstance()->skins->getTexturePackByIndex(index);
|
||||
|
||||
if(tp==NULL)
|
||||
{
|
||||
#if TO_BE_IMPLEMENTED
|
||||
// this is probably a texture pack icon added from TMS
|
||||
|
||||
unsigned int dwBytes=0;
|
||||
unsigned int dwFileBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
std::uint8_t *pbFileData=NULL;
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem=m_pTexturePacksList->GetData(index);
|
||||
|
||||
app.GetTPD(ListItem.iData,&pbData,&dwBytes);
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Loc,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
StringTable *pStringTable = new StringTable(pbFileData, dwFileBytes);
|
||||
m_texturePackTitle.SetText(pStringTable->getString(L"IDS_DISPLAY_NAME"));
|
||||
m_texturePackDescription.SetText(pStringTable->getString(L"IDS_TP_DESCRIPTION"));
|
||||
}
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush);
|
||||
m_texturePackIcon->UseBrush(m_hTexturePackIconBrush);
|
||||
}
|
||||
app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush);
|
||||
m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_texturePackComparison->UseBrush(NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
m_labelTexturePackName.setLabel(tp->getName());
|
||||
m_labelTexturePackDescription.setLabel(tp->getDesc1());
|
||||
|
||||
std::uint32_t imageBytes = 0;
|
||||
std::uint8_t *imageData = tp->getPackIcon(imageBytes);
|
||||
|
||||
//if(imageBytes > 0 && imageData)
|
||||
//{
|
||||
// registerSubstitutionTexture(L"texturePackIcon", imageData, imageBytes);
|
||||
// m_bitmapTexturePackIcon.setTextureName(L"texturePackIcon");
|
||||
//}
|
||||
|
||||
wchar_t imageName[64];
|
||||
swprintf(imageName,64,L"tpack%08x",tp->getId());
|
||||
m_bitmapTexturePackIcon.setTextureName(imageName);
|
||||
|
||||
imageData = tp->getPackComparison(imageBytes);
|
||||
|
||||
if(imageBytes > 0 && imageData)
|
||||
{
|
||||
swprintf(imageName,64,L"texturePackComparison%08x",tp->getId());
|
||||
registerSubstitutionTexture(imageName, imageData, imageBytes);
|
||||
m_bitmapComparison.setTextureName(imageName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bitmapComparison.setTextureName(L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot)
|
||||
{
|
||||
m_currentTexturePackIndex = iSlot;
|
||||
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(m_currentTexturePackIndex);
|
||||
|
||||
// if the texture pack is null, you don't have it yet
|
||||
if(tp==NULL)
|
||||
{
|
||||
if (tp == NULL) {
|
||||
#if TO_BE_IMPLEMENTED
|
||||
// Upsell
|
||||
// this is probably a texture pack icon added from TMS
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem=m_pTexturePacksList->GetData(m_currentTexturePackIndex);
|
||||
unsigned int dwBytes = 0;
|
||||
unsigned int dwFileBytes = 0;
|
||||
std::uint8_t* pbData = NULL;
|
||||
std::uint8_t* pbFileData = NULL;
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem = m_pTexturePacksList->GetData(index);
|
||||
|
||||
// upsell the texture pack
|
||||
// tell sentient about the upsell of the full version of the skin pack
|
||||
ULONGLONG ullOfferID_Full;
|
||||
app.GetDLCFullOfferIDForPackID(ListItem.iData,&ullOfferID_Full);
|
||||
app.GetTPD(ListItem.iData, &pbData, &dwBytes);
|
||||
|
||||
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF);
|
||||
app.GetFileFromTPD(eTPDFileType_Loc, pbData, dwBytes, &pbFileData,
|
||||
&dwFileBytes);
|
||||
if (dwFileBytes > 0 && pbFileData) {
|
||||
StringTable* pStringTable =
|
||||
new StringTable(pbFileData, dwFileBytes);
|
||||
m_texturePackTitle.SetText(
|
||||
pStringTable->getString(L"IDS_DISPLAY_NAME"));
|
||||
m_texturePackDescription.SetText(
|
||||
pStringTable->getString(L"IDS_TP_DESCRIPTION"));
|
||||
}
|
||||
|
||||
unsigned int uiIDA[3];
|
||||
|
||||
uiIDA[0]=IDS_TEXTUREPACK_FULLVERSION;
|
||||
uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION;
|
||||
uiIDA[2]=IDS_CONFIRM_CANCEL;
|
||||
|
||||
|
||||
// Give the player a warning about the texture pack missing
|
||||
ui.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 3, ProfileManager.GetPrimaryPad(),&:TexturePackDialogReturned,this,app.GetStringTable());
|
||||
|
||||
// do set the texture pack id, and on the user pressing create world, check they have it
|
||||
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
|
||||
return ;
|
||||
app.GetFileFromTPD(eTPDFileType_Icon, pbData, dwBytes, &pbFileData,
|
||||
&dwFileBytes);
|
||||
if (dwFileBytes > 0 && pbFileData) {
|
||||
XuiCreateTextureBrushFromMemory(pbFileData, dwFileBytes,
|
||||
&m_hTexturePackIconBrush);
|
||||
m_texturePackIcon->UseBrush(m_hTexturePackIconBrush);
|
||||
}
|
||||
app.GetFileFromTPD(eTPDFileType_Comparison, pbData, dwBytes,
|
||||
&pbFileData, &dwFileBytes);
|
||||
if (dwFileBytes > 0 && pbFileData) {
|
||||
XuiCreateTextureBrushFromMemory(pbFileData, dwFileBytes,
|
||||
&m_hTexturePackComparisonBrush);
|
||||
m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush);
|
||||
} else {
|
||||
m_texturePackComparison->UseBrush(NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MoreOptionsParams.dwTexturePack = tp->getId();
|
||||
}
|
||||
} else {
|
||||
m_labelTexturePackName.setLabel(tp->getName());
|
||||
m_labelTexturePackDescription.setLabel(tp->getDesc1());
|
||||
|
||||
std::uint32_t imageBytes = 0;
|
||||
std::uint8_t* imageData = tp->getPackIcon(imageBytes);
|
||||
|
||||
// if(imageBytes > 0 && imageData)
|
||||
//{
|
||||
// registerSubstitutionTexture(L"texturePackIcon", imageData,
|
||||
//imageBytes);
|
||||
// m_bitmapTexturePackIcon.setTextureName(L"texturePackIcon");
|
||||
// }
|
||||
|
||||
wchar_t imageName[64];
|
||||
swprintf(imageName, 64, L"tpack%08x", tp->getId());
|
||||
m_bitmapTexturePackIcon.setTextureName(imageName);
|
||||
|
||||
imageData = tp->getPackComparison(imageBytes);
|
||||
|
||||
if (imageBytes > 0 && imageData) {
|
||||
swprintf(imageName, 64, L"texturePackComparison%08x", tp->getId());
|
||||
registerSubstitutionTexture(imageName, imageData, imageBytes);
|
||||
m_bitmapComparison.setTextureName(imageName);
|
||||
} else {
|
||||
m_bitmapComparison.setTextureName(L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int IUIScene_StartGame::TrialTexturePackWarningReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam;
|
||||
void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) {
|
||||
m_currentTexturePackIndex = iSlot;
|
||||
TexturePack* tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(
|
||||
m_currentTexturePackIndex);
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
pScene->checkStateAndStartGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
pScene->m_bIgnoreInput=false;
|
||||
}
|
||||
return 0;
|
||||
// if the texture pack is null, you don't have it yet
|
||||
if (tp == NULL) {
|
||||
#if TO_BE_IMPLEMENTED
|
||||
// Upsell
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem = m_pTexturePacksList->GetData(m_currentTexturePackIndex);
|
||||
|
||||
// upsell the texture pack
|
||||
// tell sentient about the upsell of the full version of the skin pack
|
||||
ULONGLONG ullOfferID_Full;
|
||||
app.GetDLCFullOfferIDForPackID(ListItem.iData, &ullOfferID_Full);
|
||||
|
||||
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(),
|
||||
eSet_UpsellID_Texture_DLC,
|
||||
ullOfferID_Full & 0xFFFFFFFF);
|
||||
|
||||
unsigned int uiIDA[3];
|
||||
|
||||
uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION;
|
||||
uiIDA[1] = IDS_TEXTURE_PACK_TRIALVERSION;
|
||||
uiIDA[2] = IDS_CONFIRM_CANCEL;
|
||||
|
||||
// Give the player a warning about the texture pack missing
|
||||
ui.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE,
|
||||
IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
& : TexturePackDialogReturned, this,
|
||||
app.GetStringTable());
|
||||
|
||||
// do set the texture pack id, and on the user pressing create world,
|
||||
// check they have it
|
||||
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
|
||||
return;
|
||||
#endif
|
||||
} else {
|
||||
m_MoreOptionsParams.dwTexturePack = tp->getId();
|
||||
}
|
||||
}
|
||||
|
||||
int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam;
|
||||
int IUIScene_StartGame::TrialTexturePackWarningReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
if(ProfileManager.IsSignedIn(iPad))
|
||||
{
|
||||
#if defined _XBOX //|| defined _XBOX_ONE
|
||||
ULONGLONG ullIndexA[1];
|
||||
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
|
||||
if (result == C4JStorage::EMessage_ResultAccept) {
|
||||
pScene->checkStateAndStartGame();
|
||||
} else {
|
||||
pScene->m_bIgnoreInput = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pDLCInfo!=NULL)
|
||||
{
|
||||
ullIndexA[0]=pDLCInfo->ullOfferID_Full;
|
||||
}
|
||||
else
|
||||
{
|
||||
ullIndexA[0]=pScene->m_pDLCPack->getPurchaseOfferId();
|
||||
}
|
||||
int IUIScene_StartGame::UnlockTexturePackReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam;
|
||||
|
||||
if (result == C4JStorage::EMessage_ResultAccept) {
|
||||
if (ProfileManager.IsSignedIn(iPad)) {
|
||||
#if defined _XBOX //|| defined _XBOX_ONE
|
||||
ULONGLONG ullIndexA[1];
|
||||
DLC_INFO* pDLCInfo = app.GetDLCInfoForTrialOfferID(
|
||||
pScene->m_pDLCPack->getPurchaseOfferId());
|
||||
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
if (pDLCInfo != NULL) {
|
||||
ullIndexA[0] = pDLCInfo->ullOfferID_Full;
|
||||
} else {
|
||||
ullIndexA[0] = pScene->m_pDLCPack->getPurchaseOfferId();
|
||||
}
|
||||
|
||||
StorageManager.InstallOffer(1, ullIndexA, NULL, NULL);
|
||||
#elif defined _XBOX_ONE
|
||||
//StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL);
|
||||
// StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL);
|
||||
#endif
|
||||
|
||||
// the license change coming in when the offer has been installed will cause this scene to refresh
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// the license change coming in when the offer has been installed
|
||||
// will cause this scene to refresh
|
||||
}
|
||||
} else {
|
||||
#if defined _XBOX
|
||||
TelemetryManager->RecordUpsellResponded(iPad, eSet_UpsellID_Texture_DLC, ( pScene->m_pDLCPack->getPurchaseOfferId() & 0xFFFFFFFF ), eSen_UpsellOutcome_Declined);
|
||||
TelemetryManager->RecordUpsellResponded(
|
||||
iPad, eSet_UpsellID_Texture_DLC,
|
||||
(pScene->m_pDLCPack->getPurchaseOfferId() & 0xFFFFFFFF),
|
||||
eSen_UpsellOutcome_Declined);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
pScene->m_bIgnoreInput = false;
|
||||
pScene->m_bIgnoreInput = false;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
IUIScene_StartGame *pClass = (IUIScene_StartGame *)pParam;
|
||||
|
||||
int IUIScene_StartGame::TexturePackDialogReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_StartGame* pClass = (IUIScene_StartGame*)pParam;
|
||||
|
||||
#ifdef _XBOX
|
||||
// Exit with or without saving
|
||||
// Decline means install full version of the texture pack in this dialog
|
||||
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
// we need to enable background downloading for the DLC
|
||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||
// Exit with or without saving
|
||||
// Decline means install full version of the texture pack in this dialog
|
||||
if (result == C4JStorage::EMessage_ResultDecline ||
|
||||
result == C4JStorage::EMessage_ResultAccept) {
|
||||
// we need to enable background downloading for the DLC
|
||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||
|
||||
ULONGLONG ullOfferID_Full;
|
||||
ULONGLONG ullIndexA[1];
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem=pClass->m_pTexturePacksList->GetData(pClass->m_currentTexturePackIndex);
|
||||
app.GetDLCFullOfferIDForPackID(ListItem.iData,&ullOfferID_Full);
|
||||
ULONGLONG ullOfferID_Full;
|
||||
ULONGLONG ullIndexA[1];
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
ListItem = pClass->m_pTexturePacksList->GetData(
|
||||
pClass->m_currentTexturePackIndex);
|
||||
app.GetDLCFullOfferIDForPackID(ListItem.iData, &ullOfferID_Full);
|
||||
|
||||
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
|
||||
{
|
||||
ullIndexA[0]=ullOfferID_Full;
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
if (result == C4JStorage::EMessage_ResultAccept) // Full version
|
||||
{
|
||||
ullIndexA[0] = ullOfferID_Full;
|
||||
StorageManager.InstallOffer(1, ullIndexA, NULL, NULL);
|
||||
|
||||
}
|
||||
else // trial version
|
||||
{
|
||||
// if there is no trial version, this is a Cancel
|
||||
DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full);
|
||||
if(pDLCInfo->ullOfferID_Trial!=0LL)
|
||||
{
|
||||
|
||||
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else // trial version
|
||||
{
|
||||
// if there is no trial version, this is a Cancel
|
||||
DLC_INFO* pDLCInfo = app.GetDLCInfoForFullOfferID(ullOfferID_Full);
|
||||
if (pDLCInfo->ullOfferID_Trial != 0LL) {
|
||||
ullIndexA[0] = pDLCInfo->ullOfferID_Trial;
|
||||
StorageManager.InstallOffer(1, ullIndexA, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined _XBOX_ONE
|
||||
// Get the product id from the texture pack id
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
// Get the product id from the texture pack id
|
||||
if (result == C4JStorage::EMessage_ResultAccept) {
|
||||
if (ProfileManager.IsSignedIn(iPad)) {
|
||||
if (ProfileManager.IsSignedInLive(iPad)) {
|
||||
std::wstring ProductId;
|
||||
app.GetDLCFullOfferIDForPackID(
|
||||
pClass->m_MoreOptionsParams.dwTexturePack, ProductId);
|
||||
|
||||
if(ProfileManager.IsSignedIn(iPad))
|
||||
{
|
||||
if (ProfileManager.IsSignedInLive(iPad))
|
||||
{
|
||||
std::wstring ProductId;
|
||||
app.GetDLCFullOfferIDForPackID(pClass->m_MoreOptionsParams.dwTexturePack,ProductId);
|
||||
StorageManager.InstallOffer(
|
||||
1, const_cast<wchar_t*>(ProductId.c_str()), NULL, NULL);
|
||||
|
||||
|
||||
StorageManager.InstallOffer(1, const_cast<wchar_t *>(ProductId.c_str()), NULL, NULL);
|
||||
|
||||
// the license change coming in when the offer has been installed will cause this scene to refresh
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why.
|
||||
unsigned int uiIDA[1] = { IDS_CONFIRM_OK };
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
// the license change coming in when the offer has been
|
||||
// installed will cause this scene to refresh
|
||||
} else {
|
||||
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no
|
||||
// active network connection user is unable to convert from
|
||||
// Trial to Full texture pack and is not messaged why.
|
||||
unsigned int uiIDA[1] = {IDS_CONFIRM_OK};
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1,
|
||||
iPad, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
pClass->m_bIgnoreInput=false;
|
||||
return 0;
|
||||
pClass->m_bIgnoreInput = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,46 +3,48 @@
|
||||
#include "UIScene.h"
|
||||
|
||||
// Shared functions between CreteWorld, Load and Join
|
||||
class IUIScene_StartGame : public UIScene
|
||||
{
|
||||
class IUIScene_StartGame : public UIScene {
|
||||
protected:
|
||||
UIControl_TexturePackList m_texturePackList;
|
||||
UIControl_TexturePackList m_texturePackList;
|
||||
|
||||
UIControl m_controlTexturePackPanel;
|
||||
UIControl_Label m_labelTexturePackName, m_labelTexturePackDescription;
|
||||
UIControl_BitmapIcon m_bitmapTexturePackIcon, m_bitmapComparison;
|
||||
UIControl m_controlTexturePackPanel;
|
||||
UIControl_Label m_labelTexturePackName, m_labelTexturePackDescription;
|
||||
UIControl_BitmapIcon m_bitmapTexturePackIcon, m_bitmapComparison;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT( m_controlTexturePackPanel, "TexturePackPanel" )
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlTexturePackPanel )
|
||||
UI_MAP_ELEMENT( m_labelTexturePackName, "TexturePackName")
|
||||
UI_MAP_ELEMENT( m_labelTexturePackDescription, "TexturePackDescription")
|
||||
UI_MAP_ELEMENT( m_bitmapTexturePackIcon, "Icon")
|
||||
UI_MAP_ELEMENT( m_bitmapComparison, "ComparisonPic")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_controlTexturePackPanel, "TexturePackPanel")
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlTexturePackPanel)
|
||||
UI_MAP_ELEMENT(m_labelTexturePackName, "TexturePackName")
|
||||
UI_MAP_ELEMENT(m_labelTexturePackDescription, "TexturePackDescription")
|
||||
UI_MAP_ELEMENT(m_bitmapTexturePackIcon, "Icon")
|
||||
UI_MAP_ELEMENT(m_bitmapComparison, "ComparisonPic")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
LaunchMoreOptionsMenuInitData m_MoreOptionsParams;
|
||||
bool m_bIgnoreInput;
|
||||
|
||||
int m_iTexturePacksNotInstalled;
|
||||
unsigned int m_currentTexturePackIndex;
|
||||
bool m_bShowTexturePackDescription;
|
||||
bool m_texturePackDescDisplayed;
|
||||
int m_iSetTexturePackDescription;
|
||||
LaunchMoreOptionsMenuInitData m_MoreOptionsParams;
|
||||
bool m_bIgnoreInput;
|
||||
|
||||
IUIScene_StartGame(int iPad, UILayer *parentLayer);
|
||||
int m_iTexturePacksNotInstalled;
|
||||
unsigned int m_currentTexturePackIndex;
|
||||
bool m_bShowTexturePackDescription;
|
||||
bool m_texturePackDescDisplayed;
|
||||
int m_iSetTexturePackDescription;
|
||||
|
||||
virtual void checkStateAndStartGame() = 0;
|
||||
|
||||
virtual void handleSelectionChanged(F64 selectedId);
|
||||
IUIScene_StartGame(int iPad, UILayer* parentLayer);
|
||||
|
||||
virtual void HandleDLCMountingComplete();
|
||||
virtual void checkStateAndStartGame() = 0;
|
||||
|
||||
void UpdateTexturePackDescription(int index);
|
||||
void UpdateCurrentTexturePack(int iSlot);
|
||||
virtual void handleSelectionChanged(F64 selectedId);
|
||||
|
||||
static int TrialTexturePackWarningReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
virtual void HandleDLCMountingComplete();
|
||||
|
||||
void UpdateTexturePackDescription(int index);
|
||||
void UpdateCurrentTexturePack(int iSlot);
|
||||
|
||||
static int TrialTexturePackWarningReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result);
|
||||
static int UnlockTexturePackReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int TexturePackDialogReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
};
|
||||
@@ -7,381 +7,363 @@
|
||||
#include "../../Minecraft.Client/Network/ClientConnection.h"
|
||||
#include "IUIScene_TradingMenu.h"
|
||||
|
||||
IUIScene_TradingMenu::IUIScene_TradingMenu()
|
||||
{
|
||||
m_validOffersCount = 0;
|
||||
m_selectedSlot = 0;
|
||||
m_offersStartIndex = 0;
|
||||
m_menu = NULL;
|
||||
m_bHasUpdatedOnce = false;
|
||||
IUIScene_TradingMenu::IUIScene_TradingMenu() {
|
||||
m_validOffersCount = 0;
|
||||
m_selectedSlot = 0;
|
||||
m_offersStartIndex = 0;
|
||||
m_menu = NULL;
|
||||
m_bHasUpdatedOnce = false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
|
||||
{
|
||||
return m_merchant;
|
||||
std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant() {
|
||||
return m_merchant;
|
||||
}
|
||||
|
||||
bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||
{
|
||||
bool handled = false;
|
||||
//MerchantRecipeList *offers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
||||
bool handled = false;
|
||||
// MerchantRecipeList *offers =
|
||||
// m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
|
||||
bool changed = false;
|
||||
bool changed = false;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if( pMinecraft->localgameModes[getPad()] != NULL )
|
||||
{
|
||||
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
if(tutorial != NULL)
|
||||
{
|
||||
tutorial->handleUIInput(iAction);
|
||||
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pMinecraft->localgameModes[getPad()] != NULL) {
|
||||
Tutorial* tutorial =
|
||||
pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||
if (tutorial != NULL) {
|
||||
tutorial->handleUIInput(iAction);
|
||||
if (ui.IsTutorialVisible(getPad()) &&
|
||||
!tutorial->isInputAllowed(iAction)) {
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (iAction) {
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip(iPad, eToolTipButtonX, false);
|
||||
ui.ShowTooltip(iPad, eToolTipButtonB, false);
|
||||
ui.ShowTooltip(iPad, eToolTipButtonA, false);
|
||||
ui.ShowTooltip(iPad, eToolTipButtonRB, false);
|
||||
// kill the crafting xui
|
||||
// ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
||||
switch(iAction)
|
||||
{
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
// kill the crafting xui
|
||||
//ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_A:
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_A:
|
||||
#ifdef __ORBIS__
|
||||
case ACTION_MENU_TOUCHPAD_PRESS:
|
||||
case ACTION_MENU_TOUCHPAD_PRESS:
|
||||
#endif
|
||||
if(!m_activeOffers.empty())
|
||||
{
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if( selectedShopItem < m_activeOffers.size() )
|
||||
{
|
||||
MerchantRecipe *activeRecipe = m_activeOffers.at(selectedShopItem).first;
|
||||
if(!activeRecipe->isDeprecated())
|
||||
{
|
||||
// Do we have the ingredients?
|
||||
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
|
||||
{
|
||||
m_merchant->notifyTrade(activeRecipe);
|
||||
if (!m_activeOffers.empty()) {
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if (selectedShopItem < m_activeOffers.size()) {
|
||||
MerchantRecipe* activeRecipe =
|
||||
m_activeOffers.at(selectedShopItem).first;
|
||||
if (!activeRecipe->isDeprecated()) {
|
||||
// Do we have the ingredients?
|
||||
std::shared_ptr<ItemInstance> buyAItem =
|
||||
activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem =
|
||||
activeRecipe->getBuyBItem();
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||
Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches =
|
||||
player->inventory->countMatches(buyAItem);
|
||||
int buyBMatches =
|
||||
player->inventory->countMatches(buyBItem);
|
||||
if ((buyAItem != NULL &&
|
||||
buyAMatches >= buyAItem->count) &&
|
||||
(buyBItem == NULL ||
|
||||
buyBMatches >= buyBItem->count)) {
|
||||
m_merchant->notifyTrade(activeRecipe);
|
||||
|
||||
// Remove the items we are purchasing with
|
||||
player->inventory->removeResources(buyAItem);
|
||||
player->inventory->removeResources(buyBItem);
|
||||
// Remove the items we are purchasing with
|
||||
player->inventory->removeResources(buyAItem);
|
||||
player->inventory->removeResources(buyBItem);
|
||||
|
||||
// Add the item we have purchased
|
||||
std::shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
|
||||
if(!player->inventory->add( result ) )
|
||||
{
|
||||
player->drop(result);
|
||||
}
|
||||
// Add the item we have purchased
|
||||
std::shared_ptr<ItemInstance> result =
|
||||
activeRecipe->getSellItem()->copy();
|
||||
if (!player->inventory->add(result)) {
|
||||
player->drop(result);
|
||||
}
|
||||
|
||||
// Send a packet to the server
|
||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||
player->connection->send( std::shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
||||
// Send a packet to the server
|
||||
int actualShopItem =
|
||||
m_activeOffers.at(selectedShopItem).second;
|
||||
player->connection->send(
|
||||
std::shared_ptr<TradeItemPacket>(
|
||||
new TradeItemPacket(m_menu->containerId,
|
||||
actualShopItem)));
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_LEFT:
|
||||
handled = true;
|
||||
if(m_selectedSlot == 0)
|
||||
{
|
||||
if(m_offersStartIndex > 0)
|
||||
{
|
||||
--m_offersStartIndex;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
--m_selectedSlot;
|
||||
changed = true;
|
||||
moveSelector(false);
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_RIGHT:
|
||||
handled = true;
|
||||
if(m_selectedSlot == (DISPLAY_TRADES_COUNT - 1))
|
||||
{
|
||||
if((m_offersStartIndex + DISPLAY_TRADES_COUNT) < m_activeOffers.size())
|
||||
{
|
||||
++m_offersStartIndex;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++m_selectedSlot;
|
||||
changed = true;
|
||||
moveSelector(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (changed)
|
||||
{
|
||||
updateDisplay();
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_LEFT:
|
||||
handled = true;
|
||||
if (m_selectedSlot == 0) {
|
||||
if (m_offersStartIndex > 0) {
|
||||
--m_offersStartIndex;
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
--m_selectedSlot;
|
||||
changed = true;
|
||||
moveSelector(false);
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_RIGHT:
|
||||
handled = true;
|
||||
if (m_selectedSlot == (DISPLAY_TRADES_COUNT - 1)) {
|
||||
if ((m_offersStartIndex + DISPLAY_TRADES_COUNT) <
|
||||
m_activeOffers.size()) {
|
||||
++m_offersStartIndex;
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
++m_selectedSlot;
|
||||
changed = true;
|
||||
moveSelector(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (changed) {
|
||||
updateDisplay();
|
||||
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if( selectedShopItem < m_activeOffers.size() )
|
||||
{
|
||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||
m_menu->setSelectionHint(actualShopItem);
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if (selectedShopItem < m_activeOffers.size()) {
|
||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||
m_menu->setSelectionHint(actualShopItem);
|
||||
|
||||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(actualShopItem);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(actualShopItem);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::TRADER_SELECTION_PACKET,
|
||||
rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::handleTick()
|
||||
{
|
||||
int offerCount = 0;
|
||||
MerchantRecipeList *offers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
if (offers != NULL)
|
||||
{
|
||||
offerCount = offers->size();
|
||||
void IUIScene_TradingMenu::handleTick() {
|
||||
int offerCount = 0;
|
||||
MerchantRecipeList* offers =
|
||||
m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
if (offers != NULL) {
|
||||
offerCount = offers->size();
|
||||
|
||||
if(!m_bHasUpdatedOnce)
|
||||
{
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
if (!m_bHasUpdatedOnce) {
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
showScrollRightArrow( (m_offersStartIndex + DISPLAY_TRADES_COUNT) < m_activeOffers.size());
|
||||
showScrollLeftArrow(m_offersStartIndex > 0);
|
||||
showScrollRightArrow((m_offersStartIndex + DISPLAY_TRADES_COUNT) <
|
||||
m_activeOffers.size());
|
||||
showScrollLeftArrow(m_offersStartIndex > 0);
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::updateDisplay()
|
||||
{
|
||||
int iA = -1;
|
||||
void IUIScene_TradingMenu::updateDisplay() {
|
||||
int iA = -1;
|
||||
|
||||
MerchantRecipeList *unfilteredOffers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
if (unfilteredOffers != NULL)
|
||||
{
|
||||
m_activeOffers.clear();
|
||||
int unfilteredIndex = 0;
|
||||
int firstValidTrade = INT_MAX;
|
||||
for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it)
|
||||
{
|
||||
MerchantRecipe *recipe = *it;
|
||||
if(!recipe->isDeprecated())
|
||||
{
|
||||
m_activeOffers.push_back( std::pair<MerchantRecipe *,int>(recipe,unfilteredIndex));
|
||||
firstValidTrade = std::min(firstValidTrade,unfilteredIndex);
|
||||
}
|
||||
++unfilteredIndex;
|
||||
}
|
||||
MerchantRecipeList* unfilteredOffers =
|
||||
m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]);
|
||||
if (unfilteredOffers != NULL) {
|
||||
m_activeOffers.clear();
|
||||
int unfilteredIndex = 0;
|
||||
int firstValidTrade = INT_MAX;
|
||||
for (AUTO_VAR(it, unfilteredOffers->begin());
|
||||
it != unfilteredOffers->end(); ++it) {
|
||||
MerchantRecipe* recipe = *it;
|
||||
if (!recipe->isDeprecated()) {
|
||||
m_activeOffers.push_back(
|
||||
std::pair<MerchantRecipe*, int>(recipe, unfilteredIndex));
|
||||
firstValidTrade = std::min(firstValidTrade, unfilteredIndex);
|
||||
}
|
||||
++unfilteredIndex;
|
||||
}
|
||||
|
||||
if(!m_bHasUpdatedOnce)
|
||||
{
|
||||
if(firstValidTrade != 0 && firstValidTrade < unfilteredOffers->size())
|
||||
{
|
||||
m_menu->setSelectionHint(firstValidTrade);
|
||||
if (!m_bHasUpdatedOnce) {
|
||||
if (firstValidTrade != 0 &&
|
||||
firstValidTrade < unfilteredOffers->size()) {
|
||||
m_menu->setSelectionHint(firstValidTrade);
|
||||
|
||||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(firstValidTrade);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
output.writeInt(firstValidTrade);
|
||||
Minecraft::GetInstance()->getConnection(getPad())->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(
|
||||
new CustomPayloadPacket(
|
||||
CustomPayloadPacket::TRADER_SELECTION_PACKET,
|
||||
rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
|
||||
if( (m_offersStartIndex + DISPLAY_TRADES_COUNT) > m_activeOffers.size())
|
||||
{
|
||||
m_offersStartIndex = m_activeOffers.size() - DISPLAY_TRADES_COUNT;
|
||||
if(m_offersStartIndex < 0) m_offersStartIndex = 0;
|
||||
}
|
||||
if ((m_offersStartIndex + DISPLAY_TRADES_COUNT) >
|
||||
m_activeOffers.size()) {
|
||||
m_offersStartIndex = m_activeOffers.size() - DISPLAY_TRADES_COUNT;
|
||||
if (m_offersStartIndex < 0) m_offersStartIndex = 0;
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < DISPLAY_TRADES_COUNT; ++i)
|
||||
{
|
||||
int offerIndex = i + m_offersStartIndex;
|
||||
bool showRedBox = false;
|
||||
if(offerIndex < m_activeOffers.size())
|
||||
{
|
||||
showRedBox = !canMake(m_activeOffers.at(offerIndex).first);
|
||||
setTradeItem(i, m_activeOffers.at(offerIndex).first->getSellItem() );
|
||||
}
|
||||
else
|
||||
{
|
||||
setTradeItem(i, nullptr);
|
||||
}
|
||||
setTradeRedBox( i, showRedBox);
|
||||
}
|
||||
for (unsigned int i = 0; i < DISPLAY_TRADES_COUNT; ++i) {
|
||||
int offerIndex = i + m_offersStartIndex;
|
||||
bool showRedBox = false;
|
||||
if (offerIndex < m_activeOffers.size()) {
|
||||
showRedBox = !canMake(m_activeOffers.at(offerIndex).first);
|
||||
setTradeItem(
|
||||
i, m_activeOffers.at(offerIndex).first->getSellItem());
|
||||
} else {
|
||||
setTradeItem(i, nullptr);
|
||||
}
|
||||
setTradeRedBox(i, showRedBox);
|
||||
}
|
||||
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if( selectedShopItem < m_activeOffers.size() )
|
||||
{
|
||||
MerchantRecipe *activeRecipe = m_activeOffers.at(selectedShopItem).first;
|
||||
int selectedShopItem = (m_selectedSlot + m_offersStartIndex);
|
||||
if (selectedShopItem < m_activeOffers.size()) {
|
||||
MerchantRecipe* activeRecipe =
|
||||
m_activeOffers.at(selectedShopItem).first;
|
||||
|
||||
std::wstring wsTemp;
|
||||
std::wstring wsTemp;
|
||||
|
||||
// 4J-PB - need to get the villager type here
|
||||
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
|
||||
wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",app.GetString(m_merchant->getDisplayName()));
|
||||
int iPos=wsTemp.find(L"%s");
|
||||
wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName());
|
||||
// 4J-PB - need to get the villager type here
|
||||
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
|
||||
wsTemp = replaceAll(wsTemp, L"{*VILLAGER_TYPE*}",
|
||||
app.GetString(m_merchant->getDisplayName()));
|
||||
int iPos = wsTemp.find(L"%s");
|
||||
wsTemp.replace(iPos, 2,
|
||||
activeRecipe->getSellItem()->getHoverName());
|
||||
|
||||
setTitle(wsTemp.c_str());
|
||||
setTitle(wsTemp.c_str());
|
||||
|
||||
std::vector<std::wstring> unformattedStrings;
|
||||
std::wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
|
||||
setOfferDescription(offerDescription, unformattedStrings);
|
||||
|
||||
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
std::vector<std::wstring> unformattedStrings;
|
||||
std::wstring offerDescription = GetItemDescription(
|
||||
activeRecipe->getSellItem(), unformattedStrings);
|
||||
setOfferDescription(offerDescription, unformattedStrings);
|
||||
|
||||
setRequest1Item(buyAItem);
|
||||
setRequest2Item(buyBItem);
|
||||
std::shared_ptr<ItemInstance> buyAItem =
|
||||
activeRecipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem =
|
||||
activeRecipe->getBuyBItem();
|
||||
|
||||
if(buyAItem != NULL) setRequest1Name(buyAItem->getHoverName());
|
||||
else setRequest1Name(L"");
|
||||
setRequest1Item(buyAItem);
|
||||
setRequest2Item(buyBItem);
|
||||
|
||||
if(buyBItem != NULL) setRequest2Name(buyBItem->getHoverName());
|
||||
else setRequest2Name(L"");
|
||||
if (buyAItem != NULL)
|
||||
setRequest1Name(buyAItem->getHoverName());
|
||||
else
|
||||
setRequest1Name(L"");
|
||||
|
||||
bool canMake = true;
|
||||
if (buyBItem != NULL)
|
||||
setRequest2Name(buyBItem->getHoverName());
|
||||
else
|
||||
setRequest2Name(L"");
|
||||
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if(buyAMatches > 0)
|
||||
{
|
||||
setRequest1RedBox(buyAMatches < buyAItem->count);
|
||||
canMake = buyAMatches > buyAItem->count;
|
||||
}
|
||||
else
|
||||
{
|
||||
setRequest1RedBox(true);
|
||||
canMake = false;
|
||||
}
|
||||
bool canMake = true;
|
||||
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
if(buyBMatches > 0)
|
||||
{
|
||||
setRequest2RedBox(buyBMatches < buyBItem->count);
|
||||
canMake = canMake && buyBMatches > buyBItem->count;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(buyBItem!=NULL)
|
||||
{
|
||||
setRequest2RedBox(true);
|
||||
canMake = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setRequest2RedBox(buyBItem != NULL);
|
||||
canMake = canMake && buyBItem == NULL;
|
||||
}
|
||||
}
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||
Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if (buyAMatches > 0) {
|
||||
setRequest1RedBox(buyAMatches < buyAItem->count);
|
||||
canMake = buyAMatches > buyAItem->count;
|
||||
} else {
|
||||
setRequest1RedBox(true);
|
||||
canMake = false;
|
||||
}
|
||||
|
||||
if(canMake) iA = IDS_TOOLTIPS_TRADE;
|
||||
}
|
||||
else
|
||||
{
|
||||
setTitle(app.GetString(m_merchant->getDisplayName()));
|
||||
setRequest1Name(L"");
|
||||
setRequest2Name(L"");
|
||||
setRequest1RedBox(false);
|
||||
setRequest2RedBox(false);
|
||||
setRequest1Item(nullptr);
|
||||
setRequest2Item(nullptr);
|
||||
}
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
if (buyBMatches > 0) {
|
||||
setRequest2RedBox(buyBMatches < buyBItem->count);
|
||||
canMake = canMake && buyBMatches > buyBItem->count;
|
||||
} else {
|
||||
if (buyBItem != NULL) {
|
||||
setRequest2RedBox(true);
|
||||
canMake = false;
|
||||
} else {
|
||||
setRequest2RedBox(buyBItem != NULL);
|
||||
canMake = canMake && buyBItem == NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_bHasUpdatedOnce = true;
|
||||
}
|
||||
if (canMake) iA = IDS_TOOLTIPS_TRADE;
|
||||
} else {
|
||||
setTitle(app.GetString(m_merchant->getDisplayName()));
|
||||
setRequest1Name(L"");
|
||||
setRequest2Name(L"");
|
||||
setRequest1RedBox(false);
|
||||
setRequest2RedBox(false);
|
||||
setRequest1Item(nullptr);
|
||||
setRequest2Item(nullptr);
|
||||
}
|
||||
|
||||
ui.SetTooltips(getPad(), iA, IDS_TOOLTIPS_EXIT);
|
||||
m_bHasUpdatedOnce = true;
|
||||
}
|
||||
|
||||
ui.SetTooltips(getPad(), iA, IDS_TOOLTIPS_EXIT);
|
||||
}
|
||||
|
||||
bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
|
||||
{
|
||||
bool canMake = false;
|
||||
if (recipe != NULL)
|
||||
{
|
||||
if(recipe->isDeprecated()) return false;
|
||||
bool IUIScene_TradingMenu::canMake(MerchantRecipe* recipe) {
|
||||
bool canMake = false;
|
||||
if (recipe != NULL) {
|
||||
if (recipe->isDeprecated()) return false;
|
||||
|
||||
std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
||||
std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
||||
std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
||||
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if(buyAMatches > 0)
|
||||
{
|
||||
canMake = buyAMatches >= buyAItem->count;
|
||||
}
|
||||
else
|
||||
{
|
||||
canMake = buyAItem == NULL;
|
||||
}
|
||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||
Minecraft::GetInstance()->localplayers[getPad()];
|
||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||
if (buyAMatches > 0) {
|
||||
canMake = buyAMatches >= buyAItem->count;
|
||||
} else {
|
||||
canMake = buyAItem == NULL;
|
||||
}
|
||||
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
if(buyBMatches > 0)
|
||||
{
|
||||
canMake = canMake && buyBMatches >= buyBItem->count;
|
||||
}
|
||||
else
|
||||
{
|
||||
canMake = canMake && buyBItem == NULL;
|
||||
}
|
||||
}
|
||||
return canMake;
|
||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||
if (buyBMatches > 0) {
|
||||
canMake = canMake && buyBMatches >= buyBItem->count;
|
||||
} else {
|
||||
canMake = canMake && buyBItem == NULL;
|
||||
}
|
||||
}
|
||||
return canMake;
|
||||
}
|
||||
|
||||
|
||||
void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item) {
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item) {
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr<ItemInstance> item)
|
||||
{
|
||||
}
|
||||
void IUIScene_TradingMenu::setTradeItem(int index,
|
||||
std::shared_ptr<ItemInstance> item) {}
|
||||
|
||||
std::wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr<ItemInstance> item, std::vector<std::wstring> &unformattedStrings)
|
||||
{
|
||||
if(item == NULL) return L"";
|
||||
std::wstring IUIScene_TradingMenu::GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
std::vector<std::wstring>& unformattedStrings) {
|
||||
if (item == NULL) return L"";
|
||||
|
||||
std::wstring desc = L"";
|
||||
std::vector<std::wstring> *strings = item->getHoverTextOnly(nullptr, false, unformattedStrings);
|
||||
bool firstLine = true;
|
||||
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
|
||||
{
|
||||
std::wstring thisString = *it;
|
||||
if(!firstLine)
|
||||
{
|
||||
desc.append( L"<br />" );
|
||||
}
|
||||
else
|
||||
{
|
||||
firstLine = false;
|
||||
}
|
||||
desc.append( thisString );
|
||||
}
|
||||
strings->clear();
|
||||
delete strings;
|
||||
return desc;
|
||||
std::wstring desc = L"";
|
||||
std::vector<std::wstring>* strings =
|
||||
item->getHoverTextOnly(nullptr, false, unformattedStrings);
|
||||
bool firstLine = true;
|
||||
for (AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) {
|
||||
std::wstring thisString = *it;
|
||||
if (!firstLine) {
|
||||
desc.append(L"<br />");
|
||||
} else {
|
||||
firstLine = false;
|
||||
}
|
||||
desc.append(thisString);
|
||||
}
|
||||
strings->clear();
|
||||
delete strings;
|
||||
return desc;
|
||||
}
|
||||
|
||||
@@ -3,56 +3,59 @@
|
||||
|
||||
class MerchantRecipe;
|
||||
|
||||
class IUIScene_TradingMenu
|
||||
{
|
||||
class IUIScene_TradingMenu {
|
||||
protected:
|
||||
MerchantMenu *m_menu;
|
||||
std::shared_ptr<Merchant> m_merchant;
|
||||
std::vector< std::pair<MerchantRecipe *,int> > m_activeOffers;
|
||||
MerchantMenu* m_menu;
|
||||
std::shared_ptr<Merchant> m_merchant;
|
||||
std::vector<std::pair<MerchantRecipe*, int> > m_activeOffers;
|
||||
|
||||
int m_validOffersCount;
|
||||
int m_selectedSlot;
|
||||
int m_offersStartIndex;
|
||||
bool m_bHasUpdatedOnce;
|
||||
int m_validOffersCount;
|
||||
int m_selectedSlot;
|
||||
int m_offersStartIndex;
|
||||
bool m_bHasUpdatedOnce;
|
||||
|
||||
eTutorial_State m_previousTutorialState;
|
||||
eTutorial_State m_previousTutorialState;
|
||||
|
||||
static const int DISPLAY_TRADES_COUNT = 7;
|
||||
static const int DISPLAY_TRADES_COUNT = 7;
|
||||
|
||||
static const int BUY_A = MerchantMenu::USE_ROW_SLOT_END;
|
||||
static const int BUY_B = BUY_A + 1;
|
||||
static const int TRADES_START = BUY_B + 1;
|
||||
static const int BUY_A = MerchantMenu::USE_ROW_SLOT_END;
|
||||
static const int BUY_B = BUY_A + 1;
|
||||
static const int TRADES_START = BUY_B + 1;
|
||||
|
||||
protected:
|
||||
IUIScene_TradingMenu();
|
||||
IUIScene_TradingMenu();
|
||||
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
void handleTick();
|
||||
bool handleKeyDown(int iPad, int iAction, bool bRepeat);
|
||||
void handleTick();
|
||||
|
||||
virtual void showScrollRightArrow(bool show) = 0;
|
||||
virtual void showScrollLeftArrow(bool show) = 0;
|
||||
virtual void moveSelector(bool right) = 0;
|
||||
virtual void setRequest1Name(const std::wstring &name) = 0;
|
||||
virtual void setRequest2Name(const std::wstring &name) = 0;
|
||||
virtual void setTitle(const std::wstring &name) = 0;
|
||||
virtual void showScrollRightArrow(bool show) = 0;
|
||||
virtual void showScrollLeftArrow(bool show) = 0;
|
||||
virtual void moveSelector(bool right) = 0;
|
||||
virtual void setRequest1Name(const std::wstring& name) = 0;
|
||||
virtual void setRequest2Name(const std::wstring& name) = 0;
|
||||
virtual void setTitle(const std::wstring& name) = 0;
|
||||
|
||||
virtual void setRequest1RedBox(bool show) = 0;
|
||||
virtual void setRequest2RedBox(bool show) = 0;
|
||||
virtual void setTradeRedBox(int index, bool show) = 0;
|
||||
|
||||
virtual void setOfferDescription(const std::wstring &name, std::vector<std::wstring> &unformattedStrings) = 0;
|
||||
virtual void setRequest1RedBox(bool show) = 0;
|
||||
virtual void setRequest2RedBox(bool show) = 0;
|
||||
virtual void setTradeRedBox(int index, bool show) = 0;
|
||||
|
||||
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
|
||||
virtual void setOfferDescription(
|
||||
const std::wstring& name,
|
||||
std::vector<std::wstring>& unformattedStrings) = 0;
|
||||
|
||||
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
void updateDisplay();
|
||||
bool canMake(MerchantRecipe *recipe);
|
||||
std::wstring GetItemDescription(std::shared_ptr<ItemInstance> item, std::vector<std::wstring> &unformattedStrings);
|
||||
void updateDisplay();
|
||||
bool canMake(MerchantRecipe* recipe);
|
||||
std::wstring GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
std::vector<std::wstring>& unformattedStrings);
|
||||
|
||||
public:
|
||||
std::shared_ptr<Merchant> getMerchant();
|
||||
std::shared_ptr<Merchant> getMerchant();
|
||||
|
||||
virtual int getPad() = 0;
|
||||
virtual int getPad() = 0;
|
||||
};
|
||||
@@ -7,366 +7,394 @@
|
||||
|
||||
#include "UIBitmapFont.h"
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// UI Abstract Bitmap Font //
|
||||
/////////////////////////////
|
||||
|
||||
UIAbstractBitmapFont::~UIAbstractBitmapFont()
|
||||
{
|
||||
if (m_registered) IggyFontRemoveUTF8( m_fontname.c_str(),-1,IGGY_FONTFLAG_none );
|
||||
delete m_bitmapFontProvider;
|
||||
UIAbstractBitmapFont::~UIAbstractBitmapFont() {
|
||||
if (m_registered)
|
||||
IggyFontRemoveUTF8(m_fontname.c_str(), -1, IGGY_FONTFLAG_none);
|
||||
delete m_bitmapFontProvider;
|
||||
}
|
||||
|
||||
UIAbstractBitmapFont::UIAbstractBitmapFont(const std::string& fontname) {
|
||||
m_fontname = fontname;
|
||||
|
||||
UIAbstractBitmapFont::UIAbstractBitmapFont(const std::string &fontname)
|
||||
{
|
||||
m_fontname = fontname;
|
||||
m_registered = false;
|
||||
|
||||
m_registered = false;
|
||||
|
||||
m_bitmapFontProvider = new IggyBitmapFontProvider();
|
||||
m_bitmapFontProvider->get_font_metrics = &UIAbstractBitmapFont::GetFontMetrics_Callback;
|
||||
m_bitmapFontProvider->get_glyph_for_codepoint = &UIAbstractBitmapFont::GetCodepointGlyph_Callback;
|
||||
m_bitmapFontProvider->get_glyph_metrics = &UIAbstractBitmapFont::GetGlyphMetrics_Callback;
|
||||
m_bitmapFontProvider->is_empty = &UIAbstractBitmapFont::IsGlyphEmpty_Callback;
|
||||
m_bitmapFontProvider->get_kerning = &UIAbstractBitmapFont::GetKerningForGlyphPair_Callback;
|
||||
m_bitmapFontProvider->can_bitmap = &UIAbstractBitmapFont::CanProvideBitmap_Callback;
|
||||
m_bitmapFontProvider->get_bitmap = &UIAbstractBitmapFont::GetGlyphBitmap_Callback;
|
||||
m_bitmapFontProvider->free_bitmap = &UIAbstractBitmapFont::FreeGlyphBitmap_Callback;
|
||||
m_bitmapFontProvider->userdata = this;
|
||||
m_bitmapFontProvider = new IggyBitmapFontProvider();
|
||||
m_bitmapFontProvider->get_font_metrics =
|
||||
&UIAbstractBitmapFont::GetFontMetrics_Callback;
|
||||
m_bitmapFontProvider->get_glyph_for_codepoint =
|
||||
&UIAbstractBitmapFont::GetCodepointGlyph_Callback;
|
||||
m_bitmapFontProvider->get_glyph_metrics =
|
||||
&UIAbstractBitmapFont::GetGlyphMetrics_Callback;
|
||||
m_bitmapFontProvider->is_empty =
|
||||
&UIAbstractBitmapFont::IsGlyphEmpty_Callback;
|
||||
m_bitmapFontProvider->get_kerning =
|
||||
&UIAbstractBitmapFont::GetKerningForGlyphPair_Callback;
|
||||
m_bitmapFontProvider->can_bitmap =
|
||||
&UIAbstractBitmapFont::CanProvideBitmap_Callback;
|
||||
m_bitmapFontProvider->get_bitmap =
|
||||
&UIAbstractBitmapFont::GetGlyphBitmap_Callback;
|
||||
m_bitmapFontProvider->free_bitmap =
|
||||
&UIAbstractBitmapFont::FreeGlyphBitmap_Callback;
|
||||
m_bitmapFontProvider->userdata = this;
|
||||
}
|
||||
|
||||
void UIAbstractBitmapFont::registerFont()
|
||||
{
|
||||
if(m_registered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void UIAbstractBitmapFont::registerFont() {
|
||||
if (m_registered) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_bitmapFontProvider->num_glyphs = m_numGlyphs;
|
||||
m_bitmapFontProvider->num_glyphs = m_numGlyphs;
|
||||
|
||||
IggyFontInstallBitmapUTF8( m_bitmapFontProvider,m_fontname.c_str(),-1,IGGY_FONTFLAG_none );
|
||||
IggyFontSetIndirectUTF8( m_fontname.c_str(),-1 ,IGGY_FONTFLAG_all ,m_fontname.c_str() ,-1 ,IGGY_FONTFLAG_none );
|
||||
m_registered = true;
|
||||
IggyFontInstallBitmapUTF8(m_bitmapFontProvider, m_fontname.c_str(), -1,
|
||||
IGGY_FONTFLAG_none);
|
||||
IggyFontSetIndirectUTF8(m_fontname.c_str(), -1, IGGY_FONTFLAG_all,
|
||||
m_fontname.c_str(), -1, IGGY_FONTFLAG_none);
|
||||
m_registered = true;
|
||||
}
|
||||
|
||||
IggyFontMetrics * RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(void *user_context,IggyFontMetrics *metrics)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->GetFontMetrics(metrics);
|
||||
IggyFontMetrics* RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(
|
||||
void* user_context, IggyFontMetrics* metrics) {
|
||||
return ((UIAbstractBitmapFont*)user_context)->GetFontMetrics(metrics);
|
||||
}
|
||||
|
||||
S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void *user_context,U32 codepoint)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->GetCodepointGlyph(codepoint);
|
||||
S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void* user_context,
|
||||
U32 codepoint) {
|
||||
return ((UIAbstractBitmapFont*)user_context)->GetCodepointGlyph(codepoint);
|
||||
}
|
||||
|
||||
IggyGlyphMetrics * RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(void *user_context,S32 glyph,IggyGlyphMetrics *metrics)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->GetGlyphMetrics(glyph,metrics);
|
||||
IggyGlyphMetrics* RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(
|
||||
void* user_context, S32 glyph, IggyGlyphMetrics* metrics) {
|
||||
return ((UIAbstractBitmapFont*)user_context)
|
||||
->GetGlyphMetrics(glyph, metrics);
|
||||
}
|
||||
|
||||
rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void *user_context,S32 glyph)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->IsGlyphEmpty(glyph);
|
||||
rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void* user_context,
|
||||
S32 glyph) {
|
||||
return ((UIAbstractBitmapFont*)user_context)->IsGlyphEmpty(glyph);
|
||||
}
|
||||
|
||||
F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(void *user_context,S32 first_glyph,S32 second_glyph)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->GetKerningForGlyphPair(first_glyph,second_glyph);
|
||||
F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(
|
||||
void* user_context, S32 first_glyph, S32 second_glyph) {
|
||||
return ((UIAbstractBitmapFont*)user_context)
|
||||
->GetKerningForGlyphPair(first_glyph, second_glyph);
|
||||
}
|
||||
|
||||
rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->CanProvideBitmap(glyph,pixel_scale);
|
||||
rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(
|
||||
void* user_context, S32 glyph, F32 pixel_scale) {
|
||||
return ((UIAbstractBitmapFont*)user_context)
|
||||
->CanProvideBitmap(glyph, pixel_scale);
|
||||
}
|
||||
|
||||
rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap);
|
||||
rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(
|
||||
void* user_context, S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
return ((UIAbstractBitmapFont*)user_context)
|
||||
->GetGlyphBitmap(glyph, pixel_scale, bitmap);
|
||||
}
|
||||
|
||||
void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap)
|
||||
{
|
||||
return ((UIAbstractBitmapFont *) user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap);
|
||||
void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(
|
||||
void* user_context, S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
return ((UIAbstractBitmapFont*)user_context)
|
||||
->FreeGlyphBitmap(glyph, pixel_scale, bitmap);
|
||||
}
|
||||
|
||||
UIBitmapFont::UIBitmapFont( SFontData &sfontdata )
|
||||
: UIAbstractBitmapFont( sfontdata.m_strFontName )
|
||||
{
|
||||
m_numGlyphs = sfontdata.m_uiGlyphCount;
|
||||
UIBitmapFont::UIBitmapFont(SFontData& sfontdata)
|
||||
: UIAbstractBitmapFont(sfontdata.m_strFontName) {
|
||||
m_numGlyphs = sfontdata.m_uiGlyphCount;
|
||||
|
||||
BufferedImage bimg(sfontdata.m_wstrFilename);
|
||||
int *bimgData = bimg.getData();
|
||||
BufferedImage bimg(sfontdata.m_wstrFilename);
|
||||
int* bimgData = bimg.getData();
|
||||
|
||||
if (bimgData == nullptr)
|
||||
{
|
||||
fprintf(stderr, "[UIBitmapFont] ERROR: failed to load font image for '%s' is font included?\n",
|
||||
sfontdata.m_strFontName.c_str());
|
||||
m_cFontData = new CFontData(); // todo: make font work
|
||||
return;
|
||||
}
|
||||
if (bimgData == nullptr) {
|
||||
fprintf(stderr,
|
||||
"[UIBitmapFont] ERROR: failed to load font image for '%s' is "
|
||||
"font included?\n",
|
||||
sfontdata.m_strFontName.c_str());
|
||||
m_cFontData = new CFontData(); // todo: make font work
|
||||
return;
|
||||
}
|
||||
|
||||
m_cFontData = new CFontData(sfontdata, bimgData);
|
||||
m_cFontData = new CFontData(sfontdata, bimgData);
|
||||
|
||||
//delete [] bimgData;
|
||||
// delete [] bimgData;
|
||||
}
|
||||
|
||||
UIBitmapFont::~UIBitmapFont()
|
||||
{
|
||||
m_cFontData->release();
|
||||
UIBitmapFont::~UIBitmapFont() { m_cFontData->release(); }
|
||||
|
||||
// Callback function type for returning vertical font metrics
|
||||
IggyFontMetrics* UIBitmapFont::GetFontMetrics(IggyFontMetrics* metrics) {
|
||||
// Description
|
||||
// Vertical metrics for a font
|
||||
// Members
|
||||
// ascent - extent of characters above baseline (positive)
|
||||
// descent - extent of characters below baseline (positive)
|
||||
// line_gap - spacing between one row's descent and the next line's ascent
|
||||
// average_glyph_width_for_tab_stops - spacing of "average" character for
|
||||
// computing default tab stops largest_glyph_bbox_y1 - lowest point below
|
||||
// baseline of any character in the font
|
||||
|
||||
metrics->ascent = m_cFontData->getFontData()->m_fAscent;
|
||||
metrics->descent = m_cFontData->getFontData()->m_fDescent;
|
||||
|
||||
metrics->average_glyph_width_for_tab_stops = 8.0f;
|
||||
|
||||
// This is my best guess, there's no reference to a specific glyph here
|
||||
// so aren't these just exactly the same.
|
||||
metrics->largest_glyph_bbox_y1 = metrics->descent;
|
||||
|
||||
// metrics->line_gap; // 4J-JEV: Sean said this does nothing.
|
||||
|
||||
return metrics;
|
||||
}
|
||||
|
||||
//Callback function type for returning vertical font metrics
|
||||
IggyFontMetrics *UIBitmapFont::GetFontMetrics(IggyFontMetrics *metrics)
|
||||
{
|
||||
//Description
|
||||
// Vertical metrics for a font
|
||||
//Members
|
||||
// ascent - extent of characters above baseline (positive)
|
||||
// descent - extent of characters below baseline (positive)
|
||||
// line_gap - spacing between one row's descent and the next line's ascent
|
||||
// average_glyph_width_for_tab_stops - spacing of "average" character for computing default tab stops
|
||||
// largest_glyph_bbox_y1 - lowest point below baseline of any character in the font
|
||||
// Callback function type for mapping 32-bit unicode code point to internal font
|
||||
// glyph number; use IGGY_GLYPH_INVALID to mean "invalid character"
|
||||
S32 UIBitmapFont::GetCodepointGlyph(U32 codepoint) {
|
||||
// 4J-JEV: Change "right single quotation marks" to apostrophies.
|
||||
if (codepoint == 0x2019) codepoint = 0x27;
|
||||
|
||||
metrics->ascent = m_cFontData->getFontData()->m_fAscent;
|
||||
metrics->descent = m_cFontData->getFontData()->m_fDescent;
|
||||
|
||||
metrics->average_glyph_width_for_tab_stops = 8.0f;
|
||||
|
||||
// This is my best guess, there's no reference to a specific glyph here
|
||||
// so aren't these just exactly the same.
|
||||
metrics->largest_glyph_bbox_y1 = metrics->descent;
|
||||
|
||||
// metrics->line_gap; // 4J-JEV: Sean said this does nothing.
|
||||
|
||||
return metrics;
|
||||
return m_cFontData->getGlyphId(codepoint);
|
||||
}
|
||||
|
||||
//Callback function type for mapping 32-bit unicode code point to internal font glyph number; use IGGY_GLYPH_INVALID to mean "invalid character"
|
||||
S32 UIBitmapFont::GetCodepointGlyph(U32 codepoint)
|
||||
{
|
||||
// 4J-JEV: Change "right single quotation marks" to apostrophies.
|
||||
if (codepoint == 0x2019) codepoint = 0x27;
|
||||
// Callback function type for returning horizontal metrics for each glyph
|
||||
IggyGlyphMetrics* UIBitmapFont::GetGlyphMetrics(S32 glyph,
|
||||
IggyGlyphMetrics* metrics) {
|
||||
// 4J-JEV: Information about 'Glyph Metrics'.
|
||||
// http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-3.html -
|
||||
// Overview. http://en.wikipedia.org/wiki/Kerning#Kerning_values - 'Font
|
||||
// Units'
|
||||
|
||||
return m_cFontData->getGlyphId(codepoint);
|
||||
// Description
|
||||
// Horizontal metrics for a glyph
|
||||
// Members
|
||||
// x0 y0 x1 y1 - bounding box
|
||||
// advance - horizontal distance to move character origin after drawing
|
||||
// this glyph
|
||||
|
||||
/* 4J-JEV: *IMPORTANT*
|
||||
*
|
||||
* I believe these are measured wrt the scale mentioned in GetGlyphBitmap
|
||||
* i.e. 1.0f == pixel_scale,
|
||||
*
|
||||
* However we do not have that information here, then all these values need
|
||||
* to be the same for every scale in this font.
|
||||
*
|
||||
* We have 2 scales of bitmap glyph, and we can only scale these up by
|
||||
* powers of 2 otherwise the fonts will become blurry. The appropriate glyph
|
||||
* is chosen in 'GetGlyphBitmap' however we need to set the horizontal sizes
|
||||
* here.
|
||||
*/
|
||||
|
||||
float glyphAdvance = m_cFontData->getAdvance(glyph);
|
||||
|
||||
// 4J-JEV: Anything outside this measurement will be
|
||||
// cut off if it's at the start or end of the row.
|
||||
metrics->x0 = 0.0f;
|
||||
|
||||
if (m_cFontData->glyphIsWhitespace(glyph))
|
||||
metrics->x1 = 0.0f;
|
||||
else
|
||||
metrics->x1 = glyphAdvance;
|
||||
|
||||
// The next Glyph just starts right after this one.
|
||||
metrics->advance = glyphAdvance;
|
||||
|
||||
// app.DebugPrintf("[UIBitmapFont] GetGlyphMetrics:\n\tmetrics->advance ==
|
||||
// %f,\n", metrics->advance);
|
||||
|
||||
// These don't do anything either.
|
||||
metrics->y0 = 0.0f;
|
||||
metrics->y1 = 1.0f;
|
||||
|
||||
return metrics;
|
||||
}
|
||||
|
||||
//Callback function type for returning horizontal metrics for each glyph
|
||||
IggyGlyphMetrics * UIBitmapFont::GetGlyphMetrics(S32 glyph,IggyGlyphMetrics *metrics)
|
||||
{
|
||||
// 4J-JEV: Information about 'Glyph Metrics'.
|
||||
// http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-3.html - Overview.
|
||||
// http://en.wikipedia.org/wiki/Kerning#Kerning_values - 'Font Units'
|
||||
|
||||
//Description
|
||||
// Horizontal metrics for a glyph
|
||||
//Members
|
||||
// x0 y0 x1 y1 - bounding box
|
||||
// advance - horizontal distance to move character origin after drawing this glyph
|
||||
|
||||
|
||||
/* 4J-JEV: *IMPORTANT*
|
||||
*
|
||||
* I believe these are measured wrt the scale mentioned in GetGlyphBitmap
|
||||
* i.e. 1.0f == pixel_scale,
|
||||
*
|
||||
* However we do not have that information here, then all these values need to be
|
||||
* the same for every scale in this font.
|
||||
*
|
||||
* We have 2 scales of bitmap glyph, and we can only scale these up by powers of 2
|
||||
* otherwise the fonts will become blurry. The appropriate glyph is chosen in
|
||||
* 'GetGlyphBitmap' however we need to set the horizontal sizes here.
|
||||
*/
|
||||
|
||||
float glyphAdvance = m_cFontData->getAdvance(glyph);
|
||||
|
||||
// 4J-JEV: Anything outside this measurement will be
|
||||
// cut off if it's at the start or end of the row.
|
||||
metrics->x0 = 0.0f;
|
||||
|
||||
if ( m_cFontData->glyphIsWhitespace(glyph) )
|
||||
metrics->x1 = 0.0f;
|
||||
else
|
||||
metrics->x1 = glyphAdvance;
|
||||
|
||||
// The next Glyph just starts right after this one.
|
||||
metrics->advance = glyphAdvance;
|
||||
|
||||
//app.DebugPrintf("[UIBitmapFont] GetGlyphMetrics:\n\tmetrics->advance == %f,\n", metrics->advance);
|
||||
|
||||
// These don't do anything either.
|
||||
metrics->y0 = 0.0f; metrics->y1 = 1.0f;
|
||||
|
||||
return metrics;
|
||||
// Callback function type that should return true iff the glyph has no visible
|
||||
// elements
|
||||
rrbool UIBitmapFont::IsGlyphEmpty(S32 glyph) {
|
||||
if (m_cFontData->glyphIsWhitespace(glyph)) return true;
|
||||
return false; // app.DebugPrintf("Is glyph %d empty?
|
||||
// %s\n",glyph,isEmpty?"TRUE":"FALSE");
|
||||
}
|
||||
|
||||
//Callback function type that should return true iff the glyph has no visible elements
|
||||
rrbool UIBitmapFont::IsGlyphEmpty (S32 glyph)
|
||||
{
|
||||
if (m_cFontData->glyphIsWhitespace(glyph)) return true;
|
||||
return false;//app.DebugPrintf("Is glyph %d empty? %s\n",glyph,isEmpty?"TRUE":"FALSE");
|
||||
// Callback function type for returning the kerning amount for a given pair of
|
||||
// glyphs
|
||||
F32 UIBitmapFont::GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph) {
|
||||
// UIBitmapFont *uiFont = (UIBitmapFont *) user_context;
|
||||
// app.DebugPrintf("Get kerning for glyph pair
|
||||
// %d,%d\n",first_glyph,second_glyph);
|
||||
|
||||
// 4J-JEV: Yet another field that doesn't do anything.
|
||||
// Only set out of paranoia.
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
//Callback function type for returning the kerning amount for a given pair of glyphs
|
||||
F32 UIBitmapFont::GetKerningForGlyphPair(S32 first_glyph,S32 second_glyph)
|
||||
{
|
||||
//UIBitmapFont *uiFont = (UIBitmapFont *) user_context;
|
||||
//app.DebugPrintf("Get kerning for glyph pair %d,%d\n",first_glyph,second_glyph);
|
||||
|
||||
// 4J-JEV: Yet another field that doesn't do anything.
|
||||
// Only set out of paranoia.
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
//Callback function type used for reporting whether a bitmap supports a given glyph at the given scale
|
||||
rrbool UIBitmapFont::CanProvideBitmap(S32 glyph,F32 pixel_scale)
|
||||
{
|
||||
//app.DebugPrintf("Can provide bitmap for glyph %d at scale %f? %s\n",glyph,pixel_scale,canProvideBitmap?"TRUE":"FALSE");
|
||||
return true;
|
||||
// Callback function type used for reporting whether a bitmap supports a given
|
||||
// glyph at the given scale
|
||||
rrbool UIBitmapFont::CanProvideBitmap(S32 glyph, F32 pixel_scale) {
|
||||
// app.DebugPrintf("Can provide bitmap for glyph %d at scale %f?
|
||||
// %s\n",glyph,pixel_scale,canProvideBitmap?"TRUE":"FALSE");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Description
|
||||
// Callback function type used for getting the bitmap for a given glyph
|
||||
// Parameters
|
||||
// glyph The glyph to compute/get the bitmap for
|
||||
// pixel_scale The scale factor (pseudo point size) requested by the textfield,adjusted for display resolution
|
||||
// bitmap The structure to store the bitmap into
|
||||
rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap)
|
||||
{
|
||||
//Description
|
||||
// Data structure used to return to Iggy the bitmap to use for a glyph
|
||||
//Members
|
||||
// pixels_one_per_byte - pixels startin with the top-left-most; 0 is transparent and 255 is opaque
|
||||
// width_in_pixels - this is the width of the bitmap data
|
||||
// height_in_pixels - this is the height of the bitmap data
|
||||
// stride_in_bytes - the distance from one row to the next
|
||||
// oversample - this is the amount of oversampling (0 or 1 = not oversample,2 = 2x oversampled,4 = 4x oversampled)
|
||||
// point_sample - if true,the bitmap will be drawn with point sampling; if false,it will be drawn with bilinear
|
||||
// top_left_x - the offset of the top left corner from the character origin
|
||||
// top_left_y - the offset of the top left corner from the character origin
|
||||
// pixel_scale_correct - the pixel_scale at which this character should be displayed at displayed_width_in_pixels
|
||||
// pixel_scale_min - the smallest pixel_scale to allow using this character (scaled down)
|
||||
// pixel_scale_max - the largest pixels cale to allow using this character (scaled up)
|
||||
// user_context_for_free - you can use this to store data to access on the corresponding free call
|
||||
|
||||
int row = 0,col = 0;
|
||||
m_cFontData->getPos(glyph,row,col);
|
||||
// glyph The glyph to compute/get the bitmap for
|
||||
// pixel_scale The scale factor (pseudo point size) requested by the
|
||||
//textfield,adjusted for display resolution bitmap The structure to store the
|
||||
//bitmap into
|
||||
rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
// Description
|
||||
// Data structure used to return to Iggy the bitmap to use for a glyph
|
||||
// Members
|
||||
// pixels_one_per_byte - pixels startin with the top-left-most; 0 is
|
||||
// transparent and 255 is opaque width_in_pixels - this is the width of the
|
||||
// bitmap data height_in_pixels - this is the height of the bitmap data
|
||||
// stride_in_bytes - the distance from one row to the next
|
||||
// oversample - this is the amount of oversampling (0 or 1 = not
|
||||
// oversample,2 = 2x oversampled,4 = 4x oversampled) point_sample - if
|
||||
// true,the bitmap will be drawn with point sampling; if false,it will be
|
||||
// drawn with bilinear top_left_x - the offset of the top left corner from
|
||||
// the character origin top_left_y - the offset of the top left corner from
|
||||
// the character origin pixel_scale_correct - the pixel_scale at which this
|
||||
// character should be displayed at displayed_width_in_pixels
|
||||
// pixel_scale_min - the smallest pixel_scale to allow using this character
|
||||
// (scaled down) pixel_scale_max - the largest pixels cale to allow using
|
||||
// this character (scaled up) user_context_for_free - you can use this to
|
||||
// store data to access on the corresponding free call
|
||||
|
||||
// Skip to glyph start.
|
||||
bitmap->pixels_one_per_byte = m_cFontData->topLeftPixel(row,col);
|
||||
int row = 0, col = 0;
|
||||
m_cFontData->getPos(glyph, row, col);
|
||||
|
||||
// Choose a reasonable glyph scale.
|
||||
float glyphScale = 1.0f, truePixelScale = 1.0f / m_cFontData->getFontData()->m_fAdvPerPixel;
|
||||
F32 targetPixelScale = pixel_scale;
|
||||
//if(!RenderManager.IsWidescreen())
|
||||
//{
|
||||
// // Fix for different scales in 480
|
||||
// targetPixelScale = pixel_scale*2/3;
|
||||
//}
|
||||
while ( (0.5f + glyphScale) * truePixelScale < targetPixelScale)
|
||||
glyphScale++;
|
||||
// Skip to glyph start.
|
||||
bitmap->pixels_one_per_byte = m_cFontData->topLeftPixel(row, col);
|
||||
|
||||
// 4J-JEV: Debug code to check which font sizes are being used.
|
||||
// Choose a reasonable glyph scale.
|
||||
float glyphScale = 1.0f,
|
||||
truePixelScale = 1.0f / m_cFontData->getFontData()->m_fAdvPerPixel;
|
||||
F32 targetPixelScale = pixel_scale;
|
||||
// if(!RenderManager.IsWidescreen())
|
||||
//{
|
||||
// // Fix for different scales in 480
|
||||
// targetPixelScale = pixel_scale*2/3;
|
||||
// }
|
||||
while ((0.5f + glyphScale) * truePixelScale < targetPixelScale)
|
||||
glyphScale++;
|
||||
|
||||
// 4J-JEV: Debug code to check which font sizes are being used.
|
||||
#if (!defined _CONTENT_PACKAGE) && (VERBOSE_FONT_OUTPUT > 0)
|
||||
|
||||
struct DebugData
|
||||
{
|
||||
std::string name;
|
||||
long scale;
|
||||
long mul;
|
||||
struct DebugData {
|
||||
std::string name;
|
||||
long scale;
|
||||
long mul;
|
||||
|
||||
bool operator==(const DebugData& dd) const
|
||||
{
|
||||
if ( name.compare(dd.name) != 0 ) return false;
|
||||
else if (scale != dd.scale) return false;
|
||||
else if (mul != dd.mul) return false;
|
||||
else return true;
|
||||
}
|
||||
};
|
||||
bool operator==(const DebugData& dd) const {
|
||||
if (name.compare(dd.name) != 0)
|
||||
return false;
|
||||
else if (scale != dd.scale)
|
||||
return false;
|
||||
else if (mul != dd.mul)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static long long lastPrint = System::currentTimeMillis();
|
||||
static std::unordered_set<DebugData> debug_fontSizesRequested;
|
||||
static long long lastPrint = System::currentTimeMillis();
|
||||
static std::unordered_set<DebugData> debug_fontSizesRequested;
|
||||
|
||||
{
|
||||
DebugData dData = { m_cFontData->getFontName(), (long) pixel_scale, (long) glyphScale };
|
||||
debug_fontSizesRequested.insert(dData);
|
||||
{
|
||||
DebugData dData = {m_cFontData->getFontName(), (long)pixel_scale,
|
||||
(long)glyphScale};
|
||||
debug_fontSizesRequested.insert(dData);
|
||||
|
||||
if ( (lastPrint - System::currentTimeMillis()) > VERBOSE_FONT_OUTPUT )
|
||||
{
|
||||
app.DebugPrintf("<UIBitmapFont> Requested font/sizes:\n");
|
||||
if ((lastPrint - System::currentTimeMillis()) > VERBOSE_FONT_OUTPUT) {
|
||||
app.DebugPrintf("<UIBitmapFont> Requested font/sizes:\n");
|
||||
|
||||
std::unordered_set<DebugData>::iterator itr;
|
||||
for ( itr = debug_fontSizesRequested.begin();
|
||||
itr != debug_fontSizesRequested.end();
|
||||
itr++
|
||||
)
|
||||
{
|
||||
app.DebugPrintf("<UIBitmapFont>\t- %s:%i\t(x%i)\n", itr->name.c_str(), itr->scale, itr->mul);
|
||||
}
|
||||
|
||||
lastPrint = System::currentTimeMillis();
|
||||
debug_fontSizesRequested.clear();
|
||||
}
|
||||
}
|
||||
std::unordered_set<DebugData>::iterator itr;
|
||||
for (itr = debug_fontSizesRequested.begin();
|
||||
itr != debug_fontSizesRequested.end(); itr++) {
|
||||
app.DebugPrintf("<UIBitmapFont>\t- %s:%i\t(x%i)\n",
|
||||
itr->name.c_str(), itr->scale, itr->mul);
|
||||
}
|
||||
|
||||
lastPrint = System::currentTimeMillis();
|
||||
debug_fontSizesRequested.clear();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//app.DebugPrintf("Request glyph_%d (U+%.4X) at %f, converted to %f (%f)\n",
|
||||
// glyph, GetUnicode(glyph), pixel_scale, targetPixelScale, glyphScale);
|
||||
// app.DebugPrintf("Request glyph_%d (U+%.4X) at %f, converted to %f
|
||||
// (%f)\n", glyph, GetUnicode(glyph), pixel_scale, targetPixelScale,
|
||||
//glyphScale);
|
||||
|
||||
// It is not necessary to shrink the glyph width here
|
||||
// as its already been done in 'GetGlyphMetrics' by:
|
||||
// > metrics->x1 = m_kerningTable[glyph] * ratio;
|
||||
bitmap->width_in_pixels = m_cFontData->getFontData()->m_uiGlyphWidth;
|
||||
bitmap->height_in_pixels = m_cFontData->getFontData()->m_uiGlyphHeight;
|
||||
// It is not necessary to shrink the glyph width here
|
||||
// as its already been done in 'GetGlyphMetrics' by:
|
||||
// > metrics->x1 = m_kerningTable[glyph] * ratio;
|
||||
bitmap->width_in_pixels = m_cFontData->getFontData()->m_uiGlyphWidth;
|
||||
bitmap->height_in_pixels = m_cFontData->getFontData()->m_uiGlyphHeight;
|
||||
|
||||
/* 4J-JEV: This is to do with glyph placement,
|
||||
* and not the position in the archive.
|
||||
* I don't know why the 0.65 is needed, or what it represents,
|
||||
* although it doesn't look like its the baseline.
|
||||
*/
|
||||
bitmap->top_left_x = 0;
|
||||
/* 4J-JEV: This is to do with glyph placement,
|
||||
* and not the position in the archive.
|
||||
* I don't know why the 0.65 is needed, or what it represents,
|
||||
* although it doesn't look like its the baseline.
|
||||
*/
|
||||
bitmap->top_left_x = 0;
|
||||
|
||||
// 4J-PB - this was chopping off the top of the characters, so accented ones were losing a couple of pixels at the top
|
||||
// DaveK has reduced the height of the accented capitalised characters, and we've dropped this from 0.65 to 0.64
|
||||
bitmap->top_left_y = -((S32) m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent;
|
||||
// 4J-PB - this was chopping off the top of the characters, so accented ones
|
||||
// were losing a couple of pixels at the top DaveK has reduced the height of
|
||||
// the accented capitalised characters, and we've dropped this from 0.65 to
|
||||
// 0.64
|
||||
bitmap->top_left_y = -((S32)m_cFontData->getFontData()->m_uiGlyphHeight) *
|
||||
m_cFontData->getFontData()->m_fAscent;
|
||||
|
||||
bitmap->oversample = 0;
|
||||
bitmap->point_sample = true;
|
||||
bitmap->oversample = 0;
|
||||
bitmap->point_sample = true;
|
||||
|
||||
// 4J-JEV:
|
||||
// pixel_scale == font size chosen in flash.
|
||||
// bitmap->pixel_scale_correct = (float) m_glyphHeight; // Scales the glyph to desired size.
|
||||
// bitmap->pixel_scale_correct = pixel_scale; // Always the same size (not desired size).
|
||||
// bitmap->pixel_scale_correct = pixel_scale * 0.5; // Doubles original size.
|
||||
// bitmap->pixel_scale_correct = pixel_scale * 2; // Halves original size.
|
||||
|
||||
// Actual scale, and possible range of scales.
|
||||
bitmap->pixel_scale_correct = pixel_scale / glyphScale;
|
||||
bitmap->pixel_scale_max = 99.0f;
|
||||
bitmap->pixel_scale_min = 0.0f;
|
||||
// 4J-JEV:
|
||||
// pixel_scale == font size chosen in flash.
|
||||
// bitmap->pixel_scale_correct = (float) m_glyphHeight; // Scales the
|
||||
// glyph to desired size. bitmap->pixel_scale_correct = pixel_scale;
|
||||
// // Always the same size (not desired size). bitmap->pixel_scale_correct =
|
||||
// pixel_scale * 0.5; // Doubles original size.
|
||||
// bitmap->pixel_scale_correct = pixel_scale * 2; // Halves
|
||||
// original size.
|
||||
|
||||
/* 4J-JEV: Some of Sean's code.
|
||||
int glyphScaleMin = 1;
|
||||
int glyphScaleMax = 3;
|
||||
float actualScale = pixel_scale / glyphScale;
|
||||
bitmap->pixel_scale_correct = actualScale;
|
||||
bitmap->pixel_scale_min = actualScale * glyphScaleMin * 0.999f;
|
||||
bitmap->pixel_scale_max = actualScale * glyphScaleMax * 1.001f; */
|
||||
// Actual scale, and possible range of scales.
|
||||
bitmap->pixel_scale_correct = pixel_scale / glyphScale;
|
||||
bitmap->pixel_scale_max = 99.0f;
|
||||
bitmap->pixel_scale_min = 0.0f;
|
||||
|
||||
// 4J-JEV: Nothing to do with glyph placement,
|
||||
// entirely to do with cropping your glyph out of an archive.
|
||||
bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX;
|
||||
/* 4J-JEV: Some of Sean's code.
|
||||
int glyphScaleMin = 1;
|
||||
int glyphScaleMax = 3;
|
||||
float actualScale = pixel_scale / glyphScale;
|
||||
bitmap->pixel_scale_correct = actualScale;
|
||||
bitmap->pixel_scale_min = actualScale * glyphScaleMin * 0.999f;
|
||||
bitmap->pixel_scale_max = actualScale * glyphScaleMax * 1.001f; */
|
||||
|
||||
// 4J-JEV: Additional information needed to release memory afterwards.
|
||||
bitmap->user_context_for_free = NULL;
|
||||
// 4J-JEV: Nothing to do with glyph placement,
|
||||
// entirely to do with cropping your glyph out of an archive.
|
||||
bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX;
|
||||
|
||||
return true;
|
||||
// 4J-JEV: Additional information needed to release memory afterwards.
|
||||
bitmap->user_context_for_free = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Callback function type for freeing a bitmap shape returned by GetGlyphBitmap
|
||||
void RADLINK UIBitmapFont::FreeGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap)
|
||||
{
|
||||
// We don't need to free anything,it just comes from the archive.
|
||||
//app.DebugPrintf("Free bitmap for glyph %d at scale %f\n",glyph,pixel_scale);
|
||||
// Callback function type for freeing a bitmap shape returned by GetGlyphBitmap
|
||||
void RADLINK UIBitmapFont::FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
// We don't need to free anything,it just comes from the archive.
|
||||
// app.DebugPrintf("Free bitmap for glyph %d at scale
|
||||
// %f\n",glyph,pixel_scale);
|
||||
}
|
||||
|
||||
@@ -5,71 +5,82 @@ class CFontData;
|
||||
|
||||
#define VERBOSE_FONT_OUTPUT 0
|
||||
|
||||
// const int BITMAP_FONT_LANGUAGES = XC_LANGUAGE_ENGLISH
|
||||
// | XC_LANGUAGE_GERMAN
|
||||
// | XC_LANGUAGE_FRENCH
|
||||
// | XC_LANGUAGE_SPANISH
|
||||
// | XC_LANGUAGE_ITALIAN
|
||||
// | XC_LANGUAGE_PORTUGUESE
|
||||
// | XC_LANGUAGE_BRAZILIAN;
|
||||
// const int BITMAP_FONT_LANGUAGES = XC_LANGUAGE_ENGLISH
|
||||
// |
|
||||
// XC_LANGUAGE_GERMAN | XC_LANGUAGE_FRENCH | XC_LANGUAGE_SPANISH |
|
||||
// XC_LANGUAGE_ITALIAN | XC_LANGUAGE_PORTUGUESE | XC_LANGUAGE_BRAZILIAN;
|
||||
|
||||
//using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
class UIAbstractBitmapFont
|
||||
{
|
||||
class UIAbstractBitmapFont {
|
||||
protected:
|
||||
std::string m_fontname;
|
||||
std::string m_fontname;
|
||||
|
||||
IggyBitmapFontProvider *m_bitmapFontProvider;
|
||||
IggyBitmapFontProvider* m_bitmapFontProvider;
|
||||
|
||||
bool m_registered;
|
||||
bool m_registered;
|
||||
|
||||
unsigned int m_numGlyphs;
|
||||
unsigned int m_numGlyphs;
|
||||
|
||||
public:
|
||||
UIAbstractBitmapFont(const std::string &fontname);
|
||||
~UIAbstractBitmapFont();
|
||||
UIAbstractBitmapFont(const std::string& fontname);
|
||||
~UIAbstractBitmapFont();
|
||||
|
||||
void registerFont();
|
||||
void registerFont();
|
||||
|
||||
// Virtual Functions.
|
||||
virtual IggyFontMetrics *GetFontMetrics(IggyFontMetrics *metrics) = 0;
|
||||
virtual S32 GetCodepointGlyph(U32 codepoint) = 0;
|
||||
virtual IggyGlyphMetrics *GetGlyphMetrics(S32 glyph, IggyGlyphMetrics *metrics) = 0;
|
||||
virtual rrbool IsGlyphEmpty(S32 glyph) = 0;
|
||||
virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph) = 0;
|
||||
virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale) = 0;
|
||||
virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap) = 0;
|
||||
virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap) = 0;
|
||||
// Virtual Functions.
|
||||
virtual IggyFontMetrics* GetFontMetrics(IggyFontMetrics* metrics) = 0;
|
||||
virtual S32 GetCodepointGlyph(U32 codepoint) = 0;
|
||||
virtual IggyGlyphMetrics* GetGlyphMetrics(S32 glyph,
|
||||
IggyGlyphMetrics* metrics) = 0;
|
||||
virtual rrbool IsGlyphEmpty(S32 glyph) = 0;
|
||||
virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph) = 0;
|
||||
virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale) = 0;
|
||||
virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) = 0;
|
||||
virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) = 0;
|
||||
|
||||
// Static Callbacks
|
||||
// Just wrappers for the virtual functions.
|
||||
static IggyFontMetrics * RADLINK GetFontMetrics_Callback(void *user_context, IggyFontMetrics *metrics);
|
||||
static S32 RADLINK GetCodepointGlyph_Callback(void *user_context, U32 codepoint);
|
||||
static IggyGlyphMetrics * RADLINK GetGlyphMetrics_Callback(void *user_context, S32 glyph, IggyGlyphMetrics *metrics);
|
||||
static rrbool RADLINK IsGlyphEmpty_Callback(void *user_context, S32 glyph);
|
||||
static F32 RADLINK GetKerningForGlyphPair_Callback(void *user_context, S32 first_glyph, S32 second_glyph);
|
||||
static rrbool RADLINK CanProvideBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale);
|
||||
static rrbool RADLINK GetGlyphBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
|
||||
static void RADLINK FreeGlyphBitmap_Callback(void *user_context, S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
|
||||
// Static Callbacks
|
||||
// Just wrappers for the virtual functions.
|
||||
static IggyFontMetrics* RADLINK
|
||||
GetFontMetrics_Callback(void* user_context, IggyFontMetrics* metrics);
|
||||
static S32 RADLINK GetCodepointGlyph_Callback(void* user_context,
|
||||
U32 codepoint);
|
||||
static IggyGlyphMetrics* RADLINK GetGlyphMetrics_Callback(
|
||||
void* user_context, S32 glyph, IggyGlyphMetrics* metrics);
|
||||
static rrbool RADLINK IsGlyphEmpty_Callback(void* user_context, S32 glyph);
|
||||
static F32 RADLINK GetKerningForGlyphPair_Callback(void* user_context,
|
||||
S32 first_glyph,
|
||||
S32 second_glyph);
|
||||
static rrbool RADLINK CanProvideBitmap_Callback(void* user_context,
|
||||
S32 glyph, F32 pixel_scale);
|
||||
static rrbool RADLINK GetGlyphBitmap_Callback(void* user_context, S32 glyph,
|
||||
F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap);
|
||||
static void RADLINK FreeGlyphBitmap_Callback(void* user_context, S32 glyph,
|
||||
F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap);
|
||||
};
|
||||
|
||||
class UIBitmapFont : public UIAbstractBitmapFont
|
||||
{
|
||||
class UIBitmapFont : public UIAbstractBitmapFont {
|
||||
protected:
|
||||
CFontData *m_cFontData;
|
||||
CFontData* m_cFontData;
|
||||
|
||||
public:
|
||||
UIBitmapFont(SFontData &sfontdata);
|
||||
UIBitmapFont(SFontData& sfontdata);
|
||||
|
||||
~UIBitmapFont();
|
||||
~UIBitmapFont();
|
||||
|
||||
virtual IggyFontMetrics * GetFontMetrics(IggyFontMetrics *metrics);
|
||||
virtual S32 GetCodepointGlyph(U32 codepoint);
|
||||
virtual IggyGlyphMetrics * GetGlyphMetrics(S32 glyph, IggyGlyphMetrics *metrics);
|
||||
virtual rrbool IsGlyphEmpty(S32 glyph);
|
||||
virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph);
|
||||
virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale);
|
||||
virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
|
||||
virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter *bitmap);
|
||||
virtual IggyFontMetrics* GetFontMetrics(IggyFontMetrics* metrics);
|
||||
virtual S32 GetCodepointGlyph(U32 codepoint);
|
||||
virtual IggyGlyphMetrics* GetGlyphMetrics(S32 glyph,
|
||||
IggyGlyphMetrics* metrics);
|
||||
virtual rrbool IsGlyphEmpty(S32 glyph);
|
||||
virtual F32 GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph);
|
||||
virtual rrbool CanProvideBitmap(S32 glyph, F32 pixel_scale);
|
||||
virtual rrbool GetGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap);
|
||||
virtual void FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap);
|
||||
};
|
||||
@@ -4,158 +4,139 @@
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "../../Minecraft.Client/UI/Gui.h"
|
||||
|
||||
UIComponent_Chat::UIComponent_Chat(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_Chat::UIComponent_Chat(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i)
|
||||
{
|
||||
m_labelChatText[i].init(L"");
|
||||
}
|
||||
m_labelJukebox.init(L"");
|
||||
for (unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) {
|
||||
m_labelChatText[i].init(L"");
|
||||
}
|
||||
m_labelJukebox.init(L"");
|
||||
|
||||
addTimer(0, 100);
|
||||
addTimer(0, 100);
|
||||
}
|
||||
|
||||
std::wstring UIComponent_Chat::getMoviePath()
|
||||
{
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"ComponentChatSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"ComponentChat";
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_Chat::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"ComponentChatSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"ComponentChat";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Chat::handleTimerComplete(int id)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
bool anyVisible = false;
|
||||
if(pMinecraft->localplayers[m_iPad]!= NULL)
|
||||
{
|
||||
Gui *pGui = pMinecraft->gui;
|
||||
//DWORD messagesToDisplay = std::min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) );
|
||||
for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i )
|
||||
{
|
||||
float opacity = pGui->getOpacity(m_iPad, i);
|
||||
if( opacity > 0 )
|
||||
{
|
||||
m_controlLabelBackground[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setLabel( pGui->getMessage(m_iPad,i) );
|
||||
void UIComponent_Chat::handleTimerComplete(int id) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
anyVisible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
}
|
||||
}
|
||||
if(pGui->getJukeboxOpacity(m_iPad) > 0) anyVisible = true;
|
||||
m_labelJukebox.setOpacity( pGui->getJukeboxOpacity(m_iPad) );
|
||||
m_labelJukebox.setLabel( pGui->getJukeboxMessage(m_iPad) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i )
|
||||
{
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
}
|
||||
m_labelJukebox.setOpacity( 0 );
|
||||
}
|
||||
bool anyVisible = false;
|
||||
if (pMinecraft->localplayers[m_iPad] != NULL) {
|
||||
Gui* pGui = pMinecraft->gui;
|
||||
// DWORD messagesToDisplay = std::min( CHAT_LINES_COUNT,
|
||||
// pGui->getMessagesCount(m_iPad) );
|
||||
for (unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) {
|
||||
float opacity = pGui->getOpacity(m_iPad, i);
|
||||
if (opacity > 0) {
|
||||
m_controlLabelBackground[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setOpacity(opacity);
|
||||
m_labelChatText[i].setLabel(pGui->getMessage(m_iPad, i));
|
||||
|
||||
setVisible(anyVisible);
|
||||
anyVisible = true;
|
||||
} else {
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
}
|
||||
}
|
||||
if (pGui->getJukeboxOpacity(m_iPad) > 0) anyVisible = true;
|
||||
m_labelJukebox.setOpacity(pGui->getJukeboxOpacity(m_iPad));
|
||||
m_labelJukebox.setLabel(pGui->getJukeboxMessage(m_iPad));
|
||||
} else {
|
||||
for (unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) {
|
||||
m_controlLabelBackground[i].setOpacity(0);
|
||||
m_labelChatText[i].setOpacity(0);
|
||||
m_labelChatText[i].setLabel(L"");
|
||||
}
|
||||
m_labelJukebox.setOpacity(0);
|
||||
}
|
||||
|
||||
setVisible(anyVisible);
|
||||
}
|
||||
|
||||
void UIComponent_Chat::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
if(m_bSplitscreen)
|
||||
{
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
void UIComponent_Chat::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
if (m_bSplitscreen) {
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
IggyPlayerSetDisplaySize(getMovie(), m_movieWidth, m_movieHeight);
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
tileXStart ,
|
||||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
{
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
IggyPlayerDrawTilesStart(getMovie());
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile(getMovie(), tileXStart, tileYStart,
|
||||
tileXStart + tileWidth, tileYStart + tileHeight, 0);
|
||||
IggyPlayerDrawTilesEnd(getMovie());
|
||||
} else {
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,63 +4,64 @@
|
||||
|
||||
#define CHAT_LINES_COUNT 10
|
||||
|
||||
class UIComponent_Chat : public UIScene
|
||||
{
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
class UIComponent_Chat : public UIScene {
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
|
||||
protected:
|
||||
UIControl_Label m_labelChatText[CHAT_LINES_COUNT];
|
||||
UIControl_Label m_labelJukebox;
|
||||
UIControl m_controlLabelBackground[CHAT_LINES_COUNT];
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelChatText[0],"Label1")
|
||||
UI_MAP_ELEMENT(m_labelChatText[1],"Label2")
|
||||
UI_MAP_ELEMENT(m_labelChatText[2],"Label3")
|
||||
UI_MAP_ELEMENT(m_labelChatText[3],"Label4")
|
||||
UI_MAP_ELEMENT(m_labelChatText[4],"Label5")
|
||||
UI_MAP_ELEMENT(m_labelChatText[5],"Label6")
|
||||
UI_MAP_ELEMENT(m_labelChatText[6],"Label7")
|
||||
UI_MAP_ELEMENT(m_labelChatText[7],"Label8")
|
||||
UI_MAP_ELEMENT(m_labelChatText[8],"Label9")
|
||||
UI_MAP_ELEMENT(m_labelChatText[9],"Label10")
|
||||
UIControl_Label m_labelChatText[CHAT_LINES_COUNT];
|
||||
UIControl_Label m_labelJukebox;
|
||||
UIControl m_controlLabelBackground[CHAT_LINES_COUNT];
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelChatText[0], "Label1")
|
||||
UI_MAP_ELEMENT(m_labelChatText[1], "Label2")
|
||||
UI_MAP_ELEMENT(m_labelChatText[2], "Label3")
|
||||
UI_MAP_ELEMENT(m_labelChatText[3], "Label4")
|
||||
UI_MAP_ELEMENT(m_labelChatText[4], "Label5")
|
||||
UI_MAP_ELEMENT(m_labelChatText[5], "Label6")
|
||||
UI_MAP_ELEMENT(m_labelChatText[6], "Label7")
|
||||
UI_MAP_ELEMENT(m_labelChatText[7], "Label8")
|
||||
UI_MAP_ELEMENT(m_labelChatText[8], "Label9")
|
||||
UI_MAP_ELEMENT(m_labelChatText[9], "Label10")
|
||||
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[0],"Label1Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[1],"Label2Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[2],"Label3Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[3],"Label4Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[4],"Label5Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[5],"Label6Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[6],"Label7Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[7],"Label8Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[8],"Label9Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[9],"Label10Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[0], "Label1Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[1], "Label2Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[2], "Label3Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[3], "Label4Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[4], "Label5Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[5], "Label6Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[6], "Label7Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[7], "Label8Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[8], "Label9Background")
|
||||
UI_MAP_ELEMENT(m_controlLabelBackground[9], "Label10Background")
|
||||
|
||||
UI_MAP_ELEMENT(m_labelJukebox,"Jukebox")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
UI_MAP_ELEMENT(m_labelJukebox, "Jukebox")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
UIComponent_Chat(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_Chat(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Chat;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Chat; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport);
|
||||
|
||||
protected:
|
||||
void handleTimerComplete(int id);
|
||||
void handleTimerComplete(int id);
|
||||
};
|
||||
@@ -2,38 +2,33 @@
|
||||
#include "UI.h"
|
||||
#include "UIComponent_DebugUIConsole.h"
|
||||
|
||||
UIComponent_DebugUIConsole::UIComponent_DebugUIConsole(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_DebugUIConsole::UIComponent_DebugUIConsole(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_bTextChanged = false;
|
||||
m_bTextChanged = false;
|
||||
}
|
||||
|
||||
std::wstring UIComponent_DebugUIConsole::getMoviePath()
|
||||
{
|
||||
return L"DebugUIConsoleComponent";
|
||||
std::wstring UIComponent_DebugUIConsole::getMoviePath() {
|
||||
return L"DebugUIConsoleComponent";
|
||||
}
|
||||
|
||||
void UIComponent_DebugUIConsole::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
if(m_bTextChanged)
|
||||
{
|
||||
m_bTextChanged = false;
|
||||
for(unsigned int i = 0; i < 10 && i < m_textList.size(); ++i)
|
||||
{
|
||||
m_labels[i].setLabel(m_textList[i]);
|
||||
}
|
||||
}
|
||||
void UIComponent_DebugUIConsole::tick() {
|
||||
UIScene::tick();
|
||||
if (m_bTextChanged) {
|
||||
m_bTextChanged = false;
|
||||
for (unsigned int i = 0; i < 10 && i < m_textList.size(); ++i) {
|
||||
m_labels[i].setLabel(m_textList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_DebugUIConsole::addText(const std::string &text)
|
||||
{
|
||||
if(!text.empty() && text.compare("\n") != 0)
|
||||
{
|
||||
if(m_textList.size() >= 10) m_textList.pop_front();
|
||||
m_textList.push_back(text);
|
||||
m_bTextChanged = true;
|
||||
}
|
||||
void UIComponent_DebugUIConsole::addText(const std::string& text) {
|
||||
if (!text.empty() && text.compare("\n") != 0) {
|
||||
if (m_textList.size() >= 10) m_textList.pop_front();
|
||||
m_textList.push_back(text);
|
||||
m_bTextChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -3,47 +3,47 @@
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
class UIComponent_DebugUIConsole : public UIScene
|
||||
{
|
||||
private:
|
||||
UIControl_Label m_labels[10];
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT( m_labels[0], "consoleLine1")
|
||||
UI_MAP_ELEMENT( m_labels[1], "consoleLine2")
|
||||
UI_MAP_ELEMENT( m_labels[2], "consoleLine3")
|
||||
UI_MAP_ELEMENT( m_labels[3], "consoleLine4")
|
||||
UI_MAP_ELEMENT( m_labels[4], "consoleLine5")
|
||||
UI_MAP_ELEMENT( m_labels[5], "consoleLine6")
|
||||
UI_MAP_ELEMENT( m_labels[6], "consoleLine7")
|
||||
UI_MAP_ELEMENT( m_labels[7], "consoleLine8")
|
||||
UI_MAP_ELEMENT( m_labels[8], "consoleLine9")
|
||||
UI_MAP_ELEMENT( m_labels[9], "consoleLine10")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
class UIComponent_DebugUIConsole : public UIScene {
|
||||
private:
|
||||
UIControl_Label m_labels[10];
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labels[0], "consoleLine1")
|
||||
UI_MAP_ELEMENT(m_labels[1], "consoleLine2")
|
||||
UI_MAP_ELEMENT(m_labels[2], "consoleLine3")
|
||||
UI_MAP_ELEMENT(m_labels[3], "consoleLine4")
|
||||
UI_MAP_ELEMENT(m_labels[4], "consoleLine5")
|
||||
UI_MAP_ELEMENT(m_labels[5], "consoleLine6")
|
||||
UI_MAP_ELEMENT(m_labels[6], "consoleLine7")
|
||||
UI_MAP_ELEMENT(m_labels[7], "consoleLine8")
|
||||
UI_MAP_ELEMENT(m_labels[8], "consoleLine9")
|
||||
UI_MAP_ELEMENT(m_labels[9], "consoleLine10")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
std::deque<std::string> m_textList;
|
||||
std::deque<std::string> m_textList;
|
||||
|
||||
bool m_bTextChanged;
|
||||
bool m_bTextChanged;
|
||||
|
||||
public:
|
||||
UIComponent_DebugUIConsole(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_DebugUIConsole(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_DebugUIConsole;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_DebugUIConsole; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
void addText(const std::string &text);
|
||||
void addText(const std::string& text);
|
||||
};
|
||||
@@ -2,32 +2,34 @@
|
||||
#include "UI.h"
|
||||
#include "UIComponent_DebugUIMarketingGuide.h"
|
||||
|
||||
UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(
|
||||
int iPad, void* initData, UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (F64)0; // WIN64
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (F64)0; // WIN64
|
||||
#if defined _XBOX
|
||||
value[0].number = (F64)1;
|
||||
value[0].number = (F64)1;
|
||||
#elif defined _DURANGO
|
||||
value[0].number = (F64)2;
|
||||
value[0].number = (F64)2;
|
||||
#elif defined __PS3__
|
||||
value[0].number = (F64)3;
|
||||
value[0].number = (F64)3;
|
||||
#elif defined __ORBIS__
|
||||
value[0].number = (F64)4;
|
||||
value[0].number = (F64)4;
|
||||
#elif defined __PSVITA__
|
||||
value[0].number = (F64)5;
|
||||
value[0].number = (F64)5;
|
||||
#elif defined _WINDOWS64 || defined __linux__
|
||||
value[0].number = (F64)0;
|
||||
value[0].number = (F64)0;
|
||||
#endif
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetPlatform, 1, value);
|
||||
}
|
||||
|
||||
std::wstring UIComponent_DebugUIMarketingGuide::getMoviePath()
|
||||
{
|
||||
return L"DebugUIMarketingGuide";
|
||||
std::wstring UIComponent_DebugUIMarketingGuide::getMoviePath() {
|
||||
return L"DebugUIMarketingGuide";
|
||||
}
|
||||
|
||||
@@ -3,32 +3,34 @@
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
class UIComponent_DebugUIMarketingGuide : public UIScene
|
||||
{
|
||||
class UIComponent_DebugUIMarketingGuide : public UIScene {
|
||||
private:
|
||||
IggyName m_funcSetPlatform;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_NAME( m_funcSetPlatform, L"SetPlatform")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
IggyName m_funcSetPlatform;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_NAME(m_funcSetPlatform, L"SetPlatform")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
UIComponent_DebugUIMarketingGuide(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_DebugUIMarketingGuide(int iPad, void* initData,
|
||||
UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_DebugUIMarketingGuide;}
|
||||
virtual EUIScene getSceneType() {
|
||||
return eUIComponent_DebugUIMarketingGuide;
|
||||
}
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
};
|
||||
@@ -2,29 +2,28 @@
|
||||
#include "UI.h"
|
||||
#include "UIComponent_Logo.h"
|
||||
|
||||
UIComponent_Logo::UIComponent_Logo(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_Logo::UIComponent_Logo(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
}
|
||||
|
||||
std::wstring UIComponent_Logo::getMoviePath()
|
||||
{
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
return L"ComponentLogoSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
return L"ComponentLogo";
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_Logo::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
return L"ComponentLogoSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
return L"ComponentLogo";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIComponent_Logo : public UIScene
|
||||
{
|
||||
class UIComponent_Logo : public UIScene {
|
||||
public:
|
||||
UIComponent_Logo(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_Logo(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Logo;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Logo; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
};
|
||||
@@ -2,106 +2,98 @@
|
||||
#include "UI.h"
|
||||
#include "UIComponent_MenuBackground.h"
|
||||
|
||||
UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
m_bSplitscreen = false;
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
m_bSplitscreen = false;
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
}
|
||||
|
||||
std::wstring UIComponent_MenuBackground::getMoviePath()
|
||||
{ switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_MenuBackground::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// We use the fullscreen one even in splitscreen, just draw different parts of it
|
||||
return L"MenuBackground";
|
||||
// We use the fullscreen one even in splitscreen, just draw different parts
|
||||
// of it
|
||||
return L"MenuBackground";
|
||||
}
|
||||
|
||||
void UIComponent_MenuBackground::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
if(m_bSplitscreen)
|
||||
{
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
void UIComponent_MenuBackground::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
if (m_bSplitscreen) {
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
IggyPlayerSetDisplaySize(getMovie(), m_movieWidth, m_movieHeight);
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
tileXStart ,
|
||||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
{
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
IggyPlayerDrawTilesStart(getMovie());
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile(getMovie(), tileXStart, tileYStart,
|
||||
tileXStart + tileWidth, tileYStart + tileHeight, 0);
|
||||
IggyPlayerDrawTilesEnd(getMovie());
|
||||
} else {
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,29 +2,31 @@
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIComponent_MenuBackground : public UIScene
|
||||
{
|
||||
class UIComponent_MenuBackground : public UIScene {
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
bool m_bSplitscreen;
|
||||
|
||||
public:
|
||||
UIComponent_MenuBackground(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_MenuBackground(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_MenuBackground;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_MenuBackground; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport);
|
||||
};
|
||||
@@ -6,141 +6,128 @@
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.dimension.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.storage.h"
|
||||
|
||||
UIComponent_Panorama::UIComponent_Panorama(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_Panorama::UIComponent_Panorama(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_bShowingDay = true;
|
||||
m_bShowingDay = true;
|
||||
|
||||
while(!m_hasTickedOnce) tick();
|
||||
while (!m_hasTickedOnce) tick();
|
||||
}
|
||||
|
||||
std::wstring UIComponent_Panorama::getMoviePath()
|
||||
{
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"PanoramaSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"Panorama";
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_Panorama::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"PanoramaSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"Panorama";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Panorama::tick()
|
||||
{
|
||||
if(!hasMovie()) return;
|
||||
void UIComponent_Panorama::tick() {
|
||||
if (!hasMovie()) return;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
EnterCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
if(pMinecraft->level!=NULL)
|
||||
{
|
||||
__int64 i64TimeOfDay =0;
|
||||
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
|
||||
if(pMinecraft->level->dimension->id==0)
|
||||
{
|
||||
i64TimeOfDay = pMinecraft->level->getLevelData()->getTime() % 24000;
|
||||
}
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
EnterCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
if (pMinecraft->level != NULL) {
|
||||
__int64 i64TimeOfDay = 0;
|
||||
// are we in the Nether? - Leave the time as 0 if we are, so we show
|
||||
// daylight
|
||||
if (pMinecraft->level->dimension->id == 0) {
|
||||
i64TimeOfDay = pMinecraft->level->getLevelData()->getTime() % 24000;
|
||||
}
|
||||
|
||||
if(i64TimeOfDay>14000)
|
||||
{
|
||||
setPanorama(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPanorama(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setPanorama(true);
|
||||
}
|
||||
LeaveCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
if (i64TimeOfDay > 14000) {
|
||||
setPanorama(false);
|
||||
} else {
|
||||
setPanorama(true);
|
||||
}
|
||||
} else {
|
||||
setPanorama(true);
|
||||
}
|
||||
LeaveCriticalSection(&pMinecraft->m_setLevelCS);
|
||||
|
||||
UIScene::tick();
|
||||
UIScene::tick();
|
||||
}
|
||||
|
||||
void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
bool specialViewport = (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_TOP) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT);
|
||||
if(m_bSplitscreen && specialViewport)
|
||||
{
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
void UIComponent_Panorama::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
bool specialViewport =
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_TOP) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT);
|
||||
if (m_bSplitscreen && specialViewport) {
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
|
||||
if((viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT))
|
||||
{
|
||||
// Need to render at full height, but only the left side of the scene
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = (S32)(ui.getScreenHeight());
|
||||
if ((viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) ||
|
||||
(viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT)) {
|
||||
// Need to render at full height, but only the left side of the
|
||||
// scene
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = (S32)(ui.getScreenHeight());
|
||||
|
||||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
IggyPlayerSetDisplaySize(getMovie(), m_movieWidth, m_movieHeight);
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
tileXStart ,
|
||||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Need to render at full height, and full width. But compressed into the viewport
|
||||
IggyPlayerSetDisplaySize( getMovie(), ui.getScreenWidth(), ui.getScreenHeight()/2 );
|
||||
IggyPlayerDraw( getMovie() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
IggyPlayerDrawTilesStart(getMovie());
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile(getMovie(), tileXStart, tileYStart,
|
||||
tileXStart + tileWidth, tileYStart + tileHeight,
|
||||
0);
|
||||
IggyPlayerDrawTilesEnd(getMovie());
|
||||
} else {
|
||||
// Need to render at full height, and full width. But compressed
|
||||
// into the viewport
|
||||
IggyPlayerSetDisplaySize(getMovie(), ui.getScreenWidth(),
|
||||
ui.getScreenHeight() / 2);
|
||||
IggyPlayerDraw(getMovie());
|
||||
}
|
||||
} else {
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Panorama::setPanorama(bool isDay)
|
||||
{
|
||||
if(isDay != m_bShowingDay)
|
||||
{
|
||||
m_bShowingDay = isDay;
|
||||
void UIComponent_Panorama::setPanorama(bool isDay) {
|
||||
if (isDay != m_bShowingDay) {
|
||||
m_bShowingDay = isDay;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = isDay;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = isDay;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowPanoramaDay , 1 , value );
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcShowPanoramaDay, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,39 +2,39 @@
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIComponent_Panorama : public UIScene
|
||||
{
|
||||
class UIComponent_Panorama : public UIScene {
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
bool m_bShowingDay;
|
||||
bool m_bSplitscreen;
|
||||
bool m_bShowingDay;
|
||||
|
||||
protected:
|
||||
IggyName m_funcShowPanoramaDay;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_NAME(m_funcShowPanoramaDay, L"ShowPanoramaDay");
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
IggyName m_funcShowPanoramaDay;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_NAME(m_funcShowPanoramaDay, L"ShowPanoramaDay");
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
UIComponent_Panorama(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_Panorama(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Panorama;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Panorama; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { return false; }
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport);
|
||||
|
||||
private:
|
||||
void setPanorama(bool isDay);
|
||||
void setPanorama(bool isDay);
|
||||
};
|
||||
|
||||
@@ -3,165 +3,154 @@
|
||||
#include "UIComponent_PressStartToPlay.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad,
|
||||
void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_showingSaveIcon = false;
|
||||
m_showingAutosaveTimer = false;
|
||||
m_showingTrialTimer = false;
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
m_showingPressStart[i] = false;
|
||||
}
|
||||
m_trialTimer = L"";
|
||||
m_autosaveTimer = L"";
|
||||
m_showingSaveIcon = false;
|
||||
m_showingAutosaveTimer = false;
|
||||
m_showingTrialTimer = false;
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
m_showingPressStart[i] = false;
|
||||
}
|
||||
m_trialTimer = L"";
|
||||
m_autosaveTimer = L"";
|
||||
|
||||
m_labelTrialTimer.init(L"");
|
||||
m_labelTrialTimer.setVisible(false);
|
||||
m_labelTrialTimer.init(L"");
|
||||
m_labelTrialTimer.setVisible(false);
|
||||
|
||||
#ifdef __ORBIS__
|
||||
std::wstring text = app.GetString(IDS_PRESS_X_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_A*}", app.GetVKReplacement(VK_PAD_A) );
|
||||
std::wstring text = app.GetString(IDS_PRESS_X_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_A*}",
|
||||
app.GetVKReplacement(VK_PAD_A));
|
||||
|
||||
m_labelPressStart.init(text.c_str());
|
||||
m_labelPressStart.init(text.c_str());
|
||||
#elif defined _XBOX_ONE
|
||||
std::wstring text = app.GetString(IDS_PRESS_START_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_START*}", app.GetVKReplacement(VK_PAD_START) );
|
||||
m_labelPressStart.init(text.c_str());
|
||||
std::wstring text = app.GetString(IDS_PRESS_START_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_START*}",
|
||||
app.GetVKReplacement(VK_PAD_START));
|
||||
m_labelPressStart.init(text.c_str());
|
||||
#else
|
||||
m_labelPressStart.init(app.GetString(IDS_PRESS_START_TO_JOIN));
|
||||
m_labelPressStart.init(app.GetString(IDS_PRESS_START_TO_JOIN));
|
||||
#endif
|
||||
m_controlSaveIcon.setVisible(false);
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
m_playerDisplayName.setVisible(false);
|
||||
m_controlSaveIcon.setVisible(false);
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
m_playerDisplayName.setVisible(false);
|
||||
}
|
||||
|
||||
std::wstring UIComponent_PressStartToPlay::getMoviePath()
|
||||
{
|
||||
return L"PressStartToPlay";
|
||||
std::wstring UIComponent_PressStartToPlay::getMoviePath() {
|
||||
return L"PressStartToPlay";
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::handleReload()
|
||||
{
|
||||
// 4J Stu - It's possible these could change during the reload, so can't use the normal controls refresh of it's state
|
||||
m_controlSaveIcon.setVisible(m_showingSaveIcon);
|
||||
m_labelTrialTimer.setVisible(m_showingAutosaveTimer);
|
||||
m_labelTrialTimer.setLabel(m_autosaveTimer);
|
||||
m_labelTrialTimer.setVisible(m_showingTrialTimer);
|
||||
m_labelTrialTimer.setLabel(m_trialTimer);
|
||||
void UIComponent_PressStartToPlay::handleReload() {
|
||||
// 4J Stu - It's possible these could change during the reload, so can't use
|
||||
// the normal controls refresh of it's state
|
||||
m_controlSaveIcon.setVisible(m_showingSaveIcon);
|
||||
m_labelTrialTimer.setVisible(m_showingAutosaveTimer);
|
||||
m_labelTrialTimer.setLabel(m_autosaveTimer);
|
||||
m_labelTrialTimer.setVisible(m_showingTrialTimer);
|
||||
m_labelTrialTimer.setLabel(m_trialTimer);
|
||||
|
||||
bool showPressStart = false;
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
bool show = m_showingPressStart[i];
|
||||
showPressStart |= show;
|
||||
bool showPressStart = false;
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
bool show = m_showingPressStart[i];
|
||||
showPressStart |= show;
|
||||
|
||||
if(show)
|
||||
{
|
||||
addTimer(0,3000);
|
||||
if (show) {
|
||||
addTimer(0, 3000);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = i;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = i;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowController , 1 , value );
|
||||
}
|
||||
}
|
||||
m_controlPressStartPanel.setVisible(showPressStart);
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcShowController, 1, value);
|
||||
}
|
||||
}
|
||||
m_controlPressStartPanel.setVisible(showPressStart);
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::handleTimerComplete(int id)
|
||||
{
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
m_showingPressStart[i] = false;
|
||||
}
|
||||
ui.ClearPressStart();
|
||||
void UIComponent_PressStartToPlay::handleTimerComplete(int id) {
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||
m_showingPressStart[i] = false;
|
||||
}
|
||||
ui.ClearPressStart();
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::showPressStart(int iPad, bool show)
|
||||
{
|
||||
m_showingPressStart[iPad] = show;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_controlPressStartPanel.setVisible(show);
|
||||
void UIComponent_PressStartToPlay::showPressStart(int iPad, bool show) {
|
||||
m_showingPressStart[iPad] = show;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_controlPressStartPanel.setVisible(show);
|
||||
|
||||
if(show)
|
||||
{
|
||||
addTimer(0,3000);
|
||||
if (show) {
|
||||
addTimer(0, 3000);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iPad;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iPad;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowController , 1 , value );
|
||||
}
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcShowController, 1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::setTrialTimer(const std::wstring &label)
|
||||
{
|
||||
m_trialTimer = label;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_labelTrialTimer.setLabel(label);
|
||||
}
|
||||
void UIComponent_PressStartToPlay::setTrialTimer(const std::wstring& label) {
|
||||
m_trialTimer = label;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_labelTrialTimer.setLabel(label);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::showTrialTimer(bool show)
|
||||
{
|
||||
m_showingTrialTimer = show;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_labelTrialTimer.setVisible(show);
|
||||
}
|
||||
void UIComponent_PressStartToPlay::showTrialTimer(bool show) {
|
||||
m_showingTrialTimer = show;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_labelTrialTimer.setVisible(show);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::setAutosaveTimer(const std::wstring &label)
|
||||
{
|
||||
m_autosaveTimer = label;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_labelTrialTimer.setLabel(label);
|
||||
}
|
||||
void UIComponent_PressStartToPlay::setAutosaveTimer(const std::wstring& label) {
|
||||
m_autosaveTimer = label;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_labelTrialTimer.setLabel(label);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::showAutosaveTimer(bool show)
|
||||
{
|
||||
m_showingAutosaveTimer = show;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_labelTrialTimer.setVisible(show);
|
||||
}
|
||||
void UIComponent_PressStartToPlay::showAutosaveTimer(bool show) {
|
||||
m_showingAutosaveTimer = show;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_labelTrialTimer.setVisible(show);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::showSaveIcon(bool show)
|
||||
{
|
||||
m_showingSaveIcon = show;
|
||||
if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
|
||||
{
|
||||
m_controlSaveIcon.setVisible(show);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(show) app.DebugPrintf("Tried to show save icon while texture pack reload was in progress\n");
|
||||
}
|
||||
void UIComponent_PressStartToPlay::showSaveIcon(bool show) {
|
||||
m_showingSaveIcon = show;
|
||||
if (!ui.IsExpectingOrReloadingSkin() && hasMovie()) {
|
||||
m_controlSaveIcon.setVisible(show);
|
||||
} else {
|
||||
if (show)
|
||||
app.DebugPrintf(
|
||||
"Tried to show save icon while texture pack reload was in "
|
||||
"progress\n");
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::showPlayerDisplayName(bool show)
|
||||
{
|
||||
void UIComponent_PressStartToPlay::showPlayerDisplayName(bool show) {
|
||||
#ifdef _XBOX_ONE
|
||||
if(show)
|
||||
{
|
||||
m_playerDisplayName.setLabel(ProfileManager.GetDisplayName(ProfileManager.GetPrimaryPad()));
|
||||
}
|
||||
m_playerDisplayName.setVisible(show);
|
||||
if (show) {
|
||||
m_playerDisplayName.setLabel(
|
||||
ProfileManager.GetDisplayName(ProfileManager.GetPrimaryPad()));
|
||||
}
|
||||
m_playerDisplayName.setVisible(show);
|
||||
#else
|
||||
m_playerDisplayName.setVisible(false);
|
||||
m_playerDisplayName.setVisible(false);
|
||||
#endif
|
||||
}
|
||||
@@ -2,59 +2,60 @@
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIComponent_PressStartToPlay : public UIScene
|
||||
{
|
||||
class UIComponent_PressStartToPlay : public UIScene {
|
||||
private:
|
||||
bool m_showingSaveIcon;
|
||||
bool m_showingAutosaveTimer;
|
||||
bool m_showingTrialTimer;
|
||||
bool m_showingPressStart[XUSER_MAX_COUNT];
|
||||
std::wstring m_trialTimer;
|
||||
std::wstring m_autosaveTimer;
|
||||
bool m_showingSaveIcon;
|
||||
bool m_showingAutosaveTimer;
|
||||
bool m_showingTrialTimer;
|
||||
bool m_showingPressStart[XUSER_MAX_COUNT];
|
||||
std::wstring m_trialTimer;
|
||||
std::wstring m_autosaveTimer;
|
||||
|
||||
protected:
|
||||
UIControl_Label m_labelTrialTimer, m_labelPressStart, m_playerDisplayName;
|
||||
UIControl m_controlSaveIcon, m_controlPressStartPanel;
|
||||
IggyName m_funcShowController;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelTrialTimer, "TrialTimer")
|
||||
UI_MAP_ELEMENT(m_controlSaveIcon, "SaveIcon")
|
||||
UI_MAP_ELEMENT(m_playerDisplayName, "PlayerName")
|
||||
UI_MAP_ELEMENT(m_controlPressStartPanel, "MainPanel")
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlPressStartPanel)
|
||||
UI_MAP_ELEMENT(m_labelPressStart, "PressStartLabel" )
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UIControl_Label m_labelTrialTimer, m_labelPressStart, m_playerDisplayName;
|
||||
UIControl m_controlSaveIcon, m_controlPressStartPanel;
|
||||
IggyName m_funcShowController;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelTrialTimer, "TrialTimer")
|
||||
UI_MAP_ELEMENT(m_controlSaveIcon, "SaveIcon")
|
||||
UI_MAP_ELEMENT(m_playerDisplayName, "PlayerName")
|
||||
UI_MAP_ELEMENT(m_controlPressStartPanel, "MainPanel")
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlPressStartPanel)
|
||||
UI_MAP_ELEMENT(m_labelPressStart, "PressStartLabel")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
|
||||
UI_MAP_NAME(m_funcShowController, L"ShowController");
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
UI_MAP_NAME(m_funcShowController, L"ShowController");
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
UIComponent_PressStartToPlay(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_PressStartToPlay(int iPad, void* initData,
|
||||
UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_PressStartToPlay;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_PressStartToPlay; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
virtual void handleReload();
|
||||
virtual void handleTimerComplete(int id);
|
||||
virtual void handleReload();
|
||||
virtual void handleTimerComplete(int id);
|
||||
|
||||
void showPressStart(int iPad, bool show);
|
||||
void setTrialTimer(const std::wstring &label);
|
||||
void showTrialTimer(bool show);
|
||||
void setAutosaveTimer(const std::wstring &label);
|
||||
void showAutosaveTimer(bool show);
|
||||
void showSaveIcon(bool show);
|
||||
void showPlayerDisplayName(bool show);
|
||||
void showPressStart(int iPad, bool show);
|
||||
void setTrialTimer(const std::wstring& label);
|
||||
void showTrialTimer(bool show);
|
||||
void setAutosaveTimer(const std::wstring& label);
|
||||
void showAutosaveTimer(bool show);
|
||||
void showSaveIcon(bool show);
|
||||
void showPlayerDisplayName(bool show);
|
||||
};
|
||||
@@ -2,506 +2,481 @@
|
||||
#include "UI.h"
|
||||
#include "UIComponent_Tooltips.h"
|
||||
|
||||
UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
{
|
||||
for(int j=0;j<ACTION_MAX_MENU;j++)
|
||||
{
|
||||
m_overrideSFX[i][j]=false;
|
||||
}
|
||||
}
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||
for (int j = 0; j < ACTION_MAX_MENU; j++) {
|
||||
m_overrideSFX[i][j] = false;
|
||||
}
|
||||
}
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// initialise vita touch controls with ids
|
||||
for(unsigned int i = 0; i < ETouchInput_Count; ++i)
|
||||
{
|
||||
m_TouchController[i].init(i);
|
||||
}
|
||||
// initialise vita touch controls with ids
|
||||
for (unsigned int i = 0; i < ETouchInput_Count; ++i) {
|
||||
m_TouchController[i].init(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
if(InputManager.IsCircleCrossSwapped())
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = true;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetABSwap , 1 , value );
|
||||
}
|
||||
if (InputManager.IsCircleCrossSwapped()) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = true;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetABSwap, 1, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring UIComponent_Tooltips::getMoviePath()
|
||||
{
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"ToolTipsSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"ToolTips";
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_Tooltips::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
m_bSplitscreen = true;
|
||||
return L"ToolTipsSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
m_bSplitscreen = false;
|
||||
return L"ToolTips";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
F64 UIComponent_Tooltips::getSafeZoneHalfWidth()
|
||||
{
|
||||
float width = ui.getScreenWidth();
|
||||
F64 UIComponent_Tooltips::getSafeZoneHalfWidth() {
|
||||
float width = ui.getScreenWidth();
|
||||
|
||||
float safeWidth = 0.0f;
|
||||
float safeWidth = 0.0f;
|
||||
|
||||
#ifndef __PSVITA__
|
||||
// 85% safezone for tooltips in either SD mode
|
||||
if( !RenderManager.IsHiDef() )
|
||||
{
|
||||
// 85% safezone
|
||||
safeWidth = m_movieWidth * (0.15f / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 90% safezone
|
||||
safeWidth = width * (0.1f / 2);
|
||||
}
|
||||
// 85% safezone for tooltips in either SD mode
|
||||
if (!RenderManager.IsHiDef()) {
|
||||
// 85% safezone
|
||||
safeWidth = m_movieWidth * (0.15f / 2);
|
||||
} else {
|
||||
// 90% safezone
|
||||
safeWidth = width * (0.1f / 2);
|
||||
}
|
||||
#endif
|
||||
return safeWidth;
|
||||
return safeWidth;
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::updateSafeZone()
|
||||
{
|
||||
// Distance from edge
|
||||
F64 safeTop = 0.0;
|
||||
F64 safeBottom = 0.0;
|
||||
F64 safeLeft = 0.0;
|
||||
F64 safeRight = 0.0;
|
||||
void UIComponent_Tooltips::updateSafeZone() {
|
||||
// Distance from edge
|
||||
F64 safeTop = 0.0;
|
||||
F64 safeBottom = 0.0;
|
||||
F64 safeLeft = 0.0;
|
||||
F64 safeRight = 0.0;
|
||||
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
}
|
||||
setSafeZone(safeTop, safeBottom, safeLeft, safeRight);
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
safeTop = getSafeZoneHalfHeight();
|
||||
safeBottom = getSafeZoneHalfHeight();
|
||||
safeLeft = getSafeZoneHalfWidth();
|
||||
safeRight = getSafeZoneHalfWidth();
|
||||
break;
|
||||
}
|
||||
setSafeZone(safeTop, safeBottom, safeLeft, safeRight);
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
void UIComponent_Tooltips::tick() {
|
||||
UIScene::tick();
|
||||
|
||||
// set the opacity of the tooltip items
|
||||
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
|
||||
float fVal;
|
||||
// set the opacity of the tooltip items
|
||||
unsigned char ucAlpha = app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_InterfaceOpacity);
|
||||
float fVal;
|
||||
|
||||
if(ucAlpha<80)
|
||||
{
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if(ui.GetMenuDisplayed(m_iPad) && (ucAlpha<15))
|
||||
{
|
||||
ucAlpha=15;
|
||||
}
|
||||
if (ucAlpha < 80) {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(m_iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
|
||||
// check if we have the timer running for the opacity
|
||||
unsigned int uiOpacityTimer=app.GetOpacityTimer(m_iPad);
|
||||
if(uiOpacityTimer!=0)
|
||||
{
|
||||
if(uiOpacityTimer<10)
|
||||
{
|
||||
float fStep=(80.0f-(float)ucAlpha)/10.0f;
|
||||
fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
|
||||
}
|
||||
else
|
||||
{
|
||||
fVal=0.01f*80.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fVal=0.01f*(float)ucAlpha;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if(ui.GetMenuDisplayed(m_iPad) && (ucAlpha<15))
|
||||
{
|
||||
ucAlpha=15;
|
||||
}
|
||||
fVal=0.01f*(float)ucAlpha;
|
||||
}
|
||||
setOpacity(fVal);
|
||||
// check if we have the timer running for the opacity
|
||||
unsigned int uiOpacityTimer = app.GetOpacityTimer(m_iPad);
|
||||
if (uiOpacityTimer != 0) {
|
||||
if (uiOpacityTimer < 10) {
|
||||
float fStep = (80.0f - (float)ucAlpha) / 10.0f;
|
||||
fVal =
|
||||
0.01f * (80.0f - ((10.0f - (float)uiOpacityTimer) * fStep));
|
||||
} else {
|
||||
fVal = 0.01f * 80.0f;
|
||||
}
|
||||
} else {
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
} else {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(m_iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
setOpacity(fVal);
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
if((ProfileManager.GetLockedProfile()!=-1) && !ui.GetMenuDisplayed(m_iPad) && (app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0 || app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)==0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
void UIComponent_Tooltips::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
if ((ProfileManager.GetLockedProfile() != -1) &&
|
||||
!ui.GetMenuDisplayed(m_iPad) &&
|
||||
(app.GetGameSettings(m_iPad, eGameSetting_Tooltips) == 0 ||
|
||||
app.GetGameSettings(m_iPad, eGameSetting_DisplayHUD) == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_bSplitscreen)
|
||||
{
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
if (m_bSplitscreen) {
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
S32 tileXStart = 0;
|
||||
S32 tileYStart = 0;
|
||||
S32 tileWidth = width;
|
||||
S32 tileHeight = height;
|
||||
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
tileHeight = (S32)(ui.getScreenHeight());
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
tileWidth = (S32)(ui.getScreenWidth());
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
tileYStart = (S32)(m_movieHeight / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
|
||||
IggyPlayerSetDisplaySize(getMovie(), m_movieWidth, m_movieHeight);
|
||||
|
||||
IggyPlayerDrawTilesStart ( getMovie() );
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile ( getMovie() ,
|
||||
tileXStart ,
|
||||
tileYStart ,
|
||||
tileXStart + tileWidth ,
|
||||
tileYStart + tileHeight ,
|
||||
0 );
|
||||
IggyPlayerDrawTilesEnd ( getMovie() );
|
||||
}
|
||||
else
|
||||
{
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
IggyPlayerDrawTilesStart(getMovie());
|
||||
|
||||
m_renderWidth = tileWidth;
|
||||
m_renderHeight = tileHeight;
|
||||
IggyPlayerDrawTile(getMovie(), tileXStart, tileYStart,
|
||||
tileXStart + tileWidth, tileYStart + tileHeight, 0);
|
||||
IggyPlayerDrawTilesEnd(getMovie());
|
||||
} else {
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::SetTooltipText( unsigned int tooltip, int iTextID )
|
||||
{
|
||||
if( _SetTooltip(tooltip, iTextID) ) _Relayout();
|
||||
void UIComponent_Tooltips::SetTooltipText(unsigned int tooltip, int iTextID) {
|
||||
if (_SetTooltip(tooltip, iTextID)) _Relayout();
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::SetEnableTooltips( bool bVal )
|
||||
{
|
||||
void UIComponent_Tooltips::SetEnableTooltips(bool bVal) {}
|
||||
|
||||
void UIComponent_Tooltips::ShowTooltip(unsigned int tooltip, bool show) {
|
||||
if (show != m_tooltipValues[tooltip].show) {
|
||||
_SetTooltip(tooltip, L"", show);
|
||||
_Relayout();
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::ShowTooltip( unsigned int tooltip, bool show )
|
||||
{
|
||||
if(show != m_tooltipValues[tooltip].show)
|
||||
{
|
||||
_SetTooltip(tooltip, L"", show);
|
||||
_Relayout();
|
||||
}
|
||||
void UIComponent_Tooltips::SetTooltips(int iA, int iB, int iX, int iY, int iLT,
|
||||
int iRT, int iLB, int iRB, int iLS,
|
||||
bool forceUpdate) {
|
||||
bool needsRelayout = false;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonA, iA) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonB, iB) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonX, iX) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonY, iY) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonLT, iLT) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonRT, iRT) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonLB, iLB) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonRB, iRB) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonLS, iLS) || needsRelayout;
|
||||
|
||||
if (needsRelayout) _Relayout();
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::SetTooltips( int iA, int iB, int iX, int iY , int iLT, int iRT, int iLB, int iRB, int iLS, bool forceUpdate)
|
||||
{
|
||||
bool needsRelayout = false;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonA, iA ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonB, iB ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonX, iX ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonY, iY ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonLT, iLT ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonRT, iRT ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonLB, iLB ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonRB, iRB ) || needsRelayout;
|
||||
needsRelayout = _SetTooltip( eToolTipButtonLS, iLS ) || needsRelayout;
|
||||
void UIComponent_Tooltips::EnableTooltip(unsigned int tooltip, bool enable) {}
|
||||
|
||||
if(needsRelayout)_Relayout();
|
||||
bool UIComponent_Tooltips::_SetTooltip(unsigned int iToolTip, int iTextID) {
|
||||
bool changed = false;
|
||||
if (iTextID != m_tooltipValues[iToolTip].iString ||
|
||||
(iTextID > -1 && !m_tooltipValues[iToolTip].show)) {
|
||||
m_tooltipValues[iToolTip].iString = iTextID;
|
||||
changed = true;
|
||||
if (iTextID > -1)
|
||||
_SetTooltip(iToolTip, app.GetString(iTextID), true);
|
||||
else if (iTextID == -2)
|
||||
_SetTooltip(iToolTip, L"", true);
|
||||
else
|
||||
_SetTooltip(iToolTip, L"", false);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::EnableTooltip( unsigned int tooltip, bool enable )
|
||||
{
|
||||
void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId,
|
||||
const std::wstring& label, bool show,
|
||||
bool force) {
|
||||
if (!force && !show && !m_tooltipValues[iToolTipId].show) {
|
||||
return;
|
||||
}
|
||||
m_tooltipValues[iToolTipId].show = show;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iToolTipId;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[1].string16 = stringVal;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = show;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetTooltip, 3, value);
|
||||
|
||||
app.DebugPrintf("Actual tooltip update!\n");
|
||||
}
|
||||
|
||||
bool UIComponent_Tooltips::_SetTooltip(unsigned int iToolTip, int iTextID)
|
||||
{
|
||||
bool changed = false;
|
||||
if(iTextID != m_tooltipValues[iToolTip].iString || (iTextID > -1 && !m_tooltipValues[iToolTip].show))
|
||||
{
|
||||
m_tooltipValues[iToolTip].iString = iTextID;
|
||||
changed = true;
|
||||
if(iTextID > -1) _SetTooltip(iToolTip, app.GetString(iTextID), true);
|
||||
else if(iTextID == -2) _SetTooltip(iToolTip, L"", true);
|
||||
else _SetTooltip(iToolTip, L"", false);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, const std::wstring &label, bool show, bool force)
|
||||
{
|
||||
if(!force && !show && !m_tooltipValues[iToolTipId].show)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_tooltipValues[iToolTipId].show = show;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iToolTipId;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[1].string16 = stringVal;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = show;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetTooltip , 3 , value );
|
||||
|
||||
app.DebugPrintf("Actual tooltip update!\n");
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::_Relayout()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , NULL );
|
||||
void UIComponent_Tooltips::_Relayout() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcUpdateLayout, 0, NULL);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// rebuild touchboxes
|
||||
ui.TouchBoxRebuild(this);
|
||||
// rebuild touchboxes
|
||||
ui.TouchBoxRebuild(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
|
||||
{
|
||||
//app.DebugPrintf("ToolTip Touch ID = %i\n", iId);
|
||||
bool handled = false;
|
||||
void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y,
|
||||
int iId, bool bPressed,
|
||||
bool bRepeat, bool bReleased) {
|
||||
// app.DebugPrintf("ToolTip Touch ID = %i\n", iId);
|
||||
bool handled = false;
|
||||
|
||||
// perform action on release
|
||||
if(bReleased)
|
||||
{
|
||||
switch(iId)
|
||||
{
|
||||
case ETouchInput_Touch_A:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_X\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_X);
|
||||
break;
|
||||
case ETouchInput_Touch_B:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_O\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_O);
|
||||
break;
|
||||
case ETouchInput_Touch_X:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SQUARE\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SQUARE);
|
||||
break;
|
||||
case ETouchInput_Touch_Y:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_TRIANGLE\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_TRIANGLE);
|
||||
break;
|
||||
case ETouchInput_Touch_LT:
|
||||
/* not in use on vita */
|
||||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
break;
|
||||
case ETouchInput_Touch_RightTrigger:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SELECT\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SELECT);
|
||||
break;
|
||||
case ETouchInput_Touch_LeftBumper:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_L1\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_L1);
|
||||
break;
|
||||
case ETouchInput_Touch_RightBumper:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_R1\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_R1);
|
||||
break;
|
||||
case ETouchInput_Touch_LeftStick:
|
||||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
/* no action */
|
||||
break;
|
||||
}
|
||||
}
|
||||
// perform action on release
|
||||
if (bReleased) {
|
||||
switch (iId) {
|
||||
case ETouchInput_Touch_A:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_X\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_X);
|
||||
break;
|
||||
case ETouchInput_Touch_B:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_O\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_O);
|
||||
break;
|
||||
case ETouchInput_Touch_X:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SQUARE\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SQUARE);
|
||||
break;
|
||||
case ETouchInput_Touch_Y:
|
||||
app.DebugPrintf(
|
||||
"ToolTip Map Touch to _PSV_JOY_BUTTON_TRIANGLE\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_TRIANGLE);
|
||||
break;
|
||||
case ETouchInput_Touch_LT:
|
||||
/* not in use on vita */
|
||||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
break;
|
||||
case ETouchInput_Touch_RightTrigger:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SELECT\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SELECT);
|
||||
break;
|
||||
case ETouchInput_Touch_LeftBumper:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_L1\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_L1);
|
||||
break;
|
||||
case ETouchInput_Touch_RightBumper:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_R1\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_R1);
|
||||
break;
|
||||
case ETouchInput_Touch_LeftStick:
|
||||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
/* no action */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIComponent_Tooltips::handleReload()
|
||||
{
|
||||
app.DebugPrintf("UIComponent_Tooltips::handleReload\n");
|
||||
void UIComponent_Tooltips::handleReload() {
|
||||
app.DebugPrintf("UIComponent_Tooltips::handleReload\n");
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
if(InputManager.IsCircleCrossSwapped())
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = true;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetABSwap , 1 , value );
|
||||
}
|
||||
if (InputManager.IsCircleCrossSwapped()) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = true;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetABSwap, 1, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 0; i < eToolTipNumButtons; ++i)
|
||||
{
|
||||
_SetTooltip(i,app.GetString(m_tooltipValues[i].iString), m_tooltipValues[i].show, true);
|
||||
}
|
||||
_Relayout();
|
||||
for (unsigned int i = 0; i < eToolTipNumButtons; ++i) {
|
||||
_SetTooltip(i, app.GetString(m_tooltipValues[i].iString),
|
||||
m_tooltipValues[i].show, true);
|
||||
}
|
||||
_Relayout();
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
if(m_overrideSFX[iPad][key])
|
||||
{
|
||||
// don't play a sound for this action
|
||||
switch(key)
|
||||
{
|
||||
case ACTION_MENU_A:
|
||||
case ACTION_MENU_OK:
|
||||
case ACTION_MENU_PAGEUP:
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
case ACTION_MENU_X:
|
||||
case ACTION_MENU_Y:
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_CANCEL:
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
case ACTION_MENU_LEFT:
|
||||
case ACTION_MENU_RIGHT:
|
||||
case ACTION_MENU_UP:
|
||||
case ACTION_MENU_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case ACTION_MENU_OK:
|
||||
case ACTION_MENU_CANCEL:
|
||||
// 4J-PB - We get both A and OK, and B and Cancel, so only play a sound on one of them.
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_A:
|
||||
case ACTION_MENU_X:
|
||||
case ACTION_MENU_Y:
|
||||
// 4J-PB - play a Press sound
|
||||
//CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
void UIComponent_Tooltips::handleInput(int iPad, int key, bool repeat,
|
||||
bool pressed, bool released,
|
||||
bool& handled) {
|
||||
if (m_overrideSFX[iPad][key]) {
|
||||
// don't play a sound for this action
|
||||
switch (key) {
|
||||
case ACTION_MENU_A:
|
||||
case ACTION_MENU_OK:
|
||||
case ACTION_MENU_PAGEUP:
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
case ACTION_MENU_X:
|
||||
case ACTION_MENU_Y:
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_CANCEL:
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
case ACTION_MENU_LEFT:
|
||||
case ACTION_MENU_RIGHT:
|
||||
case ACTION_MENU_UP:
|
||||
case ACTION_MENU_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (key) {
|
||||
case ACTION_MENU_OK:
|
||||
case ACTION_MENU_CANCEL:
|
||||
// 4J-PB - We get both A and OK, and B and Cancel, so only play
|
||||
// a sound on one of them.
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_A:
|
||||
case ACTION_MENU_X:
|
||||
case ACTION_MENU_Y:
|
||||
// 4J-PB - play a Press sound
|
||||
// CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
|
||||
case ACTION_MENU_B:
|
||||
// 4J-PB - play a Press sound
|
||||
//CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Back);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_B:
|
||||
// 4J-PB - play a Press sound
|
||||
// CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Back);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
//CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Scroll);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_PAGEUP:
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
case ACTION_MENU_LEFT:
|
||||
case ACTION_MENU_RIGHT:
|
||||
case ACTION_MENU_UP:
|
||||
case ACTION_MENU_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
// CD - Removed, causes a sound on all presses
|
||||
/*if(pressed)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Scroll);
|
||||
}*/
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_PAGEUP:
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
case ACTION_MENU_LEFT:
|
||||
case ACTION_MENU_RIGHT:
|
||||
case ACTION_MENU_UP:
|
||||
case ACTION_MENU_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::overrideSFX(int iPad, int key, bool bVal)
|
||||
{
|
||||
m_overrideSFX[iPad][key]=bVal;
|
||||
void UIComponent_Tooltips::overrideSFX(int iPad, int key, bool bVal) {
|
||||
m_overrideSFX[iPad][key] = bVal;
|
||||
}
|
||||
|
||||
@@ -2,109 +2,117 @@
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIComponent_Tooltips : public UIScene
|
||||
{
|
||||
class UIComponent_Tooltips : public UIScene {
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
bool m_bSplitscreen;
|
||||
|
||||
protected:
|
||||
typedef struct _TooltipValues
|
||||
{
|
||||
bool show;
|
||||
int iString;
|
||||
typedef struct _TooltipValues {
|
||||
bool show;
|
||||
int iString;
|
||||
|
||||
_TooltipValues()
|
||||
{
|
||||
show = false;
|
||||
iString = -1;
|
||||
}
|
||||
} TooltipValues;
|
||||
_TooltipValues() {
|
||||
show = false;
|
||||
iString = -1;
|
||||
}
|
||||
} TooltipValues;
|
||||
|
||||
TooltipValues m_tooltipValues[eToolTipNumButtons];
|
||||
TooltipValues m_tooltipValues[eToolTipNumButtons];
|
||||
|
||||
IggyName m_funcSetTooltip, m_funcSetOpacity, m_funcSetABSwap, m_funcUpdateLayout;
|
||||
IggyName m_funcSetTooltip, m_funcSetOpacity, m_funcSetABSwap,
|
||||
m_funcUpdateLayout;
|
||||
|
||||
#ifdef __PSVITA__
|
||||
enum ETouchInput
|
||||
{
|
||||
ETouchInput_Touch_A,
|
||||
ETouchInput_Touch_B,
|
||||
ETouchInput_Touch_X,
|
||||
ETouchInput_Touch_Y,
|
||||
ETouchInput_Touch_LT,
|
||||
ETouchInput_Touch_RightTrigger,
|
||||
ETouchInput_Touch_LeftBumper,
|
||||
ETouchInput_Touch_RightBumper,
|
||||
ETouchInput_Touch_LeftStick,
|
||||
|
||||
ETouchInput_Count,
|
||||
};
|
||||
UIControl_Touch m_TouchController[ETouchInput_Count];
|
||||
enum ETouchInput {
|
||||
ETouchInput_Touch_A,
|
||||
ETouchInput_Touch_B,
|
||||
ETouchInput_Touch_X,
|
||||
ETouchInput_Touch_Y,
|
||||
ETouchInput_Touch_LT,
|
||||
ETouchInput_Touch_RightTrigger,
|
||||
ETouchInput_Touch_LeftBumper,
|
||||
ETouchInput_Touch_RightBumper,
|
||||
ETouchInput_Touch_LeftStick,
|
||||
|
||||
ETouchInput_Count,
|
||||
};
|
||||
UIControl_Touch m_TouchController[ETouchInput_Count];
|
||||
#endif
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
#ifdef __PSVITA__
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_A], "Touch_A")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_B], "Touch_B")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_X], "Touch_X")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_Y], "Touch_Y")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_LT], "Touch_LT")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_RightTrigger], "Touch_RightTrigger")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_LeftBumper], "Touch_LeftBumper")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_RightBumper], "Touch_RightBumper")
|
||||
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_LeftStick], "Touch_LeftStick")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_A], "Touch_A")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_B], "Touch_B")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_X], "Touch_X")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_Y], "Touch_Y")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_LT], "Touch_LT")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_RightTrigger],
|
||||
"Touch_RightTrigger")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_LeftBumper],
|
||||
"Touch_LeftBumper")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_RightBumper],
|
||||
"Touch_RightBumper")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_LeftStick],
|
||||
"Touch_LeftStick")
|
||||
#endif
|
||||
UI_MAP_NAME( m_funcSetTooltip, L"SetToolTip")
|
||||
UI_MAP_NAME( m_funcSetOpacity, L"SetOpacity")
|
||||
UI_MAP_NAME( m_funcSetABSwap, L"SetABSwap")
|
||||
UI_MAP_NAME( m_funcUpdateLayout, L"UpdateLayout")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
UI_MAP_NAME(m_funcSetTooltip, L"SetToolTip")
|
||||
UI_MAP_NAME(m_funcSetOpacity, L"SetOpacity")
|
||||
UI_MAP_NAME(m_funcSetABSwap, L"SetABSwap")
|
||||
UI_MAP_NAME(m_funcUpdateLayout, L"UpdateLayout")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
virtual F64 getSafeZoneHalfWidth();
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
virtual F64 getSafeZoneHalfWidth();
|
||||
|
||||
public:
|
||||
UIComponent_Tooltips(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_Tooltips(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Tooltips;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_Tooltips; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
virtual void updateSafeZone();
|
||||
virtual void updateSafeZone();
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport);
|
||||
|
||||
virtual void SetTooltipText( unsigned int tooltip, int iTextID );
|
||||
virtual void SetEnableTooltips( bool bVal );
|
||||
virtual void ShowTooltip( unsigned int tooltip, bool show );
|
||||
virtual void SetTooltips( int iA, int iB=-1, int iX=-1, int iY=-1 , int iLT=-1, int iRT=-1, int iLB=-1, int iRB=-1, int iLS=-1, bool forceUpdate = false);
|
||||
virtual void EnableTooltip( unsigned int tooltip, bool enable );
|
||||
virtual void SetTooltipText(unsigned int tooltip, int iTextID);
|
||||
virtual void SetEnableTooltips(bool bVal);
|
||||
virtual void ShowTooltip(unsigned int tooltip, bool show);
|
||||
virtual void SetTooltips(int iA, int iB = -1, int iX = -1, int iY = -1,
|
||||
int iLT = -1, int iRT = -1, int iLB = -1,
|
||||
int iRB = -1, int iLS = -1,
|
||||
bool forceUpdate = false);
|
||||
virtual void EnableTooltip(unsigned int tooltip, bool enable);
|
||||
|
||||
virtual void handleReload();
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
|
||||
void overrideSFX(int iPad, int key, bool bVal);
|
||||
virtual void handleReload();
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed,
|
||||
bool released, bool& handled);
|
||||
|
||||
void overrideSFX(int iPad, int key, bool bVal);
|
||||
|
||||
private:
|
||||
bool _SetTooltip(unsigned int iToolTip, int iTextID);
|
||||
void _SetTooltip(unsigned int iToolTipId, const std::wstring &label, bool show, bool force = false);
|
||||
void _Relayout();
|
||||
bool _SetTooltip(unsigned int iToolTip, int iTextID);
|
||||
void _SetTooltip(unsigned int iToolTipId, const std::wstring& label,
|
||||
bool show, bool force = false);
|
||||
void _Relayout();
|
||||
|
||||
bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU];
|
||||
bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU];
|
||||
|
||||
#ifdef __PSVITA__
|
||||
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
|
||||
virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId,
|
||||
bool bPressed, bool bRepeat, bool bReleased);
|
||||
#endif
|
||||
};
|
||||
@@ -7,338 +7,339 @@
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h"
|
||||
|
||||
UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_interactScene = NULL;
|
||||
m_lastInteractSceneMoved = NULL;
|
||||
m_lastSceneMovedLeft = false;
|
||||
m_bAllowFade = false;
|
||||
m_iconItem = nullptr;
|
||||
m_iconIsFoil = false;
|
||||
m_interactScene = NULL;
|
||||
m_lastInteractSceneMoved = NULL;
|
||||
m_lastSceneMovedLeft = false;
|
||||
m_bAllowFade = false;
|
||||
m_iconItem = nullptr;
|
||||
m_iconIsFoil = false;
|
||||
|
||||
m_bContainerMenuVisible = false;
|
||||
m_bSplitscreenGamertagVisible = false;
|
||||
m_bContainerMenuVisible = false;
|
||||
m_bSplitscreenGamertagVisible = false;
|
||||
|
||||
m_labelDescription.init(L"");
|
||||
m_labelDescription.init(L"");
|
||||
|
||||
// 4jcraft added
|
||||
m_tutorial = NULL;
|
||||
// 4jcraft added
|
||||
m_tutorial = NULL;
|
||||
}
|
||||
|
||||
std::wstring UIComponent_TutorialPopup::getMoviePath()
|
||||
{
|
||||
switch( m_parentLayer->getViewport() )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
return L"TutorialPopupSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
return L"TutorialPopup";
|
||||
break;
|
||||
}
|
||||
std::wstring UIComponent_TutorialPopup::getMoviePath() {
|
||||
switch (m_parentLayer->getViewport()) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
return L"TutorialPopupSplit";
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
default:
|
||||
return L"TutorialPopup";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::UpdateTutorialPopup()
|
||||
{
|
||||
// has the Splitscreen Gamertag visibility been changed? Re-Adjust Layout to prevent overlaps!
|
||||
if(m_bSplitscreenGamertagVisible != (bool)(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags) != 0))
|
||||
{
|
||||
m_bSplitscreenGamertagVisible = (bool)(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags) != 0);
|
||||
handleReload();
|
||||
}
|
||||
void UIComponent_TutorialPopup::UpdateTutorialPopup() {
|
||||
// has the Splitscreen Gamertag visibility been changed? Re-Adjust Layout to
|
||||
// prevent overlaps!
|
||||
if (m_bSplitscreenGamertagVisible !=
|
||||
(bool)(app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_DisplaySplitscreenGamertags) !=
|
||||
0)) {
|
||||
m_bSplitscreenGamertagVisible =
|
||||
(bool)(app.GetGameSettings(
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_DisplaySplitscreenGamertags) != 0);
|
||||
handleReload();
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::handleReload()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = (bool)((app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) && !m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen gamertag?
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAdjustLayout, 1 , value );
|
||||
void UIComponent_TutorialPopup::handleReload() {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval =
|
||||
(bool)((app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_DisplaySplitscreenGamertags) !=
|
||||
0) &&
|
||||
!m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen
|
||||
// gamertag?
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcAdjustLayout, 1, value);
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::SetTutorialDescription(TutorialPopupInfo *info)
|
||||
{
|
||||
m_interactScene = info->interactScene;
|
||||
void UIComponent_TutorialPopup::SetTutorialDescription(
|
||||
TutorialPopupInfo* info) {
|
||||
m_interactScene = info->interactScene;
|
||||
|
||||
// 4jcraft added
|
||||
m_tutorial = info->tutorial;
|
||||
// 4jcraft added
|
||||
m_tutorial = info->tutorial;
|
||||
|
||||
std::wstring parsed = _SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc);
|
||||
parsed = _SetImage( parsed );
|
||||
parsed = ParseDescription(m_iPad, parsed);
|
||||
std::wstring parsed =
|
||||
_SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc);
|
||||
parsed = _SetImage(parsed);
|
||||
parsed = ParseDescription(m_iPad, parsed);
|
||||
|
||||
if(parsed.empty())
|
||||
{
|
||||
_SetDescription( info->interactScene, L"", L"", info->allowFade, info->isReminder );
|
||||
}
|
||||
else
|
||||
{
|
||||
_SetDescription( info->interactScene, parsed, info->title, info->allowFade, info->isReminder );
|
||||
}
|
||||
if (parsed.empty()) {
|
||||
_SetDescription(info->interactScene, L"", L"", info->allowFade,
|
||||
info->isReminder);
|
||||
} else {
|
||||
_SetDescription(info->interactScene, parsed, info->title,
|
||||
info->allowFade, info->isReminder);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::RemoveInteractSceneReference(UIScene *scene)
|
||||
{
|
||||
if( m_interactScene == scene )
|
||||
{
|
||||
m_interactScene = NULL;
|
||||
}
|
||||
void UIComponent_TutorialPopup::RemoveInteractSceneReference(UIScene* scene) {
|
||||
if (m_interactScene == scene) {
|
||||
m_interactScene = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::SetVisible(bool visible)
|
||||
{
|
||||
m_parentLayer->showComponent(0,eUIComponent_TutorialPopup,visible);
|
||||
void UIComponent_TutorialPopup::SetVisible(bool visible) {
|
||||
m_parentLayer->showComponent(0, eUIComponent_TutorialPopup, visible);
|
||||
|
||||
if( visible && m_bAllowFade )
|
||||
{
|
||||
//Initialise a timer to fade us out again
|
||||
app.DebugPrintf("UIComponent_TutorialPopup::SetVisible: setting TUTORIAL_POPUP_FADE_TIMER_ID to %d\n",m_tutorial->GetTutorialDisplayMessageTime());
|
||||
addTimer(TUTORIAL_POPUP_FADE_TIMER_ID,m_tutorial->GetTutorialDisplayMessageTime());
|
||||
}
|
||||
if (visible && m_bAllowFade) {
|
||||
// Initialise a timer to fade us out again
|
||||
app.DebugPrintf(
|
||||
"UIComponent_TutorialPopup::SetVisible: setting "
|
||||
"TUTORIAL_POPUP_FADE_TIMER_ID to %d\n",
|
||||
m_tutorial->GetTutorialDisplayMessageTime());
|
||||
addTimer(TUTORIAL_POPUP_FADE_TIMER_ID,
|
||||
m_tutorial->GetTutorialDisplayMessageTime());
|
||||
}
|
||||
}
|
||||
|
||||
bool UIComponent_TutorialPopup::IsVisible()
|
||||
{
|
||||
return m_parentLayer->isComponentVisible(eUIComponent_TutorialPopup);
|
||||
bool UIComponent_TutorialPopup::IsVisible() {
|
||||
return m_parentLayer->isComponentVisible(eUIComponent_TutorialPopup);
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::handleTimerComplete(int id)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case TUTORIAL_POPUP_FADE_TIMER_ID:
|
||||
SetVisible(false);
|
||||
killTimer(id);
|
||||
app.DebugPrintf("handleTimerComplete: setting TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
break;
|
||||
case TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID:
|
||||
UpdateInteractScenePosition(IsVisible());
|
||||
killTimer(id);
|
||||
break;
|
||||
}
|
||||
void UIComponent_TutorialPopup::handleTimerComplete(int id) {
|
||||
switch (id) {
|
||||
case TUTORIAL_POPUP_FADE_TIMER_ID:
|
||||
SetVisible(false);
|
||||
killTimer(id);
|
||||
app.DebugPrintf(
|
||||
"handleTimerComplete: setting "
|
||||
"TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,
|
||||
TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
break;
|
||||
case TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID:
|
||||
UpdateInteractScenePosition(IsVisible());
|
||||
killTimer(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const std::wstring &desc, const std::wstring &title, bool allowFade, bool isReminder)
|
||||
{
|
||||
m_interactScene = interactScene;
|
||||
app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene);
|
||||
if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL;
|
||||
if(desc.empty())
|
||||
{
|
||||
SetVisible( false );
|
||||
app.DebugPrintf("_SetDescription1: setting TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
killTimer(TUTORIAL_POPUP_FADE_TIMER_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetVisible( true );
|
||||
app.DebugPrintf("_SetDescription2: setting TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
void UIComponent_TutorialPopup::_SetDescription(UIScene* interactScene,
|
||||
const std::wstring& desc,
|
||||
const std::wstring& title,
|
||||
bool allowFade,
|
||||
bool isReminder) {
|
||||
m_interactScene = interactScene;
|
||||
app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene);
|
||||
if (interactScene != m_lastInteractSceneMoved)
|
||||
m_lastInteractSceneMoved = NULL;
|
||||
if (desc.empty()) {
|
||||
SetVisible(false);
|
||||
app.DebugPrintf(
|
||||
"_SetDescription1: setting TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,
|
||||
TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
killTimer(TUTORIAL_POPUP_FADE_TIMER_ID);
|
||||
} else {
|
||||
SetVisible(true);
|
||||
app.DebugPrintf(
|
||||
"_SetDescription2: setting TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,
|
||||
TUTORIAL_POPUP_MOVE_SCENE_TIME);
|
||||
|
||||
if( allowFade )
|
||||
{
|
||||
//Initialise a timer to fade us out again
|
||||
app.DebugPrintf("_SetDescription: setting TUTORIAL_POPUP_FADE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_FADE_TIMER_ID,m_tutorial->GetTutorialDisplayMessageTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("_SetDescription: killing TUTORIAL_POPUP_FADE_TIMER_ID\n");
|
||||
killTimer(TUTORIAL_POPUP_FADE_TIMER_ID);
|
||||
}
|
||||
m_bAllowFade = allowFade;
|
||||
if (allowFade) {
|
||||
// Initialise a timer to fade us out again
|
||||
app.DebugPrintf(
|
||||
"_SetDescription: setting TUTORIAL_POPUP_FADE_TIMER_ID\n");
|
||||
addTimer(TUTORIAL_POPUP_FADE_TIMER_ID,
|
||||
m_tutorial->GetTutorialDisplayMessageTime());
|
||||
} else {
|
||||
app.DebugPrintf(
|
||||
"_SetDescription: killing TUTORIAL_POPUP_FADE_TIMER_ID\n");
|
||||
killTimer(TUTORIAL_POPUP_FADE_TIMER_ID);
|
||||
}
|
||||
m_bAllowFade = allowFade;
|
||||
|
||||
if(isReminder)
|
||||
{
|
||||
std::wstring text(app.GetString( IDS_TUTORIAL_REMINDER ));
|
||||
text.append( desc );
|
||||
stripWhitespaceForHtml( text );
|
||||
// set the text colour
|
||||
wchar_t formatting[40];
|
||||
// 4J Stu - Don't set HTML font size, that's set at design time in flash
|
||||
//swprintf(formatting, 40, L"<font color=\"#%08x\" size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize);
|
||||
swprintf(formatting, 40, L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White));
|
||||
text = formatting + text;
|
||||
if (isReminder) {
|
||||
std::wstring text(app.GetString(IDS_TUTORIAL_REMINDER));
|
||||
text.append(desc);
|
||||
stripWhitespaceForHtml(text);
|
||||
// set the text colour
|
||||
wchar_t formatting[40];
|
||||
// 4J Stu - Don't set HTML font size, that's set at design time in
|
||||
// flash
|
||||
// swprintf(formatting, 40, L"<font color=\"#%08x\"
|
||||
// size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize);
|
||||
swprintf(formatting, 40, L"<font color=\"#%08x\">",
|
||||
app.GetHTMLColour(eHTMLColor_White));
|
||||
text = formatting + text;
|
||||
|
||||
m_labelDescription.setLabel( text, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring text(desc);
|
||||
stripWhitespaceForHtml( text );
|
||||
// set the text colour
|
||||
wchar_t formatting[40];
|
||||
// 4J Stu - Don't set HTML font size, that's set at design time in flash
|
||||
//swprintf(formatting, 40, L"<font color=\"#%08x\" size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize);
|
||||
swprintf(formatting, 40, L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White));
|
||||
text = formatting + text;
|
||||
m_labelDescription.setLabel(text, true);
|
||||
} else {
|
||||
std::wstring text(desc);
|
||||
stripWhitespaceForHtml(text);
|
||||
// set the text colour
|
||||
wchar_t formatting[40];
|
||||
// 4J Stu - Don't set HTML font size, that's set at design time in
|
||||
// flash
|
||||
// swprintf(formatting, 40, L"<font color=\"#%08x\"
|
||||
// size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize);
|
||||
swprintf(formatting, 40, L"<font color=\"#%08x\">",
|
||||
app.GetHTMLColour(eHTMLColor_White));
|
||||
text = formatting + text;
|
||||
|
||||
m_labelDescription.setLabel( text, true );
|
||||
m_labelDescription.setLabel(text, true);
|
||||
}
|
||||
|
||||
}
|
||||
m_labelTitle.setLabel(title, true);
|
||||
m_labelTitle.setVisible(!title.empty());
|
||||
|
||||
m_labelTitle.setLabel( title, true );
|
||||
m_labelTitle.setVisible(!title.empty());
|
||||
|
||||
|
||||
// read host setting if gamertag is visible or not and pass on to Adjust Layout function (so we can offset it to stay clear of the gamertag)
|
||||
m_bSplitscreenGamertagVisible = (bool)(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = (m_bSplitscreenGamertagVisible && !m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen gamertag?
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAdjustLayout, 1 , value );
|
||||
}
|
||||
// read host setting if gamertag is visible or not and pass on to Adjust
|
||||
// Layout function (so we can offset it to stay clear of the gamertag)
|
||||
m_bSplitscreenGamertagVisible =
|
||||
(bool)(app.GetGameSettings(
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_DisplaySplitscreenGamertags) != 0);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval =
|
||||
(m_bSplitscreenGamertagVisible &&
|
||||
!m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen
|
||||
// gamertag?
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcAdjustLayout, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t *desc)
|
||||
{
|
||||
std::wstring temp(desc);
|
||||
std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal,
|
||||
bool isFoil,
|
||||
const wchar_t* desc) {
|
||||
std::wstring temp(desc);
|
||||
|
||||
bool isFixedIcon = false;
|
||||
|
||||
m_iconIsFoil = isFoil;
|
||||
if( icon != TUTORIAL_NO_ICON )
|
||||
{
|
||||
m_iconIsFoil = false;
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iconItem = nullptr;
|
||||
std::wstring openTag(L"{*ICON*}");
|
||||
std::wstring closeTag(L"{*/ICON*}");
|
||||
int iconTagStartPos = (int)temp.find(openTag);
|
||||
int iconStartPos = iconTagStartPos + (int)openTag.length();
|
||||
if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() )
|
||||
{
|
||||
int iconEndPos = (int)temp.find( closeTag, iconStartPos );
|
||||
bool isFixedIcon = false;
|
||||
|
||||
if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() )
|
||||
{
|
||||
std::wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos);
|
||||
m_iconIsFoil = isFoil;
|
||||
if (icon != TUTORIAL_NO_ICON) {
|
||||
m_iconIsFoil = false;
|
||||
m_iconItem =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(icon, 1, iAuxVal));
|
||||
} else {
|
||||
m_iconItem = nullptr;
|
||||
std::wstring openTag(L"{*ICON*}");
|
||||
std::wstring closeTag(L"{*/ICON*}");
|
||||
int iconTagStartPos = (int)temp.find(openTag);
|
||||
int iconStartPos = iconTagStartPos + (int)openTag.length();
|
||||
if (iconTagStartPos > 0 && iconStartPos < (int)temp.length()) {
|
||||
int iconEndPos = (int)temp.find(closeTag, iconStartPos);
|
||||
|
||||
std::vector<std::wstring> idAndAux = stringSplit(id,L':');
|
||||
if (iconEndPos > iconStartPos && iconEndPos < (int)temp.length()) {
|
||||
std::wstring id =
|
||||
temp.substr(iconStartPos, iconEndPos - iconStartPos);
|
||||
|
||||
int iconId = _fromString<int>(idAndAux[0]);
|
||||
std::vector<std::wstring> idAndAux = stringSplit(id, L':');
|
||||
|
||||
if(idAndAux.size() > 1)
|
||||
{
|
||||
iAuxVal = _fromString<int>(idAndAux[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
iAuxVal = 0;
|
||||
}
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
||||
int iconId = _fromString<int>(idAndAux[0]);
|
||||
|
||||
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
||||
}
|
||||
}
|
||||
|
||||
// remove any icon text
|
||||
else if(temp.find(L"{*CraftingTableIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*SticksIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*PlanksIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenShovelIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenHatchetIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FurnaceIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*WoodenDoorIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*TorchIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*BoatIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FishingRodIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*FishIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*MinecartIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*RailIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*PoweredRailIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
||||
}
|
||||
else if(temp.find(L"{*StructuresIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
isFixedIcon = true;
|
||||
setupIconHolder(e_ICON_TYPE_STRUCTURES);
|
||||
}
|
||||
else if(temp.find(L"{*ToolsIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
isFixedIcon = true;
|
||||
setupIconHolder(e_ICON_TYPE_TOOLS);
|
||||
}
|
||||
else if(temp.find(L"{*StoneIcon*}")!=std::wstring::npos)
|
||||
{
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iconItem = nullptr;
|
||||
}
|
||||
}
|
||||
if(!isFixedIcon && m_iconItem != NULL) setupIconHolder(e_ICON_TYPE_IGGY);
|
||||
m_controlIconHolder.setVisible( isFixedIcon || m_iconItem != NULL);
|
||||
if (idAndAux.size() > 1) {
|
||||
iAuxVal = _fromString<int>(idAndAux[1]);
|
||||
} else {
|
||||
iAuxVal = 0;
|
||||
}
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(iconId, 1, iAuxVal));
|
||||
|
||||
return temp;
|
||||
temp.replace(iconTagStartPos,
|
||||
iconEndPos - iconTagStartPos + closeTag.length(),
|
||||
L"");
|
||||
}
|
||||
}
|
||||
|
||||
// remove any icon text
|
||||
else if (temp.find(L"{*CraftingTableIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::workBench_Id, 1, 0));
|
||||
} else if (temp.find(L"{*SticksIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::stick_Id, 1, 0));
|
||||
} else if (temp.find(L"{*PlanksIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::wood_Id, 1, 0));
|
||||
} else if (temp.find(L"{*WoodenShovelIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::shovel_wood_Id, 1, 0));
|
||||
} else if (temp.find(L"{*WoodenHatchetIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::hatchet_wood_Id, 1, 0));
|
||||
} else if (temp.find(L"{*WoodenPickaxeIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::pickAxe_wood_Id, 1, 0));
|
||||
} else if (temp.find(L"{*FurnaceIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::furnace_Id, 1, 0));
|
||||
} else if (temp.find(L"{*WoodenDoorIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::door_wood, 1, 0));
|
||||
} else if (temp.find(L"{*TorchIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::torch_Id, 1, 0));
|
||||
} else if (temp.find(L"{*BoatIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::boat_Id, 1, 0));
|
||||
} else if (temp.find(L"{*FishingRodIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::fishingRod_Id, 1, 0));
|
||||
} else if (temp.find(L"{*FishIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::fish_raw_Id, 1, 0));
|
||||
} else if (temp.find(L"{*MinecartIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::minecart_Id, 1, 0));
|
||||
} else if (temp.find(L"{*RailIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::rail_Id, 1, 0));
|
||||
} else if (temp.find(L"{*PoweredRailIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::goldenRail_Id, 1, 0));
|
||||
} else if (temp.find(L"{*StructuresIcon*}") != std::wstring::npos) {
|
||||
isFixedIcon = true;
|
||||
setupIconHolder(e_ICON_TYPE_STRUCTURES);
|
||||
} else if (temp.find(L"{*ToolsIcon*}") != std::wstring::npos) {
|
||||
isFixedIcon = true;
|
||||
setupIconHolder(e_ICON_TYPE_TOOLS);
|
||||
} else if (temp.find(L"{*StoneIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::rock_Id, 1, 0));
|
||||
} else {
|
||||
m_iconItem = nullptr;
|
||||
}
|
||||
}
|
||||
if (!isFixedIcon && m_iconItem != NULL) setupIconHolder(e_ICON_TYPE_IGGY);
|
||||
m_controlIconHolder.setVisible(isFixedIcon || m_iconItem != NULL);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc)
|
||||
{
|
||||
// 4J Stu - Unused
|
||||
std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring& desc) {
|
||||
// 4J Stu - Unused
|
||||
#if 0
|
||||
bool imageShowAtStart = m_image.IsShown();
|
||||
|
||||
@@ -387,165 +388,159 @@ std::wstring UIComponent_TutorialPopup::_SetImage(std::wstring &desc)
|
||||
m_description.SetBounds(fDescWidth, fDescHeight);
|
||||
}
|
||||
#endif
|
||||
return desc;
|
||||
return desc;
|
||||
}
|
||||
|
||||
std::wstring UIComponent_TutorialPopup::ParseDescription(int iPad,
|
||||
std::wstring& text) {
|
||||
text = replaceAll(text, L"{*CraftingTableIcon*}", L"");
|
||||
text = replaceAll(text, L"{*SticksIcon*}", L"");
|
||||
text = replaceAll(text, L"{*PlanksIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenShovelIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenHatchetIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenPickaxeIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FurnaceIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenDoorIcon*}", L"");
|
||||
text = replaceAll(text, L"{*TorchIcon*}", L"");
|
||||
text = replaceAll(text, L"{*MinecartIcon*}", L"");
|
||||
text = replaceAll(text, L"{*BoatIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FishingRodIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FishIcon*}", L"");
|
||||
text = replaceAll(text, L"{*RailIcon*}", L"");
|
||||
text = replaceAll(text, L"{*PoweredRailIcon*}", L"");
|
||||
text = replaceAll(text, L"{*StructuresIcon*}", L"");
|
||||
text = replaceAll(text, L"{*ToolsIcon*}", L"");
|
||||
text = replaceAll(text, L"{*StoneIcon*}", L"");
|
||||
|
||||
std::wstring UIComponent_TutorialPopup::ParseDescription(int iPad, std::wstring &text)
|
||||
{
|
||||
text = replaceAll(text, L"{*CraftingTableIcon*}", L"");
|
||||
text = replaceAll(text, L"{*SticksIcon*}", L"");
|
||||
text = replaceAll(text, L"{*PlanksIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenShovelIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenHatchetIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenPickaxeIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FurnaceIcon*}", L"");
|
||||
text = replaceAll(text, L"{*WoodenDoorIcon*}", L"");
|
||||
text = replaceAll(text, L"{*TorchIcon*}", L"");
|
||||
text = replaceAll(text, L"{*MinecartIcon*}", L"");
|
||||
text = replaceAll(text, L"{*BoatIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FishingRodIcon*}", L"");
|
||||
text = replaceAll(text, L"{*FishIcon*}", L"");
|
||||
text = replaceAll(text, L"{*RailIcon*}", L"");
|
||||
text = replaceAll(text, L"{*PoweredRailIcon*}", L"");
|
||||
text = replaceAll(text, L"{*StructuresIcon*}", L"");
|
||||
text = replaceAll(text, L"{*ToolsIcon*}", L"");
|
||||
text = replaceAll(text, L"{*StoneIcon*}", L"");
|
||||
|
||||
bool exitScreenshot = false;
|
||||
size_t pos = text.find(L"{*EXIT_PICTURE*}");
|
||||
if(pos != std::wstring::npos) exitScreenshot = true;
|
||||
text = replaceAll(text, L"{*EXIT_PICTURE*}", L"");
|
||||
m_controlExitScreenshot.setVisible(exitScreenshot);
|
||||
/*
|
||||
bool exitScreenshot = false;
|
||||
size_t pos = text.find(L"{*EXIT_PICTURE*}");
|
||||
if (pos != std::wstring::npos) exitScreenshot = true;
|
||||
text = replaceAll(text, L"{*EXIT_PICTURE*}", L"");
|
||||
m_controlExitScreenshot.setVisible(exitScreenshot);
|
||||
/*
|
||||
#define MINECRAFT_ACTION_RENDER_DEBUG ACTION_INGAME_13
|
||||
#define MINECRAFT_ACTION_PAUSEMENU ACTION_INGAME_15
|
||||
#define MINECRAFT_ACTION_SNEAK_TOGGLE ACTION_INGAME_17
|
||||
*/
|
||||
*/
|
||||
|
||||
return app.FormatHTMLString(iPad,text);
|
||||
return app.FormatHTMLString(iPad, text);
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible)
|
||||
{
|
||||
if( m_interactScene == NULL ) return;
|
||||
void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) {
|
||||
if (m_interactScene == NULL) return;
|
||||
|
||||
// 4J-PB - check this players screen section to see if we should allow the animation
|
||||
bool bAllowAnim=false;
|
||||
bool isCraftingScene = (m_interactScene->getSceneType() == eUIScene_Crafting2x2Menu) || (m_interactScene->getSceneType() == eUIScene_Crafting3x3Menu);
|
||||
bool isCreativeScene = (m_interactScene->getSceneType() == eUIScene_CreativeMenu);
|
||||
switch(Minecraft::GetInstance()->localplayers[m_iPad]->m_iScreenSection)
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
bAllowAnim=true;
|
||||
break;
|
||||
default:
|
||||
// anim allowed for everything except the crafting 2x2 and 3x3, and the creative menu
|
||||
if(!isCraftingScene && !isCreativeScene)
|
||||
{
|
||||
bAllowAnim=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// 4J-PB - check this players screen section to see if we should allow the
|
||||
// animation
|
||||
bool bAllowAnim = false;
|
||||
bool isCraftingScene =
|
||||
(m_interactScene->getSceneType() == eUIScene_Crafting2x2Menu) ||
|
||||
(m_interactScene->getSceneType() == eUIScene_Crafting3x3Menu);
|
||||
bool isCreativeScene =
|
||||
(m_interactScene->getSceneType() == eUIScene_CreativeMenu);
|
||||
switch (Minecraft::GetInstance()->localplayers[m_iPad]->m_iScreenSection) {
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
bAllowAnim = true;
|
||||
break;
|
||||
default:
|
||||
// anim allowed for everything except the crafting 2x2 and 3x3, and
|
||||
// the creative menu
|
||||
if (!isCraftingScene && !isCreativeScene) {
|
||||
bAllowAnim = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(bAllowAnim)
|
||||
{
|
||||
bool movingLeft = visible;
|
||||
if (bAllowAnim) {
|
||||
bool movingLeft = visible;
|
||||
|
||||
if( (m_lastInteractSceneMoved != m_interactScene && movingLeft) || ( m_lastInteractSceneMoved == m_interactScene && m_lastSceneMovedLeft != movingLeft ) )
|
||||
{
|
||||
if(movingLeft)
|
||||
{
|
||||
m_interactScene->slideLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_interactScene->slideRight();
|
||||
}
|
||||
|
||||
m_lastInteractSceneMoved = m_interactScene;
|
||||
m_lastSceneMovedLeft = movingLeft;
|
||||
}
|
||||
}
|
||||
if ((m_lastInteractSceneMoved != m_interactScene && movingLeft) ||
|
||||
(m_lastInteractSceneMoved == m_interactScene &&
|
||||
m_lastSceneMovedLeft != movingLeft)) {
|
||||
if (movingLeft) {
|
||||
m_interactScene->slideLeft();
|
||||
} else {
|
||||
m_interactScene->slideRight();
|
||||
}
|
||||
|
||||
m_lastInteractSceneMoved = m_interactScene;
|
||||
m_lastSceneMovedLeft = movingLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
if(viewport != C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
{
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Adjust for safezone
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
yPos += getSafeZoneHalfHeight();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch( viewport )
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos -= getSafeZoneHalfWidth();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
void UIComponent_TutorialPopup::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
if (viewport != C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
||||
S32 xPos = 0;
|
||||
S32 yPos = 0;
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos = (S32)(ui.getScreenWidth() / 2);
|
||||
yPos = (S32)(ui.getScreenHeight() / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Adjust for safezone
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
yPos += getSafeZoneHalfHeight();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (viewport) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
xPos -= getSafeZoneHalfWidth();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.setupRenderPosition(xPos, yPos);
|
||||
|
||||
IggyPlayerSetDisplaySize( getMovie(), width, height );
|
||||
IggyPlayerDraw( getMovie() );
|
||||
}
|
||||
else
|
||||
{
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
IggyPlayerSetDisplaySize(getMovie(), width, height);
|
||||
IggyPlayerDraw(getMovie());
|
||||
} else {
|
||||
UIScene::render(width, height, viewport);
|
||||
}
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::customDraw(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
if(m_iconItem != NULL) customDrawSlotControl(region,m_iPad,m_iconItem,1.0f,m_iconItem->isFoil() || m_iconIsFoil,false);
|
||||
void UIComponent_TutorialPopup::customDraw(
|
||||
IggyCustomDrawCallbackRegion* region) {
|
||||
if (m_iconItem != NULL)
|
||||
customDrawSlotControl(region, m_iPad, m_iconItem, 1.0f,
|
||||
m_iconItem->isFoil() || m_iconIsFoil, false);
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::setupIconHolder(EIcons icon)
|
||||
{
|
||||
app.DebugPrintf("Setting icon holder to %d\n", icon);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (F64)icon;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetupIconHolder , 1 , value );
|
||||
void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) {
|
||||
app.DebugPrintf("Setting icon holder to %d\n", icon);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (F64)icon;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetupIconHolder, 1, value);
|
||||
}
|
||||
|
||||
@@ -6,96 +6,101 @@
|
||||
#define TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID 1
|
||||
#define TUTORIAL_POPUP_MOVE_SCENE_TIME 500
|
||||
|
||||
|
||||
class UIComponent_TutorialPopup : public UIScene
|
||||
{
|
||||
class UIComponent_TutorialPopup : public UIScene {
|
||||
private:
|
||||
// A scene that may be displayed behind the popup that the player is using, that will need shifted so we can see it clearly.
|
||||
UIScene *m_interactScene, *m_lastInteractSceneMoved;
|
||||
bool m_lastSceneMovedLeft;
|
||||
bool m_bAllowFade;
|
||||
Tutorial *m_tutorial;
|
||||
std::shared_ptr<ItemInstance> m_iconItem;
|
||||
bool m_iconIsFoil;
|
||||
//int m_iLocalPlayerC;
|
||||
// A scene that may be displayed behind the popup that the player is using,
|
||||
// that will need shifted so we can see it clearly.
|
||||
UIScene *m_interactScene, *m_lastInteractSceneMoved;
|
||||
bool m_lastSceneMovedLeft;
|
||||
bool m_bAllowFade;
|
||||
Tutorial* m_tutorial;
|
||||
std::shared_ptr<ItemInstance> m_iconItem;
|
||||
bool m_iconIsFoil;
|
||||
// int m_iLocalPlayerC;
|
||||
|
||||
bool m_bContainerMenuVisible;
|
||||
bool m_bSplitscreenGamertagVisible;
|
||||
bool m_bContainerMenuVisible;
|
||||
bool m_bSplitscreenGamertagVisible;
|
||||
|
||||
// Maps to values in AS
|
||||
enum EIcons
|
||||
{
|
||||
e_ICON_TYPE_IGGY = 0,
|
||||
e_ICON_TYPE_ARMOUR = 1,
|
||||
e_ICON_TYPE_BREWING = 2,
|
||||
e_ICON_TYPE_DECORATION = 3,
|
||||
e_ICON_TYPE_FOOD = 4,
|
||||
e_ICON_TYPE_MATERIALS = 5,
|
||||
e_ICON_TYPE_MECHANISMS = 6,
|
||||
e_ICON_TYPE_MISC = 7,
|
||||
e_ICON_TYPE_REDSTONE_AND_TRANSPORT = 8,
|
||||
e_ICON_TYPE_STRUCTURES = 9,
|
||||
e_ICON_TYPE_TOOLS = 10,
|
||||
e_ICON_TYPE_TRANSPORT = 11,
|
||||
};
|
||||
// Maps to values in AS
|
||||
enum EIcons {
|
||||
e_ICON_TYPE_IGGY = 0,
|
||||
e_ICON_TYPE_ARMOUR = 1,
|
||||
e_ICON_TYPE_BREWING = 2,
|
||||
e_ICON_TYPE_DECORATION = 3,
|
||||
e_ICON_TYPE_FOOD = 4,
|
||||
e_ICON_TYPE_MATERIALS = 5,
|
||||
e_ICON_TYPE_MECHANISMS = 6,
|
||||
e_ICON_TYPE_MISC = 7,
|
||||
e_ICON_TYPE_REDSTONE_AND_TRANSPORT = 8,
|
||||
e_ICON_TYPE_STRUCTURES = 9,
|
||||
e_ICON_TYPE_TOOLS = 10,
|
||||
e_ICON_TYPE_TRANSPORT = 11,
|
||||
};
|
||||
|
||||
public:
|
||||
UIComponent_TutorialPopup(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIComponent_TutorialPopup(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
protected:
|
||||
UIControl_Label m_labelDescription, m_labelTitle;
|
||||
UIControl m_controlIconHolder;
|
||||
UIControl m_controlExitScreenshot;
|
||||
IggyName m_funcAdjustLayout, m_funcSetupIconHolder;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT( m_labelTitle, "Title")
|
||||
UI_MAP_ELEMENT( m_labelDescription, "Description")
|
||||
UI_MAP_ELEMENT( m_controlIconHolder, "IconHolder")
|
||||
UI_MAP_ELEMENT( m_controlExitScreenshot, "ExitScreenShot")
|
||||
UIControl_Label m_labelDescription, m_labelTitle;
|
||||
UIControl m_controlIconHolder;
|
||||
UIControl m_controlExitScreenshot;
|
||||
IggyName m_funcAdjustLayout, m_funcSetupIconHolder;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelTitle, "Title")
|
||||
UI_MAP_ELEMENT(m_labelDescription, "Description")
|
||||
UI_MAP_ELEMENT(m_controlIconHolder, "IconHolder")
|
||||
UI_MAP_ELEMENT(m_controlExitScreenshot, "ExitScreenShot")
|
||||
|
||||
UI_MAP_NAME( m_funcAdjustLayout, L"AdjustLayout")
|
||||
UI_MAP_NAME( m_funcSetupIconHolder, L"SetupIconHolder")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
UI_MAP_NAME(m_funcAdjustLayout, L"AdjustLayout")
|
||||
UI_MAP_NAME(m_funcSetupIconHolder, L"SetupIconHolder")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual std::wstring getMoviePath();
|
||||
virtual std::wstring getMoviePath();
|
||||
|
||||
public:
|
||||
virtual EUIScene getSceneType() { return eUIComponent_TutorialPopup;}
|
||||
virtual EUIScene getSceneType() { return eUIComponent_TutorialPopup; }
|
||||
|
||||
// Returns true if this scene handles input
|
||||
virtual bool stealsFocus() { return false; }
|
||||
// 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
|
||||
virtual bool hasFocus(int iPad) { 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 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 false; }
|
||||
|
||||
virtual void handleReload();
|
||||
virtual void handleReload();
|
||||
|
||||
void SetContainerMenuVisible(bool bContainerMenuVisible) { m_bContainerMenuVisible = bContainerMenuVisible; }
|
||||
void UpdateTutorialPopup();
|
||||
void SetContainerMenuVisible(bool bContainerMenuVisible) {
|
||||
m_bContainerMenuVisible = bContainerMenuVisible;
|
||||
}
|
||||
void UpdateTutorialPopup();
|
||||
|
||||
void SetTutorial( Tutorial *tutorial ) { m_tutorial = tutorial; }
|
||||
void SetTutorialDescription(TutorialPopupInfo *info);
|
||||
void RemoveInteractSceneReference(UIScene *scene);
|
||||
void SetVisible(bool visible);
|
||||
bool IsVisible();
|
||||
void SetTutorial(Tutorial* tutorial) { m_tutorial = tutorial; }
|
||||
void SetTutorialDescription(TutorialPopupInfo* info);
|
||||
void RemoveInteractSceneReference(UIScene* scene);
|
||||
void SetVisible(bool visible);
|
||||
bool IsVisible();
|
||||
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
|
||||
// RENDERING
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport);
|
||||
|
||||
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
|
||||
virtual void customDraw(IggyCustomDrawCallbackRegion* region);
|
||||
|
||||
protected:
|
||||
void handleTimerComplete(int id);
|
||||
void handleTimerComplete(int id);
|
||||
|
||||
private:
|
||||
void _SetDescription(UIScene *interactScene, const std::wstring &desc, const std::wstring &title, bool allowFade, bool isReminder);
|
||||
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t *desc);
|
||||
std::wstring _SetImage(std::wstring &desc);
|
||||
std::wstring ParseDescription(int iPad, std::wstring &text);
|
||||
void UpdateInteractScenePosition(bool visible);
|
||||
void _SetDescription(UIScene* interactScene, const std::wstring& desc,
|
||||
const std::wstring& title, bool allowFade,
|
||||
bool isReminder);
|
||||
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||
const wchar_t* desc);
|
||||
std::wstring _SetImage(std::wstring& desc);
|
||||
std::wstring ParseDescription(int iPad, std::wstring& text);
|
||||
void UpdateInteractScenePosition(bool visible);
|
||||
|
||||
void setupIconHolder(EIcons icon);
|
||||
void setupIconHolder(EIcons icon);
|
||||
};
|
||||
|
||||
@@ -4,150 +4,134 @@
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../../Minecraft.World/Util/JavaMath.h"
|
||||
|
||||
UIControl::UIControl()
|
||||
{
|
||||
m_parentScene = NULL;
|
||||
m_lastOpacity = 1.0f;
|
||||
m_controlName = "";
|
||||
m_isVisible = true;
|
||||
m_bHidden = false;
|
||||
m_eControlType = eNoControl;
|
||||
UIControl::UIControl() {
|
||||
m_parentScene = NULL;
|
||||
m_lastOpacity = 1.0f;
|
||||
m_controlName = "";
|
||||
m_isVisible = true;
|
||||
m_bHidden = false;
|
||||
m_eControlType = eNoControl;
|
||||
}
|
||||
|
||||
bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
m_parentScene = scene;
|
||||
m_controlName = controlName;
|
||||
bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
m_parentScene = scene;
|
||||
m_controlName = controlName;
|
||||
|
||||
rrbool res = IggyValuePathMakeNameRef ( &m_iggyPath , parent , controlName.c_str() );
|
||||
rrbool res =
|
||||
IggyValuePathMakeNameRef(&m_iggyPath, parent, controlName.c_str());
|
||||
|
||||
m_nameXPos = registerFastName(L"x");
|
||||
m_nameYPos = registerFastName(L"y");
|
||||
m_nameWidth = registerFastName(L"width");
|
||||
m_nameHeight = registerFastName(L"height");
|
||||
m_funcSetAlpha = registerFastName(L"SetControlAlpha");
|
||||
m_nameVisible = registerFastName(L"visible");
|
||||
m_nameXPos = registerFastName(L"x");
|
||||
m_nameYPos = registerFastName(L"y");
|
||||
m_nameWidth = registerFastName(L"width");
|
||||
m_nameHeight = registerFastName(L"height");
|
||||
m_funcSetAlpha = registerFastName(L"SetControlAlpha");
|
||||
m_nameVisible = registerFastName(L"visible");
|
||||
|
||||
F64 fx, fy, fwidth, fheight;
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight );
|
||||
F64 fx, fy, fwidth, fheight;
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameYPos, NULL, &fy);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, NULL, &fwidth);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, NULL, &fheight);
|
||||
|
||||
m_x = (S32)fx;
|
||||
m_y = (S32)fy;
|
||||
m_width = (S32)Math::round(fwidth);
|
||||
m_height = (S32)Math::round(fheight);
|
||||
m_x = (S32)fx;
|
||||
m_y = (S32)fy;
|
||||
m_width = (S32)Math::round(fwidth);
|
||||
m_height = (S32)Math::round(fheight);
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void UIControl::UpdateControl()
|
||||
{
|
||||
F64 fx, fy, fwidth, fheight;
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth );
|
||||
IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight );
|
||||
m_x = (S32)fx;
|
||||
m_y = (S32)fy;
|
||||
m_width = (S32)Math::round(fwidth);
|
||||
m_height = (S32)Math::round(fheight);
|
||||
void UIControl::UpdateControl() {
|
||||
F64 fx, fy, fwidth, fheight;
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameYPos, NULL, &fy);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, NULL, &fwidth);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, NULL, &fheight);
|
||||
m_x = (S32)fx;
|
||||
m_y = (S32)fy;
|
||||
m_width = (S32)Math::round(fwidth);
|
||||
m_height = (S32)Math::round(fheight);
|
||||
}
|
||||
#endif // __PSVITA__
|
||||
#endif // __PSVITA__
|
||||
|
||||
void UIControl::ReInit()
|
||||
{
|
||||
if(m_lastOpacity != 1.0f)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
IggyStringUTF8 stringVal;
|
||||
void UIControl::ReInit() {
|
||||
if (m_lastOpacity != 1.0f) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char *)m_controlName.c_str();
|
||||
stringVal.length = m_controlName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
stringVal.string = (char*)m_controlName.c_str();
|
||||
stringVal.length = m_controlName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_lastOpacity;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_lastOpacity;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, m_parentScene->m_rootPath , m_funcSetAlpha , 2 , value );
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
m_parentScene->getMovie(), &result, m_parentScene->m_rootPath,
|
||||
m_funcSetAlpha, 2, value);
|
||||
}
|
||||
|
||||
IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, m_isVisible );
|
||||
IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible, NULL, m_isVisible);
|
||||
}
|
||||
|
||||
IggyValuePath *UIControl::getIggyValuePath()
|
||||
{
|
||||
return &m_iggyPath;
|
||||
IggyValuePath* UIControl::getIggyValuePath() { return &m_iggyPath; }
|
||||
|
||||
S32 UIControl::getXPos() { return m_x; }
|
||||
|
||||
S32 UIControl::getYPos() { return m_y; }
|
||||
|
||||
S32 UIControl::getWidth() { return m_width; }
|
||||
|
||||
S32 UIControl::getHeight() { return m_height; }
|
||||
|
||||
void UIControl::setOpacity(float percent) {
|
||||
if (percent != m_lastOpacity) {
|
||||
m_lastOpacity = percent;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char*)m_controlName.c_str();
|
||||
stringVal.length = m_controlName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_lastOpacity;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
m_parentScene->getMovie(), &result, m_parentScene->m_rootPath,
|
||||
m_funcSetAlpha, 2, value);
|
||||
}
|
||||
}
|
||||
|
||||
S32 UIControl::getXPos()
|
||||
{
|
||||
return m_x;
|
||||
void UIControl::setVisible(bool visible) {
|
||||
if (visible != m_isVisible) {
|
||||
rrbool succ = IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible,
|
||||
NULL, visible);
|
||||
if (succ)
|
||||
m_isVisible = visible;
|
||||
else
|
||||
app.DebugPrintf("Failed to set visibility for control\n");
|
||||
}
|
||||
}
|
||||
|
||||
S32 UIControl::getYPos()
|
||||
{
|
||||
return m_y;
|
||||
bool UIControl::getVisible() {
|
||||
rrbool bVisible = false;
|
||||
|
||||
IggyResult result = IggyValueGetBooleanRS(getIggyValuePath(), m_nameVisible,
|
||||
NULL, &bVisible);
|
||||
|
||||
m_isVisible = bVisible;
|
||||
|
||||
return bVisible;
|
||||
}
|
||||
|
||||
S32 UIControl::getWidth()
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
S32 UIControl::getHeight()
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
|
||||
void UIControl::setOpacity(float percent)
|
||||
{
|
||||
if(percent != m_lastOpacity)
|
||||
{
|
||||
m_lastOpacity = percent;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char *)m_controlName.c_str();
|
||||
stringVal.length = m_controlName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_lastOpacity;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, m_parentScene->m_rootPath , m_funcSetAlpha , 2 , value );
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl::setVisible(bool visible)
|
||||
{
|
||||
if(visible != m_isVisible)
|
||||
{
|
||||
rrbool succ = IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, visible );
|
||||
if(succ) m_isVisible = visible;
|
||||
else app.DebugPrintf("Failed to set visibility for control\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool UIControl::getVisible()
|
||||
{
|
||||
rrbool bVisible = false;
|
||||
|
||||
IggyResult result = IggyValueGetBooleanRS ( getIggyValuePath() , m_nameVisible, NULL, &bVisible );
|
||||
|
||||
m_isVisible = bVisible;
|
||||
|
||||
return bVisible;
|
||||
}
|
||||
|
||||
IggyName UIControl::registerFastName(const std::wstring &name)
|
||||
{
|
||||
return m_parentScene->registerFastName(name);
|
||||
IggyName UIControl::registerFastName(const std::wstring& name) {
|
||||
return m_parentScene->registerFastName(name);
|
||||
}
|
||||
|
||||
@@ -1,92 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
// This class for any name object in the flash scene
|
||||
class UIControl
|
||||
{
|
||||
|
||||
class UIControl {
|
||||
public:
|
||||
enum eUIControlType
|
||||
{
|
||||
eNoControl,
|
||||
eButton,
|
||||
eButtonList,
|
||||
eCheckBox,
|
||||
eCursor,
|
||||
eDLCList,
|
||||
eDynamicLabel,
|
||||
eEnchantmentBook,
|
||||
eEnchantmentButton,
|
||||
eHTMLLabel,
|
||||
eLabel,
|
||||
eLeaderboardList,
|
||||
eMinecraftPlayer,
|
||||
ePlayerList,
|
||||
ePlayerSkinPreview,
|
||||
eProgress,
|
||||
eSaveList,
|
||||
eSlider,
|
||||
eSlotList,
|
||||
eTextInput,
|
||||
eTexturePackList,
|
||||
eBitmapIcon,
|
||||
eTouchControl,
|
||||
};
|
||||
protected:
|
||||
eUIControlType m_eControlType;
|
||||
int m_id;
|
||||
bool m_bHidden; // set by the Remove call
|
||||
|
||||
public:
|
||||
|
||||
void setControlType(eUIControlType eType) {m_eControlType=eType;}
|
||||
eUIControlType getControlType() {return m_eControlType;}
|
||||
void setId(int iID) { m_id=iID; }
|
||||
int getId() { return m_id; }
|
||||
UIScene * getParentScene() {return m_parentScene;}
|
||||
enum eUIControlType {
|
||||
eNoControl,
|
||||
eButton,
|
||||
eButtonList,
|
||||
eCheckBox,
|
||||
eCursor,
|
||||
eDLCList,
|
||||
eDynamicLabel,
|
||||
eEnchantmentBook,
|
||||
eEnchantmentButton,
|
||||
eHTMLLabel,
|
||||
eLabel,
|
||||
eLeaderboardList,
|
||||
eMinecraftPlayer,
|
||||
ePlayerList,
|
||||
ePlayerSkinPreview,
|
||||
eProgress,
|
||||
eSaveList,
|
||||
eSlider,
|
||||
eSlotList,
|
||||
eTextInput,
|
||||
eTexturePackList,
|
||||
eBitmapIcon,
|
||||
eTouchControl,
|
||||
};
|
||||
|
||||
protected:
|
||||
IggyValuePath m_iggyPath;
|
||||
UIScene *m_parentScene;
|
||||
std::string m_controlName;
|
||||
|
||||
IggyName m_nameXPos, m_nameYPos, m_nameWidth, m_nameHeight;
|
||||
IggyName m_funcSetAlpha, m_nameVisible;
|
||||
|
||||
S32 m_x,m_y,m_width,m_height;
|
||||
float m_lastOpacity;
|
||||
bool m_isVisible;
|
||||
eUIControlType m_eControlType;
|
||||
int m_id;
|
||||
bool m_bHidden; // set by the Remove call
|
||||
|
||||
public:
|
||||
UIControl();
|
||||
void setControlType(eUIControlType eType) { m_eControlType = eType; }
|
||||
eUIControlType getControlType() { return m_eControlType; }
|
||||
void setId(int iID) { m_id = iID; }
|
||||
int getId() { return m_id; }
|
||||
UIScene* getParentScene() { return m_parentScene; }
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
protected:
|
||||
IggyValuePath m_iggyPath;
|
||||
UIScene* m_parentScene;
|
||||
std::string m_controlName;
|
||||
|
||||
IggyName m_nameXPos, m_nameYPos, m_nameWidth, m_nameHeight;
|
||||
IggyName m_funcSetAlpha, m_nameVisible;
|
||||
|
||||
S32 m_x, m_y, m_width, m_height;
|
||||
float m_lastOpacity;
|
||||
bool m_isVisible;
|
||||
|
||||
public:
|
||||
UIControl();
|
||||
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
#ifdef __PSVITA__
|
||||
void UpdateControl();
|
||||
void setHidden(bool bHidden) {m_bHidden=bHidden;}
|
||||
bool getHidden(void) {return m_bHidden;}
|
||||
void UpdateControl();
|
||||
void setHidden(bool bHidden) { m_bHidden = bHidden; }
|
||||
bool getHidden(void) { return m_bHidden; }
|
||||
#endif
|
||||
|
||||
IggyValuePath *getIggyValuePath();
|
||||
IggyValuePath* getIggyValuePath();
|
||||
|
||||
std::string getControlName() { return m_controlName; }
|
||||
std::string getControlName() { return m_controlName; }
|
||||
|
||||
virtual void tick() {}
|
||||
virtual void ReInit();
|
||||
virtual void tick() {}
|
||||
virtual void ReInit();
|
||||
|
||||
virtual void setFocus(bool focus) {}
|
||||
virtual void setFocus(bool focus) {}
|
||||
|
||||
S32 getXPos();
|
||||
S32 getYPos();
|
||||
S32 getWidth();
|
||||
S32 getHeight();
|
||||
S32 getXPos();
|
||||
S32 getYPos();
|
||||
S32 getWidth();
|
||||
S32 getHeight();
|
||||
|
||||
void setOpacity(float percent);
|
||||
void setVisible(bool visible);
|
||||
bool getVisible();
|
||||
bool isVisible() { return m_isVisible; }
|
||||
void setOpacity(float percent);
|
||||
void setVisible(bool visible);
|
||||
bool getVisible();
|
||||
bool isVisible() { return m_isVisible; }
|
||||
|
||||
virtual bool hasFocus() { return false; }
|
||||
virtual bool hasFocus() { return false; }
|
||||
|
||||
protected:
|
||||
IggyName registerFastName(const std::wstring &name);
|
||||
IggyName registerFastName(const std::wstring& name);
|
||||
};
|
||||
|
||||
@@ -4,116 +4,117 @@
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../../Minecraft.World/Util/JavaMath.h"
|
||||
|
||||
UIControl_Base::UIControl_Base()
|
||||
{
|
||||
m_bLabelChanged = false;
|
||||
m_label = L"";
|
||||
m_id = 0;
|
||||
UIControl_Base::UIControl_Base() {
|
||||
m_bLabelChanged = false;
|
||||
m_label = L"";
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
bool UIControl_Base::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
bool success = UIControl::setupControl(scene,parent,controlName);
|
||||
bool UIControl_Base::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
bool success = UIControl::setupControl(scene, parent, controlName);
|
||||
|
||||
m_setLabelFunc = registerFastName(L"SetLabel");
|
||||
m_initFunc = registerFastName(L"Init");
|
||||
m_funcGetLabel = registerFastName(L"GetLabel");
|
||||
m_funcCheckLabelWidths = registerFastName(L"CheckLabelWidths");
|
||||
m_setLabelFunc = registerFastName(L"SetLabel");
|
||||
m_initFunc = registerFastName(L"Init");
|
||||
m_funcGetLabel = registerFastName(L"GetLabel");
|
||||
m_funcCheckLabelWidths = registerFastName(L"CheckLabelWidths");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Base::tick()
|
||||
{
|
||||
UIControl::tick();
|
||||
void UIControl_Base::tick() {
|
||||
UIControl::tick();
|
||||
|
||||
if(m_bLabelChanged)
|
||||
{
|
||||
//app.DebugPrintf("Calling SetLabel - '%ls'\n", m_label.c_str());
|
||||
m_bLabelChanged = false;
|
||||
if (m_bLabelChanged) {
|
||||
// app.DebugPrintf("Calling SetLabel - '%ls'\n", m_label.c_str());
|
||||
m_bLabelChanged = false;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(m_label);
|
||||
const std::u16string convLabel = convWstringToU16string(m_label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_setLabelFunc, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_Base::setLabel(const std::wstring &label, bool instant, bool force)
|
||||
{
|
||||
if( force || ((!m_label.empty() || !label.empty()) && m_label.compare(label) != 0) ) m_bLabelChanged = true;
|
||||
m_label = label;
|
||||
void UIControl_Base::setLabel(const std::wstring& label, bool instant,
|
||||
bool force) {
|
||||
if (force ||
|
||||
((!m_label.empty() || !label.empty()) && m_label.compare(label) != 0))
|
||||
m_bLabelChanged = true;
|
||||
m_label = label;
|
||||
|
||||
if(m_bLabelChanged && instant)
|
||||
{
|
||||
m_bLabelChanged = false;
|
||||
if (m_bLabelChanged && instant) {
|
||||
m_bLabelChanged = false;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(m_label);
|
||||
const std::u16string convLabel = convWstringToU16string(m_label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_setLabelFunc, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_Base::setLabel(const std::string &label)
|
||||
{
|
||||
std::wstring wlabel = convStringToWstring(label);
|
||||
setLabel(wlabel);
|
||||
void UIControl_Base::setLabel(const std::string& label) {
|
||||
std::wstring wlabel = convStringToWstring(label);
|
||||
setLabel(wlabel);
|
||||
}
|
||||
|
||||
const wchar_t* UIControl_Base::getLabel()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetLabel , 0 , NULL );
|
||||
const wchar_t* UIControl_Base::getLabel() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcGetLabel, 0, NULL);
|
||||
|
||||
if(result.type == IGGY_DATATYPE_string_UTF16)
|
||||
{
|
||||
m_label = std::wstring( (wchar_t *)result.string16.string, result.string16.length);
|
||||
}
|
||||
if (result.type == IGGY_DATATYPE_string_UTF16) {
|
||||
m_label = std::wstring((wchar_t*)result.string16.string,
|
||||
result.string16.length);
|
||||
}
|
||||
|
||||
return m_label.c_str();
|
||||
return m_label.c_str();
|
||||
}
|
||||
|
||||
void UIControl_Base::setAllPossibleLabels(int labelCount, wchar_t labels[][256])
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue *value = new IggyDataValue[labelCount];
|
||||
IggyStringUTF16 * stringVal = new IggyStringUTF16[labelCount];
|
||||
void UIControl_Base::setAllPossibleLabels(int labelCount,
|
||||
wchar_t labels[][256]) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue* value = new IggyDataValue[labelCount];
|
||||
IggyStringUTF16* stringVal = new IggyStringUTF16[labelCount];
|
||||
|
||||
std::vector<std::u16string> conv;
|
||||
conv.reserve(labelCount);
|
||||
std::vector<std::u16string> conv;
|
||||
conv.reserve(labelCount);
|
||||
|
||||
for (int i = 0; i < labelCount; ++i) {
|
||||
conv.push_back(convWstringToU16string(labels[i]));
|
||||
stringVal[i].string = conv[i].c_str();
|
||||
stringVal[i].length = (S32)conv[i].length();
|
||||
value[i].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[i].string16 = stringVal[i];
|
||||
}
|
||||
for (int i = 0; i < labelCount; ++i) {
|
||||
conv.push_back(convWstringToU16string(labels[i]));
|
||||
stringVal[i].string = conv[i].c_str();
|
||||
stringVal[i].length = (S32)conv[i].length();
|
||||
value[i].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[i].string16 = stringVal[i];
|
||||
}
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcCheckLabelWidths , labelCount , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
m_parentScene->getMovie(), &result, getIggyValuePath(),
|
||||
m_funcCheckLabelWidths, labelCount, value);
|
||||
|
||||
delete [] value;
|
||||
delete [] stringVal;
|
||||
delete[] value;
|
||||
delete[] stringVal;
|
||||
}
|
||||
|
||||
bool UIControl_Base::hasFocus()
|
||||
{
|
||||
return m_parentScene->controlHasFocus( this );
|
||||
}
|
||||
bool UIControl_Base::hasFocus() { return m_parentScene->controlHasFocus(this); }
|
||||
|
||||
@@ -3,28 +3,30 @@
|
||||
#include "UIControl.h"
|
||||
|
||||
// This class maps to the FJ_Base class in actionscript
|
||||
class UIControl_Base : public UIControl
|
||||
{
|
||||
protected:
|
||||
IggyName m_initFunc;
|
||||
IggyName m_setLabelFunc;
|
||||
IggyName m_funcGetLabel;
|
||||
IggyName m_funcCheckLabelWidths;
|
||||
class UIControl_Base : public UIControl {
|
||||
protected:
|
||||
IggyName m_initFunc;
|
||||
IggyName m_setLabelFunc;
|
||||
IggyName m_funcGetLabel;
|
||||
IggyName m_funcCheckLabelWidths;
|
||||
|
||||
bool m_bLabelChanged;
|
||||
std::wstring m_label;
|
||||
|
||||
bool m_bLabelChanged;
|
||||
std::wstring m_label;
|
||||
public:
|
||||
UIControl_Base();
|
||||
UIControl_Base();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
virtual void setLabel(const std::wstring &label, bool instant = false, bool force = false);
|
||||
virtual void setLabel(const std::string &label);
|
||||
const wchar_t* getLabel();
|
||||
virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]);
|
||||
int getId() { return m_id; }
|
||||
virtual void setLabel(const std::wstring& label, bool instant = false,
|
||||
bool force = false);
|
||||
virtual void setLabel(const std::string& label);
|
||||
const wchar_t* getLabel();
|
||||
virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]);
|
||||
int getId() { return m_id; }
|
||||
|
||||
virtual bool hasFocus();
|
||||
virtual bool hasFocus();
|
||||
};
|
||||
|
||||
@@ -2,28 +2,29 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_BitmapIcon.h"
|
||||
|
||||
bool UIControl_BitmapIcon::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eBitmapIcon);
|
||||
bool success = UIControl::setupControl(scene,parent,controlName);
|
||||
bool UIControl_BitmapIcon::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eBitmapIcon);
|
||||
bool success = UIControl::setupControl(scene, parent, controlName);
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_funcSetTextureName = registerFastName(L"SetTextureName");
|
||||
// SlotList specific initialisers
|
||||
m_funcSetTextureName = registerFastName(L"SetTextureName");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_BitmapIcon::setTextureName(const std::wstring &iconName)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
void UIControl_BitmapIcon::setTextureName(const std::wstring& iconName) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetTextureName , 1 , value );
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetTextureName, 1, value);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include "UIControl.h"
|
||||
|
||||
class UIControl_BitmapIcon : public UIControl
|
||||
{
|
||||
class UIControl_BitmapIcon : public UIControl {
|
||||
private:
|
||||
IggyName m_funcSetTextureName;
|
||||
IggyName m_funcSetTextureName;
|
||||
|
||||
public:
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void setTextureName(const std::wstring &iconName);
|
||||
void setTextureName(const std::wstring& iconName);
|
||||
};
|
||||
@@ -2,69 +2,67 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_Button.h"
|
||||
|
||||
UIControl_Button::UIControl_Button()
|
||||
{
|
||||
UIControl_Button::UIControl_Button() {}
|
||||
|
||||
bool UIControl_Button::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eButton);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// Button specific initialisers
|
||||
m_funcEnableButton = registerFastName(L"EnableButton");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_Button::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eButton);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_Button::init(const std::wstring& label, int id) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
||||
//Button specific initialisers
|
||||
m_funcEnableButton = registerFastName(L"EnableButton");
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
return success;
|
||||
}
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
void UIControl_Button::init(const std::wstring &label, int id)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 2, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-PB - add this button to the vita touch box list
|
||||
// 4J-PB - add this button to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Error:
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Error:
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_Button::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
void UIControl_Button::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
init(m_label, m_id);
|
||||
init(m_label, m_id);
|
||||
}
|
||||
|
||||
void UIControl_Button::setEnable(bool enable)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
void UIControl_Button::setEnable(bool enable) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = enable;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcEnableButton , 1 , value );
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = enable;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcEnableButton, 1, value);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Button : public UIControl_Base
|
||||
{
|
||||
class UIControl_Button : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_funcEnableButton;
|
||||
IggyName m_funcEnableButton;
|
||||
|
||||
public:
|
||||
UIControl_Button();
|
||||
UIControl_Button();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id);
|
||||
virtual void ReInit();
|
||||
void init(const std::wstring& label, int id);
|
||||
virtual void ReInit();
|
||||
|
||||
void setEnable(bool enable);
|
||||
void setEnable(bool enable);
|
||||
};
|
||||
@@ -2,200 +2,200 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_ButtonList.h"
|
||||
|
||||
UIControl_ButtonList::UIControl_ButtonList()
|
||||
{
|
||||
m_itemCount = 0;
|
||||
m_iCurrentSelection = 0;
|
||||
UIControl_ButtonList::UIControl_ButtonList() {
|
||||
m_itemCount = 0;
|
||||
m_iCurrentSelection = 0;
|
||||
}
|
||||
|
||||
bool UIControl_ButtonList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eButtonList);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
bool UIControl_ButtonList::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eButtonList);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_addNewItemFunc = registerFastName(L"addNewItem");
|
||||
m_removeAllItemsFunc = registerFastName(L"removeAllItems");
|
||||
m_funcHighlightItem = registerFastName(L"HighlightItem");
|
||||
m_funcRemoveItem = registerFastName(L"RemoveItem");
|
||||
m_funcSetButtonLabel = registerFastName(L"SetButtonLabel");
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger");
|
||||
// SlotList specific initialisers
|
||||
m_addNewItemFunc = registerFastName(L"addNewItem");
|
||||
m_removeAllItemsFunc = registerFastName(L"removeAllItems");
|
||||
m_funcHighlightItem = registerFastName(L"HighlightItem");
|
||||
m_funcRemoveItem = registerFastName(L"RemoveItem");
|
||||
m_funcSetButtonLabel = registerFastName(L"SetButtonLabel");
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::init(int id)
|
||||
{
|
||||
m_id = id;
|
||||
void UIControl_ButtonList::init(int id) {
|
||||
m_id = id;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-PB - add this buttonlist to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef __PSVITA__
|
||||
// 4J-PB - add this buttonlist to the vita touch box list
|
||||
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
init(m_id);
|
||||
m_itemCount = 0;
|
||||
m_iCurrentSelection = 0;
|
||||
void UIControl_ButtonList::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_id);
|
||||
m_itemCount = 0;
|
||||
m_iCurrentSelection = 0;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::clearList()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_removeAllItemsFunc , 0 , NULL );
|
||||
void UIControl_ButtonList::clearList() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_removeAllItemsFunc, 0, NULL);
|
||||
|
||||
m_itemCount = 0;
|
||||
m_itemCount = 0;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::addItem(const std::string &label)
|
||||
{
|
||||
addItem(label, m_itemCount);
|
||||
void UIControl_ButtonList::addItem(const std::string& label) {
|
||||
addItem(label, m_itemCount);
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::addItem(const std::wstring &label)
|
||||
{
|
||||
addItem(label, m_itemCount);
|
||||
void UIControl_ButtonList::addItem(const std::wstring& label) {
|
||||
addItem(label, m_itemCount);
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::addItem(const std::string &label, int data)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_ButtonList::addItem(const std::string& label, int data) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = data;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = data;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 2, value);
|
||||
|
||||
++m_itemCount;
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::addItem(const std::wstring &label, int data)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_ButtonList::addItem(const std::wstring& label, int data) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = data;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = data;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 2, value);
|
||||
|
||||
++m_itemCount;
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::removeItem(int index)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
void UIControl_ButtonList::removeItem(int index) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcRemoveItem , 1 , value );
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcRemoveItem, 1, value);
|
||||
|
||||
--m_itemCount;
|
||||
--m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::setCurrentSelection(int iSelection)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
void UIControl_ButtonList::setCurrentSelection(int iSelection) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iSelection;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcHighlightItem , 1 , value );
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iSelection;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcHighlightItem, 1, value);
|
||||
}
|
||||
|
||||
int UIControl_ButtonList::getCurrentSelection()
|
||||
{
|
||||
return m_iCurrentSelection;
|
||||
int UIControl_ButtonList::getCurrentSelection() { return m_iCurrentSelection; }
|
||||
|
||||
void UIControl_ButtonList::updateChildFocus(int iChild) {
|
||||
m_iCurrentSelection = iChild;
|
||||
}
|
||||
|
||||
void UIControl_ButtonList::updateChildFocus(int iChild)
|
||||
{
|
||||
m_iCurrentSelection = iChild;
|
||||
}
|
||||
void UIControl_ButtonList::setButtonLabel(int iButtonId,
|
||||
const std::wstring& label) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
void UIControl_ButtonList::setButtonLabel(int iButtonId, const std::wstring &label)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iButtonId;
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iButtonId;
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetButtonLabel, 2 , value );
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetButtonLabel, 2, value);
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetTouchFocus, 3, value);
|
||||
}
|
||||
|
||||
bool UIControl_ButtonList::CanTouchTrigger(S32 iX, S32 iY)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
bool UIControl_ButtonList::CanTouchTrigger(S32 iX, S32 iY) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcCanTouchTrigger, 2 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcCanTouchTrigger, 2, value);
|
||||
|
||||
S32 bCanTouchTrigger = false;
|
||||
if(result.type == IGGY_DATATYPE_boolean)
|
||||
{
|
||||
bCanTouchTrigger = (bool)result.boolval;
|
||||
}
|
||||
return bCanTouchTrigger;
|
||||
S32 bCanTouchTrigger = false;
|
||||
if (result.type == IGGY_DATATYPE_boolean) {
|
||||
bCanTouchTrigger = (bool)result.boolval;
|
||||
}
|
||||
return bCanTouchTrigger;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,43 +2,45 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_ButtonList : public UIControl_Base
|
||||
{
|
||||
class UIControl_ButtonList : public UIControl_Base {
|
||||
protected:
|
||||
IggyName m_addNewItemFunc, m_removeAllItemsFunc, m_funcHighlightItem, m_funcRemoveItem, m_funcSetButtonLabel, m_funcSetTouchFocus, m_funcCanTouchTrigger;
|
||||
IggyName m_addNewItemFunc, m_removeAllItemsFunc, m_funcHighlightItem,
|
||||
m_funcRemoveItem, m_funcSetButtonLabel, m_funcSetTouchFocus,
|
||||
m_funcCanTouchTrigger;
|
||||
|
||||
int m_itemCount;
|
||||
int m_iCurrentSelection;
|
||||
int m_itemCount;
|
||||
int m_iCurrentSelection;
|
||||
|
||||
public:
|
||||
UIControl_ButtonList();
|
||||
UIControl_ButtonList();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
|
||||
void clearList();
|
||||
void clearList();
|
||||
|
||||
void addItem(const std::wstring &label);
|
||||
void addItem(const std::string &label);
|
||||
void addItem(const std::wstring& label);
|
||||
void addItem(const std::string& label);
|
||||
|
||||
void addItem(const std::wstring &label, int data);
|
||||
void addItem(const std::string &label, int data);
|
||||
void addItem(const std::wstring& label, int data);
|
||||
void addItem(const std::string& label, int data);
|
||||
|
||||
void removeItem(int index);
|
||||
void removeItem(int index);
|
||||
|
||||
int getItemCount() { return m_itemCount; }
|
||||
int getItemCount() { return m_itemCount; }
|
||||
|
||||
void setCurrentSelection(int iSelection);
|
||||
int getCurrentSelection();
|
||||
void setCurrentSelection(int iSelection);
|
||||
int getCurrentSelection();
|
||||
|
||||
void updateChildFocus(int iChild);
|
||||
void updateChildFocus(int iChild);
|
||||
|
||||
void setButtonLabel(int iButtonId, const std::wstring &label);
|
||||
void setButtonLabel(int iButtonId, const std::wstring& label);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -2,110 +2,109 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_CheckBox.h"
|
||||
|
||||
UIControl_CheckBox::UIControl_CheckBox()
|
||||
{
|
||||
UIControl_CheckBox::UIControl_CheckBox() {}
|
||||
|
||||
bool UIControl_CheckBox::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eCheckBox);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// CheckBox specific initialisers
|
||||
m_checkedProp = registerFastName(L"Checked");
|
||||
m_funcEnable = registerFastName(L"EnableCheckBox");
|
||||
m_funcSetCheckBox = registerFastName(L"SetCheckBox");
|
||||
|
||||
m_bEnabled = true;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eCheckBox);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_CheckBox::init(const std::wstring& label, int id, bool checked) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_bChecked = checked;
|
||||
|
||||
//CheckBox specific initialisers
|
||||
m_checkedProp = registerFastName(L"Checked");
|
||||
m_funcEnable = registerFastName(L"EnableCheckBox");
|
||||
m_funcSetCheckBox = registerFastName(L"SetCheckBox");
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
m_bEnabled = true;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
return success;
|
||||
}
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
void UIControl_CheckBox::init(const std::wstring &label, int id, bool checked)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_bChecked = checked;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (int)id;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (int)id;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = checked;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 3 , value );
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = checked;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 3, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add checkbox to the vita touch box list
|
||||
// 4J-TomK - add checkbox to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool UIControl_CheckBox::IsChecked()
|
||||
{
|
||||
rrbool checked = false;
|
||||
IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, NULL, &checked );
|
||||
m_bChecked = checked;
|
||||
return checked;
|
||||
bool UIControl_CheckBox::IsChecked() {
|
||||
rrbool checked = false;
|
||||
IggyResult result =
|
||||
IggyValueGetBooleanRS(&m_iggyPath, m_checkedProp, NULL, &checked);
|
||||
m_bChecked = checked;
|
||||
return checked;
|
||||
}
|
||||
|
||||
bool UIControl_CheckBox::IsEnabled()
|
||||
{
|
||||
return m_bEnabled;
|
||||
bool UIControl_CheckBox::IsEnabled() { return m_bEnabled; }
|
||||
|
||||
void UIControl_CheckBox::SetEnable(bool enable) {
|
||||
m_bEnabled = enable;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = enable;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcEnable, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_CheckBox::SetEnable(bool enable)
|
||||
{
|
||||
m_bEnabled = enable;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = enable;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcEnable , 1 , value );
|
||||
// 4J HEG - this is only ever used when required, most of this should happen in
|
||||
// the flash
|
||||
void UIControl_CheckBox::setChecked(bool checked) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = checked;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSetCheckBox, 1, value);
|
||||
}
|
||||
|
||||
// 4J HEG - this is only ever used when required, most of this should happen in the flash
|
||||
void UIControl_CheckBox::setChecked(bool checked)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = checked;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCheckBox , 1 , value );
|
||||
// 4J-TomK we need to trigger this one via function instead of key down event
|
||||
// because of how it works
|
||||
void UIControl_CheckBox::TouchSetCheckbox(bool checked) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = checked;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSetCheckBox, 1, value);
|
||||
}
|
||||
|
||||
// 4J-TomK we need to trigger this one via function instead of key down event because of how it works
|
||||
void UIControl_CheckBox::TouchSetCheckbox(bool checked)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = checked;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCheckBox , 1 , value );
|
||||
}
|
||||
void UIControl_CheckBox::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
void UIControl_CheckBox::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
init(m_label, m_id, m_bChecked);
|
||||
init(m_label, m_id, m_bChecked);
|
||||
}
|
||||
|
||||
@@ -2,26 +2,25 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_CheckBox : public UIControl_Base
|
||||
{
|
||||
class UIControl_CheckBox : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_checkedProp, m_funcEnable, m_funcSetCheckBox;
|
||||
IggyName m_checkedProp, m_funcEnable, m_funcSetCheckBox;
|
||||
|
||||
bool m_bChecked, m_bEnabled;
|
||||
bool m_bChecked, m_bEnabled;
|
||||
|
||||
public:
|
||||
UIControl_CheckBox();
|
||||
UIControl_CheckBox();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id, bool checked);
|
||||
void init(const std::wstring& label, int id, bool checked);
|
||||
|
||||
bool IsChecked();
|
||||
bool IsEnabled();
|
||||
void SetEnable(bool enable);
|
||||
void setChecked(bool checked);
|
||||
void TouchSetCheckbox(bool checked);
|
||||
|
||||
virtual void ReInit();
|
||||
bool IsChecked();
|
||||
bool IsEnabled();
|
||||
void SetEnable(bool enable);
|
||||
void setChecked(bool checked);
|
||||
void TouchSetCheckbox(bool checked);
|
||||
|
||||
virtual void ReInit();
|
||||
};
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_Cursor.h"
|
||||
|
||||
UIControl_Cursor::UIControl_Cursor()
|
||||
{
|
||||
}
|
||||
|
||||
bool UIControl_Cursor::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eCursor);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
|
||||
//Label specific initialisers
|
||||
|
||||
return success;
|
||||
UIControl_Cursor::UIControl_Cursor() {}
|
||||
|
||||
bool UIControl_Cursor::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eCursor);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// Label specific initialisers
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Cursor : public UIControl_Base
|
||||
{
|
||||
class UIControl_Cursor : public UIControl_Base {
|
||||
public:
|
||||
UIControl_Cursor();
|
||||
UIControl_Cursor();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
};
|
||||
@@ -2,70 +2,76 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_DLCList.h"
|
||||
|
||||
bool UIControl_DLCList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eDLCList);
|
||||
bool success = UIControl_ButtonList::setupControl(scene,parent,controlName);
|
||||
bool UIControl_DLCList::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eDLCList);
|
||||
bool success =
|
||||
UIControl_ButtonList::setupControl(scene, parent, controlName);
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_funcShowTick = registerFastName(L"ShowTick");
|
||||
// SlotList specific initialisers
|
||||
m_funcShowTick = registerFastName(L"ShowTick");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_DLCList::addItem(const std::string &label, bool showTick, int iId)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_DLCList::addItem(const std::string& label, bool showTick,
|
||||
int iId) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = showTick;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value );
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = showTick;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 3, value);
|
||||
|
||||
++m_itemCount;
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_DLCList::addItem(const std::wstring &label, bool showTick, int iId)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_DLCList::addItem(const std::wstring& label, bool showTick,
|
||||
int iId) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = showTick;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value );
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = showTick;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 3, value);
|
||||
|
||||
++m_itemCount;
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_DLCList::showTick(int iId, bool showTick)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_DLCList::showTick(int iId, bool showTick) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = showTick;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcShowTick , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = showTick;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcShowTick, 2, value);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
#include "UIControl_ButtonList.h"
|
||||
|
||||
class UIControl_DLCList : public UIControl_ButtonList
|
||||
{
|
||||
class UIControl_DLCList : public UIControl_ButtonList {
|
||||
private:
|
||||
IggyName m_funcShowTick;
|
||||
IggyName m_funcShowTick;
|
||||
|
||||
public:
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
using UIControl_ButtonList::addItem;
|
||||
void addItem(const std::string &label, bool showTick, int iId);
|
||||
void addItem(const std::wstring &label, bool showTick, int iId);
|
||||
void showTick(int iId, bool showTick);
|
||||
using UIControl_ButtonList::addItem;
|
||||
void addItem(const std::string& label, bool showTick, int iId);
|
||||
void addItem(const std::wstring& label, bool showTick, int iId);
|
||||
void showTick(int iId, bool showTick);
|
||||
};
|
||||
|
||||
@@ -2,99 +2,95 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_DynamicLabel.h"
|
||||
|
||||
UIControl_DynamicLabel::UIControl_DynamicLabel()
|
||||
{
|
||||
UIControl_DynamicLabel::UIControl_DynamicLabel() {}
|
||||
|
||||
bool UIControl_DynamicLabel::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eDynamicLabel);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// Label specific initialisers
|
||||
m_funcAddText = registerFastName(L"AddText");
|
||||
m_funcTouchScroll = registerFastName(L"TouchScroll");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_DynamicLabel::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eDynamicLabel);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_DynamicLabel::addText(const std::wstring& text,
|
||||
bool bLastEntry) {
|
||||
const std::u16string convText = convWstringToU16string(text);
|
||||
|
||||
//Label specific initialisers
|
||||
m_funcAddText = registerFastName(L"AddText");
|
||||
m_funcTouchScroll = registerFastName(L"TouchScroll");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
return success;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convText.c_str();
|
||||
stringVal.length = convText.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bLastEntry;
|
||||
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcAddText, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_DynamicLabel::addText(const std::wstring &text, bool bLastEntry)
|
||||
{
|
||||
const std::u16string convText = convWstringToU16string(text);
|
||||
void UIControl_DynamicLabel::ReInit() { UIControl_Base::ReInit(); }
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_DynamicLabel::SetupTouch() {
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this dynamic label to the vita touch box list
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convText.c_str();
|
||||
stringVal.length = convText.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bLastEntry;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcAddText , 2 , value );
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_DynamicLabel::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iY;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bActive;
|
||||
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcTouchScroll, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_DynamicLabel::SetupTouch()
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this dynamic label to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
S32 UIControl_DynamicLabel::GetRealWidth() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcGetRealWidth, 0, NULL);
|
||||
|
||||
S32 iRealWidth = m_width;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
}
|
||||
|
||||
void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
S32 UIControl_DynamicLabel::GetRealHeight() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcGetRealHeight, 0, NULL);
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iY;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bActive;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcTouchScroll, 2 , value );
|
||||
}
|
||||
|
||||
S32 UIControl_DynamicLabel::GetRealWidth()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL );
|
||||
|
||||
S32 iRealWidth = m_width;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
}
|
||||
|
||||
S32 UIControl_DynamicLabel::GetRealHeight()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL );
|
||||
|
||||
S32 iRealHeight = m_height;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
S32 iRealHeight = m_height;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
}
|
||||
|
||||
@@ -2,24 +2,25 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_DynamicLabel : public UIControl_Label
|
||||
{
|
||||
class UIControl_DynamicLabel : public UIControl_Label {
|
||||
private:
|
||||
IggyName m_funcAddText, m_funcTouchScroll, m_funcGetRealWidth, m_funcGetRealHeight;
|
||||
IggyName m_funcAddText, m_funcTouchScroll, m_funcGetRealWidth,
|
||||
m_funcGetRealHeight;
|
||||
|
||||
public:
|
||||
UIControl_DynamicLabel();
|
||||
UIControl_DynamicLabel();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
virtual void addText(const std::wstring &text, bool bLastEntry);
|
||||
virtual void addText(const std::wstring& text, bool bLastEntry);
|
||||
|
||||
virtual void ReInit();
|
||||
virtual void ReInit();
|
||||
|
||||
virtual void SetupTouch();
|
||||
virtual void SetupTouch();
|
||||
|
||||
virtual void TouchScroll(S32 iY, bool bActive);
|
||||
virtual void TouchScroll(S32 iY, bool bActive);
|
||||
|
||||
S32 GetRealWidth();
|
||||
S32 GetRealHeight();
|
||||
S32 GetRealWidth();
|
||||
S32 GetRealHeight();
|
||||
};
|
||||
|
||||
@@ -9,51 +9,50 @@
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
UIControl_EnchantmentBook::UIControl_EnchantmentBook()
|
||||
{
|
||||
UIControl::setControlType(UIControl::eEnchantmentBook);
|
||||
model = NULL;
|
||||
last = nullptr;
|
||||
UIControl_EnchantmentBook::UIControl_EnchantmentBook() {
|
||||
UIControl::setControlType(UIControl::eEnchantmentBook);
|
||||
model = NULL;
|
||||
last = nullptr;
|
||||
|
||||
time = 0;
|
||||
flip = oFlip = flipT = flipA = 0.0f;
|
||||
open = oOpen = 0.0f;
|
||||
time = 0;
|
||||
flip = oFlip = flipT = flipA = 0.0f;
|
||||
open = oOpen = 0.0f;
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
glPushMatrix();
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion* region) {
|
||||
glPushMatrix();
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
|
||||
// Revert the scale from the setup
|
||||
float ssX = width/m_width;
|
||||
float ssY = height/m_height;
|
||||
glScalef(ssX, ssY,1.0f);
|
||||
// Revert the scale from the setup
|
||||
float ssX = width / m_width;
|
||||
float ssY = height / m_height;
|
||||
glScalef(ssX, ssY, 1.0f);
|
||||
|
||||
glTranslatef(m_width/2, m_height/2, 50.0f);
|
||||
glTranslatef(m_width / 2, m_height / 2, 50.0f);
|
||||
|
||||
// Add a uniform scale
|
||||
glScalef(1/ssX, 1/ssX, 1.0f);
|
||||
// Add a uniform scale
|
||||
glScalef(1 / ssX, 1 / ssX, 1.0f);
|
||||
|
||||
glScalef(50.0f,50.0f,1.0f);
|
||||
glScalef(50.0f, 50.0f, 1.0f);
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
//float sss = 4;
|
||||
// float sss = 4;
|
||||
|
||||
//glTranslatef(0, 3.3f, -16);
|
||||
//glScalef(sss, sss, sss);
|
||||
// glTranslatef(0, 3.3f, -16);
|
||||
// glScalef(sss, sss, sss);
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
int tex = pMinecraft->textures->loadTexture(TN_ITEM_BOOK); // 4J was L"/1_2_2/item/book.png"
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
int tex = pMinecraft->textures->loadTexture(
|
||||
TN_ITEM_BOOK); // 4J was L"/1_2_2/item/book.png"
|
||||
pMinecraft->textures->bind(tex);
|
||||
|
||||
glRotatef(20, 1, 0, 0);
|
||||
|
||||
float a = 1;
|
||||
float a = 1;
|
||||
float o = oOpen + (open - oOpen) * a;
|
||||
glTranslatef((1 - o) * 0.2f, (1 - o) * 0.1f, (1 - o) * 0.25f);
|
||||
glRotatef(-(1 - o) * 90 - 90, 0, 1, 0);
|
||||
@@ -69,67 +68,62 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region)
|
||||
if (ff1 > 1) ff1 = 1;
|
||||
if (ff2 > 1) ff2 = 1;
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
if(model == NULL)
|
||||
{
|
||||
// Share the model the the EnchantTableRenderer
|
||||
if (model == NULL) {
|
||||
// Share the model the the EnchantTableRenderer
|
||||
|
||||
EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY);
|
||||
if(etr != NULL)
|
||||
{
|
||||
model = etr->bookModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new BookModel();
|
||||
}
|
||||
}
|
||||
EnchantTableRenderer* etr =
|
||||
(EnchantTableRenderer*)TileEntityRenderDispatcher::instance
|
||||
->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY);
|
||||
if (etr != NULL) {
|
||||
model = etr->bookModel;
|
||||
} else {
|
||||
model = new BookModel();
|
||||
}
|
||||
}
|
||||
|
||||
model->render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
|
||||
glDisable(GL_CULL_FACE);
|
||||
model->render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f, true);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
tickBook();
|
||||
tickBook();
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentBook::tickBook()
|
||||
{
|
||||
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||
std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||
if (!ItemInstance::matches(current, last))
|
||||
{
|
||||
void UIControl_EnchantmentBook::tickBook() {
|
||||
UIScene_EnchantingMenu* m_containerScene =
|
||||
(UIScene_EnchantingMenu*)m_parentScene;
|
||||
EnchantmentMenu* menu = m_containerScene->getMenu();
|
||||
std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||
if (!ItemInstance::matches(current, last)) {
|
||||
last = current;
|
||||
|
||||
do
|
||||
{
|
||||
flipT += random.nextInt(4) - random.nextInt(4);
|
||||
} while (flip <= flipT + 1 && flip >= flipT - 1);
|
||||
do {
|
||||
flipT += random.nextInt(4) - random.nextInt(4);
|
||||
} while (flip <= flipT + 1 && flip >= flipT - 1);
|
||||
}
|
||||
|
||||
time++;
|
||||
oFlip = flip;
|
||||
oOpen = open;
|
||||
|
||||
bool shouldBeOpen = false;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (menu->costs[i] != 0)
|
||||
{
|
||||
bool shouldBeOpen = false;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (menu->costs[i] != 0) {
|
||||
shouldBeOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldBeOpen) open += 0.2f;
|
||||
else open -= 0.2f;
|
||||
if (shouldBeOpen)
|
||||
open += 0.2f;
|
||||
else
|
||||
open -= 0.2f;
|
||||
if (open < 0) open = 0;
|
||||
if (open > 1) open = 1;
|
||||
|
||||
|
||||
float diff = (flipT - flip) * 0.4f;
|
||||
float max = 0.2f;
|
||||
if (diff < -max) diff = -max;
|
||||
|
||||
@@ -5,29 +5,28 @@
|
||||
class UIScene_EnchantingMenu;
|
||||
class BookModel;
|
||||
|
||||
class UIControl_EnchantmentBook : public UIControl
|
||||
{
|
||||
class UIControl_EnchantmentBook : public UIControl {
|
||||
private:
|
||||
BookModel *model;
|
||||
Random random;
|
||||
BookModel* model;
|
||||
Random random;
|
||||
|
||||
// 4J JEV: Book animation variables.
|
||||
int time;
|
||||
// 4J JEV: Book animation variables.
|
||||
int time;
|
||||
float flip, oFlip, flipT, flipA;
|
||||
float open, oOpen;
|
||||
|
||||
//BOOL m_bDirty;
|
||||
//float m_fScale,m_fAlpha;
|
||||
//int m_iPad;
|
||||
std::shared_ptr<ItemInstance> last;
|
||||
// BOOL m_bDirty;
|
||||
// float m_fScale,m_fAlpha;
|
||||
// int m_iPad;
|
||||
std::shared_ptr<ItemInstance> last;
|
||||
|
||||
//float m_fScreenWidth,m_fScreenHeight;
|
||||
//float m_fRawWidth,m_fRawHeight;
|
||||
// float m_fScreenWidth,m_fScreenHeight;
|
||||
// float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
void tickBook();
|
||||
void tickBook();
|
||||
|
||||
public:
|
||||
UIControl_EnchantmentBook();
|
||||
UIControl_EnchantmentBook();
|
||||
|
||||
void render(IggyCustomDrawCallbackRegion *region);
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
};
|
||||
|
||||
@@ -10,200 +10,196 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
UIControl_EnchantmentButton::UIControl_EnchantmentButton()
|
||||
{
|
||||
m_index = 0;
|
||||
m_lastState = eState_Inactive;
|
||||
m_lastCost = 0;
|
||||
m_enchantmentString = L"";
|
||||
m_bHasFocus = false;
|
||||
UIControl_EnchantmentButton::UIControl_EnchantmentButton() {
|
||||
m_index = 0;
|
||||
m_lastState = eState_Inactive;
|
||||
m_lastCost = 0;
|
||||
m_enchantmentString = L"";
|
||||
m_bHasFocus = false;
|
||||
|
||||
m_textColour = app.GetHTMLColour(eTextColor_Enchant);
|
||||
m_textFocusColour = app.GetHTMLColour(eTextColor_EnchantFocus);
|
||||
m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled);
|
||||
m_textColour = app.GetHTMLColour(eTextColor_Enchant);
|
||||
m_textFocusColour = app.GetHTMLColour(eTextColor_EnchantFocus);
|
||||
m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled);
|
||||
}
|
||||
|
||||
bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eEnchantmentButton);
|
||||
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
||||
bool UIControl_EnchantmentButton::setupControl(UIScene* scene,
|
||||
IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eEnchantmentButton);
|
||||
bool success = UIControl_Button::setupControl(scene, parent, controlName);
|
||||
|
||||
//Button specific initialisers
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
// Button specific initialisers
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentButton::init(int index)
|
||||
{
|
||||
m_index = index;
|
||||
void UIControl_EnchantmentButton::init(int index) { m_index = index; }
|
||||
|
||||
void UIControl_EnchantmentButton::tick() {
|
||||
updateState();
|
||||
UIControl_Button::tick();
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentButton::tick()
|
||||
{
|
||||
updateState();
|
||||
UIControl_Button::tick();
|
||||
}
|
||||
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion* region) {
|
||||
UIScene_EnchantingMenu* enchantingScene =
|
||||
(UIScene_EnchantingMenu*)m_parentScene;
|
||||
EnchantmentMenu* menu = enchantingScene->getMenu();
|
||||
|
||||
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width/2;
|
||||
float yo = height;
|
||||
//glTranslatef(xo, yo, 50.0f);
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width / 2;
|
||||
float yo = height;
|
||||
// glTranslatef(xo, yo, 50.0f);
|
||||
|
||||
// Revert the scale from the setup
|
||||
float ssX = width/m_width;
|
||||
float ssY = height/m_height;
|
||||
glScalef(ssX, ssY,1.0f);
|
||||
// Revert the scale from the setup
|
||||
float ssX = width / m_width;
|
||||
float ssY = height / m_height;
|
||||
glScalef(ssX, ssY, 1.0f);
|
||||
|
||||
float ss = 1.0f;
|
||||
float ss = 1.0f;
|
||||
|
||||
#if TO_BE_IMPLEMENTED
|
||||
if(!enchantingScene->m_bSplitscreen)
|
||||
if (!enchantingScene->m_bSplitscreen)
|
||||
#endif
|
||||
{
|
||||
switch(enchantingScene->getSceneResolution())
|
||||
{
|
||||
case UIScene::eSceneResolution_1080:
|
||||
ss = 3.0f;
|
||||
break;
|
||||
default:
|
||||
ss = 2.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
switch (enchantingScene->getSceneResolution()) {
|
||||
case UIScene::eSceneResolution_1080:
|
||||
ss = 3.0f;
|
||||
break;
|
||||
default:
|
||||
ss = 2.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
glScalef(ss, ss, ss);
|
||||
glScalef(ss, ss, ss);
|
||||
|
||||
int cost = menu->costs[m_index];
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
//if(cost != m_lastCost)
|
||||
//{
|
||||
// updateState();
|
||||
//}
|
||||
// if(cost != m_lastCost)
|
||||
//{
|
||||
// updateState();
|
||||
// }
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
if (cost != 0)
|
||||
{
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.1f);
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
std::wstring line = _toString<int>(cost);
|
||||
Font *font = pMinecraft->altFont;
|
||||
//int col = 0x685E4A;
|
||||
unsigned int col = m_textColour;
|
||||
if (pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel < cost && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||
{
|
||||
col = m_textDisabledColour;
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
||||
font = pMinecraft->font;
|
||||
//col = (0x80ff20 & 0xfefefe) >> 1;
|
||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bHasFocus)
|
||||
{
|
||||
//col = 0xffff80;
|
||||
col = m_textFocusColour;
|
||||
}
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
||||
font = pMinecraft->font;
|
||||
//col = 0x80ff20;
|
||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
}
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
glColor4f(1, 1, 1, 1);
|
||||
if (cost != 0) {
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.1f);
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
std::wstring line = _toString<int>(cost);
|
||||
Font* font = pMinecraft->altFont;
|
||||
// int col = 0x685E4A;
|
||||
unsigned int col = m_textColour;
|
||||
if (pMinecraft->localplayers[enchantingScene->getPad()]
|
||||
->experienceLevel < cost &&
|
||||
!pMinecraft->localplayers[enchantingScene->getPad()]
|
||||
->abilities.instabuild) {
|
||||
col = m_textDisabledColour;
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width / ss,
|
||||
col, (float)m_height / ss);
|
||||
font = pMinecraft->font;
|
||||
// col = (0x80ff20 & 0xfefefe) >> 1;
|
||||
// font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
} else {
|
||||
if (m_bHasFocus) {
|
||||
// col = 0xffff80;
|
||||
col = m_textFocusColour;
|
||||
}
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width / ss,
|
||||
col, (float)m_height / ss);
|
||||
font = pMinecraft->font;
|
||||
// col = 0x80ff20;
|
||||
// font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
}
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
} else {
|
||||
}
|
||||
|
||||
//Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
// Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentButton::updateState()
|
||||
{
|
||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||
void UIControl_EnchantmentButton::updateState() {
|
||||
UIScene_EnchantingMenu* enchantingScene =
|
||||
(UIScene_EnchantingMenu*)m_parentScene;
|
||||
EnchantmentMenu* menu = enchantingScene->getMenu();
|
||||
|
||||
EState state = eState_Inactive;
|
||||
EState state = eState_Inactive;
|
||||
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||
{
|
||||
// Dark background
|
||||
state = eState_Inactive;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Light background and focus background
|
||||
if(m_bHasFocus)
|
||||
{
|
||||
state = eState_Selected;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = eState_Active;
|
||||
}
|
||||
}
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
if(cost != m_lastCost)
|
||||
{
|
||||
setLabel( _toString<int>(cost) );
|
||||
m_lastCost = cost;
|
||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||
}
|
||||
if(cost == 0)
|
||||
{
|
||||
// Dark background
|
||||
state = eState_Inactive;
|
||||
setLabel(L"");
|
||||
}
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (cost > pMinecraft->localplayers[enchantingScene->getPad()]
|
||||
->experienceLevel &&
|
||||
!pMinecraft->localplayers[enchantingScene->getPad()]
|
||||
->abilities.instabuild) {
|
||||
// Dark background
|
||||
state = eState_Inactive;
|
||||
} else {
|
||||
// Light background and focus background
|
||||
if (m_bHasFocus) {
|
||||
state = eState_Selected;
|
||||
} else {
|
||||
state = eState_Active;
|
||||
}
|
||||
}
|
||||
|
||||
if(state != m_lastState)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
if (cost != m_lastCost) {
|
||||
setLabel(_toString<int>(cost));
|
||||
m_lastCost = cost;
|
||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||
}
|
||||
if (cost == 0) {
|
||||
// Dark background
|
||||
state = eState_Inactive;
|
||||
setLabel(L"");
|
||||
}
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (int)state;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value );
|
||||
if (state != m_lastState) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
if(out == IGGY_RESULT_SUCCESS) m_lastState = state;
|
||||
}
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = (int)state;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_funcChangeState, 1, value);
|
||||
|
||||
if (out == IGGY_RESULT_SUCCESS) m_lastState = state;
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentButton::setFocus(bool focus)
|
||||
{
|
||||
m_bHasFocus = focus;
|
||||
updateState();
|
||||
void UIControl_EnchantmentButton::setFocus(bool focus) {
|
||||
m_bHasFocus = focus;
|
||||
updateState();
|
||||
}
|
||||
|
||||
UIControl_EnchantmentButton::EnchantmentNames UIControl_EnchantmentButton::EnchantmentNames::instance;
|
||||
UIControl_EnchantmentButton::EnchantmentNames
|
||||
UIControl_EnchantmentButton::EnchantmentNames::instance;
|
||||
|
||||
UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames()
|
||||
{
|
||||
std::wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ";
|
||||
std::wistringstream iss(allWords);
|
||||
std::copy(std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(iss), std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(),std::back_inserter(words));
|
||||
UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames() {
|
||||
std::wstring allWords =
|
||||
L"the elder scrolls klaatu berata niktu xyzzy bless curse light "
|
||||
L"darkness fire air earth water hot dry cold wet ignite snuff embiggen "
|
||||
L"twist shorten stretch fiddle destroy imbue galvanize enchant free "
|
||||
L"limited range of towards inside sphere cube self other ball mental "
|
||||
L"physical grow shrink demon elemental spirit animal creature beast "
|
||||
L"humanoid undead fresh stale ";
|
||||
std::wistringstream iss(allWords);
|
||||
std::copy(std::istream_iterator<std::wstring, wchar_t,
|
||||
std::char_traits<wchar_t> >(iss),
|
||||
std::istream_iterator<std::wstring, wchar_t,
|
||||
std::char_traits<wchar_t> >(),
|
||||
std::back_inserter(words));
|
||||
}
|
||||
|
||||
std::wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName()
|
||||
{
|
||||
int wordCount = random.nextInt(2) + 3;
|
||||
std::wstring word = L"";
|
||||
for (int i = 0; i < wordCount; i++)
|
||||
{
|
||||
if (i > 0) word += L" ";
|
||||
word += words[random.nextInt(words.size())];
|
||||
}
|
||||
return word;
|
||||
std::wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName() {
|
||||
int wordCount = random.nextInt(2) + 3;
|
||||
std::wstring word = L"";
|
||||
for (int i = 0; i < wordCount; i++) {
|
||||
if (i > 0) word += L" ";
|
||||
word += words[random.nextInt(words.size())];
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
@@ -2,54 +2,52 @@
|
||||
|
||||
#include "UIControl_Button.h"
|
||||
|
||||
class UIControl_EnchantmentButton : public UIControl_Button
|
||||
{
|
||||
class UIControl_EnchantmentButton : public UIControl_Button {
|
||||
private:
|
||||
// Maps to values in AS
|
||||
enum EState
|
||||
{
|
||||
eState_Inactive = 0,
|
||||
eState_Active = 1,
|
||||
eState_Selected = 2,
|
||||
};
|
||||
// Maps to values in AS
|
||||
enum EState {
|
||||
eState_Inactive = 0,
|
||||
eState_Active = 1,
|
||||
eState_Selected = 2,
|
||||
};
|
||||
|
||||
EState m_lastState;
|
||||
int m_lastCost;
|
||||
int m_index;
|
||||
std::wstring m_enchantmentString;
|
||||
bool m_bHasFocus;
|
||||
EState m_lastState;
|
||||
int m_lastCost;
|
||||
int m_index;
|
||||
std::wstring m_enchantmentString;
|
||||
bool m_bHasFocus;
|
||||
|
||||
IggyName m_funcChangeState;
|
||||
IggyName m_funcChangeState;
|
||||
|
||||
unsigned int m_textColour, m_textFocusColour, m_textDisabledColour;
|
||||
unsigned int m_textColour, m_textFocusColour, m_textDisabledColour;
|
||||
|
||||
class EnchantmentNames
|
||||
{
|
||||
public:
|
||||
static EnchantmentNames instance;
|
||||
class EnchantmentNames {
|
||||
public:
|
||||
static EnchantmentNames instance;
|
||||
|
||||
private:
|
||||
Random random;
|
||||
std::vector<std::wstring> words;
|
||||
private:
|
||||
Random random;
|
||||
std::vector<std::wstring> words;
|
||||
|
||||
EnchantmentNames();
|
||||
EnchantmentNames();
|
||||
|
||||
public:
|
||||
std::wstring getRandomName();
|
||||
};
|
||||
public:
|
||||
std::wstring getRandomName();
|
||||
};
|
||||
|
||||
public:
|
||||
UIControl_EnchantmentButton();
|
||||
UIControl_EnchantmentButton();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
void init(int index);
|
||||
void init(int index);
|
||||
|
||||
void render(IggyCustomDrawCallbackRegion *region);
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
|
||||
void updateState();
|
||||
void updateState();
|
||||
|
||||
virtual void setFocus(bool focus);
|
||||
virtual void setFocus(bool focus);
|
||||
};
|
||||
@@ -2,102 +2,101 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_HTMLLabel.h"
|
||||
|
||||
UIControl_HTMLLabel::UIControl_HTMLLabel()
|
||||
{
|
||||
UIControl_HTMLLabel::UIControl_HTMLLabel() {}
|
||||
|
||||
bool UIControl_HTMLLabel::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eHTMLLabel);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// Label specific initialisers
|
||||
m_funcStartAutoScroll = registerFastName(L"StartAutoScroll");
|
||||
m_funcTouchScroll = registerFastName(L"TouchScroll");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eHTMLLabel);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
|
||||
//Label specific initialisers
|
||||
m_funcStartAutoScroll = registerFastName(L"StartAutoScroll");
|
||||
m_funcTouchScroll = registerFastName(L"TouchScroll");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
|
||||
return success;
|
||||
void UIControl_HTMLLabel::startAutoScroll() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcStartAutoScroll, 0, NULL);
|
||||
}
|
||||
|
||||
void UIControl_HTMLLabel::startAutoScroll()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , NULL );
|
||||
void UIControl_HTMLLabel::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
// Don't set the label, HTML sizes will have changed. Let the scene update
|
||||
// us.
|
||||
init(L"");
|
||||
}
|
||||
|
||||
void UIControl_HTMLLabel::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
// Don't set the label, HTML sizes will have changed. Let the scene update us.
|
||||
init(L"");
|
||||
void UIControl_HTMLLabel::setLabel(const std::string& label) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_setLabelFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_HTMLLabel::setLabel(const std::string &label)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
IggyStringUTF8 stringVal;
|
||||
void UIControl_HTMLLabel::SetupTouch() {
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this dynamic label to the vita touch box list
|
||||
|
||||
stringVal.string = (char *) label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_HTMLLabel::SetupTouch()
|
||||
{
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this dynamic label to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iY;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bActive;
|
||||
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcTouchScroll, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
S32 UIControl_HTMLLabel::GetRealWidth() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcGetRealWidth, 0, NULL);
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iY;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bActive;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcTouchScroll, 2 , value );
|
||||
S32 iRealWidth = m_width;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
}
|
||||
|
||||
S32 UIControl_HTMLLabel::GetRealWidth()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL );
|
||||
S32 UIControl_HTMLLabel::GetRealHeight() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcGetRealHeight, 0, NULL);
|
||||
|
||||
S32 iRealWidth = m_width;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
}
|
||||
|
||||
S32 UIControl_HTMLLabel::GetRealHeight()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL );
|
||||
|
||||
S32 iRealHeight = m_height;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
S32 iRealHeight = m_height;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
}
|
||||
@@ -2,26 +2,27 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_HTMLLabel : public UIControl_Label
|
||||
{
|
||||
class UIControl_HTMLLabel : public UIControl_Label {
|
||||
private:
|
||||
IggyName m_funcStartAutoScroll, m_funcTouchScroll, m_funcGetRealWidth, m_funcGetRealHeight;
|
||||
IggyName m_funcStartAutoScroll, m_funcTouchScroll, m_funcGetRealWidth,
|
||||
m_funcGetRealHeight;
|
||||
|
||||
public:
|
||||
UIControl_HTMLLabel();
|
||||
UIControl_HTMLLabel();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void startAutoScroll();
|
||||
virtual void ReInit();
|
||||
void startAutoScroll();
|
||||
virtual void ReInit();
|
||||
|
||||
using UIControl_Base::setLabel;
|
||||
void setLabel(const std::string &label);
|
||||
using UIControl_Base::setLabel;
|
||||
void setLabel(const std::string& label);
|
||||
|
||||
virtual void SetupTouch();
|
||||
virtual void SetupTouch();
|
||||
|
||||
virtual void TouchScroll(S32 iY, bool bActive);
|
||||
virtual void TouchScroll(S32 iY, bool bActive);
|
||||
|
||||
S32 GetRealWidth();
|
||||
S32 GetRealHeight();
|
||||
S32 GetRealWidth();
|
||||
S32 GetRealHeight();
|
||||
};
|
||||
@@ -3,54 +3,53 @@
|
||||
#include "UIControl_Label.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
UIControl_Label::UIControl_Label()
|
||||
{
|
||||
UIControl_Label::UIControl_Label() {}
|
||||
|
||||
bool UIControl_Label::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eLabel);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// Label specific initialisers
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eLabel);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_Label::init(const std::wstring& label) {
|
||||
m_label = label;
|
||||
|
||||
//Label specific initialisers
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
return success;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_Label::init(const std::wstring &label)
|
||||
{
|
||||
m_label = label;
|
||||
void UIControl_Label::init(const std::string& label) {
|
||||
m_label = convStringToWstring(label);
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string8 = stringVal;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_Label::init(const std::string &label)
|
||||
{
|
||||
m_label = convStringToWstring(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char *)label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string8 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
}
|
||||
|
||||
void UIControl_Label::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label);
|
||||
void UIControl_Label::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Label : public UIControl_Base
|
||||
{
|
||||
class UIControl_Label : public UIControl_Base {
|
||||
public:
|
||||
UIControl_Label();
|
||||
UIControl_Label();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label);
|
||||
void init(const std::string &label);
|
||||
virtual void ReInit();
|
||||
void init(const std::wstring& label);
|
||||
void init(const std::string& label);
|
||||
virtual void ReInit();
|
||||
};
|
||||
@@ -2,257 +2,250 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_LeaderboardList.h"
|
||||
|
||||
UIControl_LeaderboardList::UIControl_LeaderboardList()
|
||||
{
|
||||
}
|
||||
UIControl_LeaderboardList::UIControl_LeaderboardList() {}
|
||||
|
||||
bool UIControl_LeaderboardList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eLeaderboardList);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
bool UIControl_LeaderboardList::setupControl(UIScene* scene,
|
||||
IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eLeaderboardList);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//UIControl_LeaderboardList specific initialisers
|
||||
m_funcInitLeaderboard = registerFastName(L"InitLeaderboard");
|
||||
m_funcAddDataSet = registerFastName(L"AddDataSet");
|
||||
m_funcResetLeaderboard = registerFastName(L"ResetLeaderboard");
|
||||
m_funcSetupTitles = registerFastName(L"SetupTitles");
|
||||
m_funcSetColumnIcon = registerFastName(L"SetColumnIcon");
|
||||
// UIControl_LeaderboardList specific initialisers
|
||||
m_funcInitLeaderboard = registerFastName(L"InitLeaderboard");
|
||||
m_funcAddDataSet = registerFastName(L"AddDataSet");
|
||||
m_funcResetLeaderboard = registerFastName(L"ResetLeaderboard");
|
||||
m_funcSetupTitles = registerFastName(L"SetupTitles");
|
||||
m_funcSetColumnIcon = registerFastName(L"SetColumnIcon");
|
||||
#ifdef __PSVITA__
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_bTouchInitialised = false;
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_bTouchInitialised = false;
|
||||
#endif
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::init(int id)
|
||||
{
|
||||
m_id = id;
|
||||
void UIControl_LeaderboardList::init(int id) {
|
||||
m_id = id;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
init(m_id);
|
||||
void UIControl_LeaderboardList::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_id);
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::clearList()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , NULL );
|
||||
void UIControl_LeaderboardList::clearList() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcResetLeaderboard, 0, NULL);
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::setupTitles(const std::wstring &rank, const std::wstring &gamertag)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_LeaderboardList::setupTitles(const std::wstring& rank,
|
||||
const std::wstring& gamertag) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
const std::u16string convRank = convWstringToU16string(rank);
|
||||
const std::u16string convRank = convWstringToU16string(rank);
|
||||
|
||||
IggyStringUTF16 stringVal0;
|
||||
stringVal0.string = convRank.c_str();
|
||||
stringVal0.length = convRank.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal0;
|
||||
IggyStringUTF16 stringVal0;
|
||||
stringVal0.string = convRank.c_str();
|
||||
stringVal0.length = convRank.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal0;
|
||||
|
||||
const std::u16string convGamertag = convWstringToU16string(gamertag);
|
||||
const std::u16string convGamertag = convWstringToU16string(gamertag);
|
||||
|
||||
IggyStringUTF16 stringVal1;
|
||||
stringVal1.string = convGamertag.c_str();
|
||||
stringVal1.length = convGamertag.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal1;
|
||||
IggyStringUTF16 stringVal1;
|
||||
stringVal1.string = convGamertag.c_str();
|
||||
stringVal1.length = convGamertag.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal1;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetupTitles , 2 , value );
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSetupTitles, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iFirstFocus;
|
||||
void UIControl_LeaderboardList::initLeaderboard(int iFirstFocus,
|
||||
int iTotalEntries,
|
||||
int iNumColumns) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iFirstFocus;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iTotalEntries;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iTotalEntries;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iNumColumns;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcInitLeaderboard , 3 , value );
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iNumColumns;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcInitLeaderboard, 3, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-PB - add this button to the vita touch box list
|
||||
if(!m_bTouchInitialised)
|
||||
{
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
m_bTouchInitialised = true;
|
||||
}
|
||||
// 4J-PB - add this button to the vita touch box list
|
||||
if (!m_bTouchInitialised) {
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
m_bTouchInitialised = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iColumn;
|
||||
void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iColumn;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (iType<=32000)?0:(iType-32000);
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (iType <= 32000) ? 0 : (iType - 32000);
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetColumnIcon , 2 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetColumnIcon, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_LeaderboardList::addDataSet(bool bLast, int iId, int iRank, const std::wstring &gamertag, bool bDisplayMessage, const std::wstring &col0, const std::wstring &col1, const std::wstring &col2, const std::wstring &col3, const std::wstring &col4, const std::wstring &col5, const std::wstring &col6)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[12];
|
||||
void UIControl_LeaderboardList::addDataSet(
|
||||
bool bLast, int iId, int iRank, const std::wstring& gamertag,
|
||||
bool bDisplayMessage, const std::wstring& col0, const std::wstring& col1,
|
||||
const std::wstring& col2, const std::wstring& col3,
|
||||
const std::wstring& col4, const std::wstring& col5,
|
||||
const std::wstring& col6) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[12];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = bLast;
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = bLast;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iId;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iRank;
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iRank;
|
||||
|
||||
const std::u16string convGamertag = convWstringToU16string(gamertag);
|
||||
const std::u16string convGamertag = convWstringToU16string(gamertag);
|
||||
|
||||
IggyStringUTF16 stringVal0;
|
||||
stringVal0.string = convGamertag.c_str();
|
||||
stringVal0.length = convGamertag.length();
|
||||
value[3].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[3].string16 = stringVal0;
|
||||
IggyStringUTF16 stringVal0;
|
||||
stringVal0.string = convGamertag.c_str();
|
||||
stringVal0.length = convGamertag.length();
|
||||
value[3].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[3].string16 = stringVal0;
|
||||
|
||||
value[4].type = IGGY_DATATYPE_boolean;
|
||||
value[4].boolval = bDisplayMessage;
|
||||
value[4].type = IGGY_DATATYPE_boolean;
|
||||
value[4].boolval = bDisplayMessage;
|
||||
|
||||
const std::u16string convCol0 = convWstringToU16string(col0);
|
||||
const std::u16string convCol0 = convWstringToU16string(col0);
|
||||
|
||||
IggyStringUTF16 stringVal1;
|
||||
stringVal1.string = convCol0.c_str();
|
||||
stringVal1.length = convCol0.length();
|
||||
value[5].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[5].string16 = stringVal1;
|
||||
IggyStringUTF16 stringVal1;
|
||||
stringVal1.string = convCol0.c_str();
|
||||
stringVal1.length = convCol0.length();
|
||||
value[5].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[5].string16 = stringVal1;
|
||||
|
||||
if(col1.empty())
|
||||
{
|
||||
value[6].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol1 = convWstringToU16string(col1);
|
||||
if (col1.empty()) {
|
||||
value[6].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol1 = convWstringToU16string(col1);
|
||||
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convCol1.c_str();
|
||||
stringVal2.length = convCol1.length();
|
||||
value[6].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[6].string16 = stringVal2;
|
||||
}
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convCol1.c_str();
|
||||
stringVal2.length = convCol1.length();
|
||||
value[6].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[6].string16 = stringVal2;
|
||||
}
|
||||
|
||||
if(col2.empty())
|
||||
{
|
||||
value[7].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol2 = convWstringToU16string(col2);
|
||||
if (col2.empty()) {
|
||||
value[7].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol2 = convWstringToU16string(col2);
|
||||
|
||||
IggyStringUTF16 stringVal3;
|
||||
stringVal3.string = convCol2.c_str();
|
||||
stringVal3.length = convCol2.length();
|
||||
value[7].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[7].string16 = stringVal3;
|
||||
}
|
||||
IggyStringUTF16 stringVal3;
|
||||
stringVal3.string = convCol2.c_str();
|
||||
stringVal3.length = convCol2.length();
|
||||
value[7].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[7].string16 = stringVal3;
|
||||
}
|
||||
|
||||
if(col3.empty())
|
||||
{
|
||||
value[8].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol3 = convWstringToU16string(col3);
|
||||
if (col3.empty()) {
|
||||
value[8].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol3 = convWstringToU16string(col3);
|
||||
|
||||
IggyStringUTF16 stringVal4;
|
||||
stringVal4.string = convCol3.c_str();
|
||||
stringVal4.length = convCol3.length();
|
||||
value[8].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[8].string16 = stringVal4;
|
||||
}
|
||||
IggyStringUTF16 stringVal4;
|
||||
stringVal4.string = convCol3.c_str();
|
||||
stringVal4.length = convCol3.length();
|
||||
value[8].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[8].string16 = stringVal4;
|
||||
}
|
||||
|
||||
if(col4.empty())
|
||||
{
|
||||
value[9].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol4 = convWstringToU16string(col4);
|
||||
if (col4.empty()) {
|
||||
value[9].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol4 = convWstringToU16string(col4);
|
||||
|
||||
IggyStringUTF16 stringVal5;
|
||||
stringVal5.string = convCol4.c_str();
|
||||
stringVal5.length = convCol4.length();
|
||||
value[9].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[9].string16 = stringVal5;
|
||||
}
|
||||
IggyStringUTF16 stringVal5;
|
||||
stringVal5.string = convCol4.c_str();
|
||||
stringVal5.length = convCol4.length();
|
||||
value[9].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[9].string16 = stringVal5;
|
||||
}
|
||||
|
||||
if(col5.empty())
|
||||
{
|
||||
value[10].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol5 = convWstringToU16string(col5);
|
||||
if (col5.empty()) {
|
||||
value[10].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol5 = convWstringToU16string(col5);
|
||||
|
||||
IggyStringUTF16 stringVal6;
|
||||
stringVal6.string = convCol5.c_str();
|
||||
stringVal6.length = convCol5.length();
|
||||
value[10].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[10].string16 = stringVal6;
|
||||
}
|
||||
IggyStringUTF16 stringVal6;
|
||||
stringVal6.string = convCol5.c_str();
|
||||
stringVal6.length = convCol5.length();
|
||||
value[10].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[10].string16 = stringVal6;
|
||||
}
|
||||
|
||||
if(col6.empty())
|
||||
{
|
||||
value[11].type = IGGY_DATATYPE_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::u16string convCol6 = convWstringToU16string(col6);
|
||||
if (col6.empty()) {
|
||||
value[11].type = IGGY_DATATYPE_null;
|
||||
} else {
|
||||
const std::u16string convCol6 = convWstringToU16string(col6);
|
||||
|
||||
IggyStringUTF16 stringVal7;
|
||||
stringVal7.string = convCol6.c_str();
|
||||
stringVal7.length = convCol6.length();
|
||||
value[11].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[11].string16 = stringVal7;
|
||||
}
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcAddDataSet , 12 , value );
|
||||
IggyStringUTF16 stringVal7;
|
||||
stringVal7.string = convCol6.c_str();
|
||||
stringVal7.length = convCol6.length();
|
||||
value[11].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[11].string16 = stringVal7;
|
||||
}
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcAddDataSet, 12, value);
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void UIControl_LeaderboardList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_LeaderboardList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetTouchFocus, 3, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,49 +2,53 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_LeaderboardList : public UIControl_Base
|
||||
{
|
||||
class UIControl_LeaderboardList : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_funcInitLeaderboard, m_funcAddDataSet;
|
||||
IggyName m_funcResetLeaderboard;
|
||||
IggyName m_funcSetupTitles, m_funcSetColumnIcon;
|
||||
IggyName m_funcInitLeaderboard, m_funcAddDataSet;
|
||||
IggyName m_funcResetLeaderboard;
|
||||
IggyName m_funcSetupTitles, m_funcSetColumnIcon;
|
||||
#ifdef __PSVITA__
|
||||
IggyName m_funcSetTouchFocus;
|
||||
bool m_bTouchInitialised;
|
||||
IggyName m_funcSetTouchFocus;
|
||||
bool m_bTouchInitialised;
|
||||
#endif
|
||||
public:
|
||||
enum ELeaderboardIcons
|
||||
{
|
||||
e_ICON_TYPE_IGGY = 0,
|
||||
e_ICON_TYPE_CLIMBED = 32001,
|
||||
e_ICON_TYPE_FALLEN = 32002,
|
||||
e_ICON_TYPE_WALKED = 32003,
|
||||
e_ICON_TYPE_SWAM = 32004,
|
||||
e_ICON_TYPE_ZOMBIE = 32005,
|
||||
e_ICON_TYPE_ZOMBIEPIGMAN = 32006,
|
||||
e_ICON_TYPE_GHAST = 32007,
|
||||
e_ICON_TYPE_CREEPER = 32008,
|
||||
e_ICON_TYPE_SKELETON = 32009,
|
||||
e_ICON_TYPE_SPIDER = 32010,
|
||||
e_ICON_TYPE_SPIDERJOKEY = 32011,
|
||||
e_ICON_TYPE_SLIME = 32012,
|
||||
e_ICON_TYPE_PORTAL = 32013,
|
||||
};
|
||||
UIControl_LeaderboardList();
|
||||
enum ELeaderboardIcons {
|
||||
e_ICON_TYPE_IGGY = 0,
|
||||
e_ICON_TYPE_CLIMBED = 32001,
|
||||
e_ICON_TYPE_FALLEN = 32002,
|
||||
e_ICON_TYPE_WALKED = 32003,
|
||||
e_ICON_TYPE_SWAM = 32004,
|
||||
e_ICON_TYPE_ZOMBIE = 32005,
|
||||
e_ICON_TYPE_ZOMBIEPIGMAN = 32006,
|
||||
e_ICON_TYPE_GHAST = 32007,
|
||||
e_ICON_TYPE_CREEPER = 32008,
|
||||
e_ICON_TYPE_SKELETON = 32009,
|
||||
e_ICON_TYPE_SPIDER = 32010,
|
||||
e_ICON_TYPE_SPIDERJOKEY = 32011,
|
||||
e_ICON_TYPE_SLIME = 32012,
|
||||
e_ICON_TYPE_PORTAL = 32013,
|
||||
};
|
||||
UIControl_LeaderboardList();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
|
||||
void clearList();
|
||||
void clearList();
|
||||
|
||||
void setupTitles(const std::wstring &rank, const std::wstring &gamertag);
|
||||
void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns);
|
||||
void setColumnIcon(int iColumn, int iType);
|
||||
void addDataSet(bool bLast, int iId, int iRank, const std::wstring &gamertag, bool bDisplayMessage, const std::wstring &col0, const std::wstring &col1, const std::wstring &col2, const std::wstring &col3, const std::wstring &col4, const std::wstring &col5, const std::wstring &col6);
|
||||
void setupTitles(const std::wstring& rank, const std::wstring& gamertag);
|
||||
void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns);
|
||||
void setColumnIcon(int iColumn, int iType);
|
||||
void addDataSet(bool bLast, int iId, int iRank,
|
||||
const std::wstring& gamertag, bool bDisplayMessage,
|
||||
const std::wstring& col0, const std::wstring& col1,
|
||||
const std::wstring& col2, const std::wstring& col3,
|
||||
const std::wstring& col4, const std::wstring& col5,
|
||||
const std::wstring& col6);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
#endif
|
||||
};
|
||||
@@ -12,82 +12,91 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_MinecraftPlayer.h"
|
||||
|
||||
UIControl_MinecraftPlayer::UIControl_MinecraftPlayer()
|
||||
{
|
||||
UIControl::setControlType(UIControl::eMinecraftPlayer);
|
||||
UIControl_MinecraftPlayer::UIControl_MinecraftPlayer() {
|
||||
UIControl::setControlType(UIControl::eMinecraftPlayer);
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
|
||||
pMinecraft->height_phys);
|
||||
m_fScreenWidth = (float)pMinecraft->width_phys;
|
||||
m_fRawWidth = (float)ssc.rawWidth;
|
||||
m_fScreenHeight = (float)pMinecraft->height_phys;
|
||||
m_fRawHeight = (float)ssc.rawHeight;
|
||||
}
|
||||
|
||||
void UIControl_MinecraftPlayer::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glPushMatrix();
|
||||
void UIControl_MinecraftPlayer::render(IggyCustomDrawCallbackRegion* region) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glPushMatrix();
|
||||
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width/2;
|
||||
float yo = height;
|
||||
|
||||
glTranslatef(xo, yo - 7.0f, 50.0f);
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width / 2;
|
||||
float yo = height;
|
||||
|
||||
float ss;
|
||||
glTranslatef(xo, yo - 7.0f, 50.0f);
|
||||
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = width / (m_fScreenWidth / m_fScreenHeight);
|
||||
float ss;
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = width / (m_fScreenWidth / m_fScreenHeight);
|
||||
|
||||
UIScene_InventoryMenu *containerMenu = (UIScene_InventoryMenu *)m_parentScene;
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
|
||||
float oybr = pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot;
|
||||
float oyr = pMinecraft->localplayers[containerMenu->getPad()]->yRot;
|
||||
float oxr = pMinecraft->localplayers[containerMenu->getPad()]->xRot;
|
||||
float oyhr = pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot;
|
||||
UIScene_InventoryMenu* containerMenu =
|
||||
(UIScene_InventoryMenu*)m_parentScene;
|
||||
|
||||
//float xd = ( matrix._41 + ( (bwidth*matrix._11)/2) ) - m_pointerPos.x;
|
||||
float xd = (m_x + m_width/2) - containerMenu->m_pointerPos.x;
|
||||
float oybr = pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot;
|
||||
float oyr = pMinecraft->localplayers[containerMenu->getPad()]->yRot;
|
||||
float oxr = pMinecraft->localplayers[containerMenu->getPad()]->xRot;
|
||||
float oyhr = pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot;
|
||||
|
||||
// Need to base Y on head position, not centre of mass
|
||||
//float yd = ( matrix._42 + ( (bheight*matrix._22) / 2) - 40 ) - m_pointerPos.y;
|
||||
float yd = (m_y + m_height/2 - 40) - containerMenu->m_pointerPos.y;
|
||||
// float xd = ( matrix._41 + ( (bwidth*matrix._11)/2) ) - m_pointerPos.x;
|
||||
float xd = (m_x + m_width / 2) - containerMenu->m_pointerPos.x;
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
// Need to base Y on head position, not centre of mass
|
||||
// float yd = ( matrix._42 + ( (bheight*matrix._22) / 2) - 40 ) -
|
||||
// m_pointerPos.y;
|
||||
float yd = (m_y + m_height / 2 - 40) - containerMenu->m_pointerPos.y;
|
||||
|
||||
glRotatef(-(float) atan(yd / 40.0f) * 20, 1, 0, 0);
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot = (float) atan(xd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yRot = (float) atan(xd / 40.0f) * 40;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->xRot = -(float) atan(yd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot = pMinecraft->localplayers[containerMenu->getPad()]->yRot;
|
||||
//pMinecraft->localplayers[m_iPad]->glow = 1;
|
||||
glTranslatef(0, pMinecraft->localplayers[containerMenu->getPad()]->heightOffset, 0);
|
||||
EntityRenderDispatcher::instance->playerRotY = 180;
|
||||
glRotatef(-(float)atan(yd / 40.0f) * 20, 1, 0, 0);
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
EntityRenderDispatcher::instance->render(pMinecraft->localplayers[containerMenu->getPad()], 0, 0, 0, 0, 1, false, false);
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
//pMinecraft->localplayers[m_iPad]->glow = 0;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot =
|
||||
(float)atan(xd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yRot =
|
||||
(float)atan(xd / 40.0f) * 40;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->xRot =
|
||||
-(float)atan(yd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot =
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yRot;
|
||||
// pMinecraft->localplayers[m_iPad]->glow = 1;
|
||||
glTranslatef(
|
||||
0, pMinecraft->localplayers[containerMenu->getPad()]->heightOffset, 0);
|
||||
EntityRenderDispatcher::instance->playerRotY = 180;
|
||||
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot = oybr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yRot = oyr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->xRot = oxr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot = oyhr;
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in
|
||||
// split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
EntityRenderDispatcher::instance->render(
|
||||
pMinecraft->localplayers[containerMenu->getPad()], 0, 0, 0, 0, 1, false,
|
||||
false);
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
// pMinecraft->localplayers[m_iPad]->glow = 0;
|
||||
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot = oybr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yRot = oyr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->xRot = oxr;
|
||||
pMinecraft->localplayers[containerMenu->getPad()]->yHeadRot = oyhr;
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
#include "UIControl.h"
|
||||
|
||||
class UIControl_MinecraftPlayer : public UIControl
|
||||
{
|
||||
class UIControl_MinecraftPlayer : public UIControl {
|
||||
private:
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
float m_fScreenWidth, m_fScreenHeight;
|
||||
float m_fRawWidth, m_fRawHeight;
|
||||
|
||||
public:
|
||||
UIControl_MinecraftPlayer();
|
||||
UIControl_MinecraftPlayer();
|
||||
|
||||
void render(IggyCustomDrawCallbackRegion *region);
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
};
|
||||
@@ -2,66 +2,71 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_PlayerList.h"
|
||||
|
||||
bool UIControl_PlayerList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::ePlayerList);
|
||||
bool success = UIControl_ButtonList::setupControl(scene,parent,controlName);
|
||||
bool UIControl_PlayerList::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::ePlayerList);
|
||||
bool success =
|
||||
UIControl_ButtonList::setupControl(scene, parent, controlName);
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_funcSetPlayerIcon = registerFastName(L"SetPlayerIcon");
|
||||
m_funcSetVOIPIcon = registerFastName(L"SetVOIPIcon");
|
||||
// SlotList specific initialisers
|
||||
m_funcSetPlayerIcon = registerFastName(L"SetPlayerIcon");
|
||||
m_funcSetVOIPIcon = registerFastName(L"SetVOIPIcon");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_PlayerList::addItem(const std::wstring &label, int iPlayerIcon, int iVOIPIcon)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[4];
|
||||
void UIControl_PlayerList::addItem(const std::wstring& label, int iPlayerIcon,
|
||||
int iVOIPIcon) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[4];
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iPlayerIcon + 1;
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = iPlayerIcon + 1;
|
||||
|
||||
value[3].type = IGGY_DATATYPE_number;
|
||||
value[3].number = iVOIPIcon + 1;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 4 , value );
|
||||
value[3].type = IGGY_DATATYPE_number;
|
||||
value[3].number = iVOIPIcon + 1;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 4, value);
|
||||
|
||||
++m_itemCount;
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_PlayerList::setPlayerIcon(int iId, int iPlayerIcon)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_PlayerList::setPlayerIcon(int iId, int iPlayerIcon) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iPlayerIcon + 1;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetPlayerIcon , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iPlayerIcon + 1;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetPlayerIcon, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_PlayerList::setVOIPIcon(int iId, int iVOIPIcon)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_PlayerList::setVOIPIcon(int iId, int iVOIPIcon) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iVOIPIcon + 1;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetVOIPIcon , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iVOIPIcon + 1;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSetVOIPIcon, 2, value);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
#include "UIControl_ButtonList.h"
|
||||
|
||||
class UIControl_PlayerList : public UIControl_ButtonList
|
||||
{
|
||||
class UIControl_PlayerList : public UIControl_ButtonList {
|
||||
private:
|
||||
IggyName m_funcSetPlayerIcon, m_funcSetVOIPIcon;
|
||||
IggyName m_funcSetPlayerIcon, m_funcSetVOIPIcon;
|
||||
|
||||
public:
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
using UIControl_ButtonList::addItem;
|
||||
void addItem(const std::wstring &label, int iPlayerIcon, int iVOIPIcon);
|
||||
void setPlayerIcon(int iId, int iPlayerIcon);
|
||||
void setVOIPIcon(int iId, int iVOIPIcon);
|
||||
using UIControl_ButtonList::addItem;
|
||||
void addItem(const std::wstring& label, int iPlayerIcon, int iVOIPIcon);
|
||||
void setPlayerIcon(int iId, int iPlayerIcon);
|
||||
void setVOIPIcon(int iId, int iVOIPIcon);
|
||||
};
|
||||
@@ -10,505 +10,494 @@
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h"
|
||||
#include "UIControl_PlayerSkinPreview.h"
|
||||
|
||||
//#define SKIN_PREVIEW_BOB_ANIM
|
||||
// #define SKIN_PREVIEW_BOB_ANIM
|
||||
#define SKIN_PREVIEW_WALKING_ANIM
|
||||
|
||||
UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview()
|
||||
{
|
||||
UIControl::setControlType(UIControl::ePlayerSkinPreview);
|
||||
m_bDirty = false;
|
||||
m_fScale = 1.0f;
|
||||
m_fAlpha = 1.0f;
|
||||
UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() {
|
||||
UIControl::setControlType(UIControl::ePlayerSkinPreview);
|
||||
m_bDirty = false;
|
||||
m_fScale = 1.0f;
|
||||
m_fAlpha = 1.0f;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
|
||||
pMinecraft->height_phys);
|
||||
m_fScreenWidth = (float)pMinecraft->width_phys;
|
||||
m_fRawWidth = (float)ssc.rawWidth;
|
||||
m_fScreenHeight = (float)pMinecraft->height_phys;
|
||||
m_fRawHeight = (float)ssc.rawHeight;
|
||||
|
||||
m_customTextureUrl = L"default";
|
||||
m_backupTexture = TN_MOB_CHAR;
|
||||
m_capeTextureUrl = L"";
|
||||
m_customTextureUrl = L"default";
|
||||
m_backupTexture = TN_MOB_CHAR;
|
||||
m_capeTextureUrl = L"";
|
||||
|
||||
m_yRot = 0;
|
||||
m_xRot = 0;
|
||||
m_yRot = 0;
|
||||
m_xRot = 0;
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
m_bobTick = 0.0f;
|
||||
m_walkAnimSpeedO = 0.0f;
|
||||
m_walkAnimSpeed = 0.0f;
|
||||
m_walkAnimPos = 0.0f;
|
||||
m_swingTime = 0.0f;
|
||||
m_bobTick = 0.0f;
|
||||
m_walkAnimSpeedO = 0.0f;
|
||||
m_walkAnimSpeed = 0.0f;
|
||||
m_walkAnimPos = 0.0f;
|
||||
|
||||
m_bAutoRotate = false;
|
||||
m_bRotatingLeft = false;
|
||||
m_bAutoRotate = false;
|
||||
m_bRotatingLeft = false;
|
||||
|
||||
m_incXRot = false;
|
||||
m_decXRot = false;
|
||||
m_incYRot = false;
|
||||
m_decYRot = false;
|
||||
m_incXRot = false;
|
||||
m_decXRot = false;
|
||||
m_incYRot = false;
|
||||
m_decYRot = false;
|
||||
|
||||
m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
|
||||
m_fTargetRotation = 0.0f;
|
||||
m_fOriginalRotation = 0.0f;
|
||||
m_framesAnimatingRotation = 0;
|
||||
m_bAnimatingToFacing = false;
|
||||
m_pvAdditionalModelParts=NULL;
|
||||
m_uiAnimOverrideBitmask=0L;
|
||||
m_fTargetRotation = 0.0f;
|
||||
m_fOriginalRotation = 0.0f;
|
||||
m_framesAnimatingRotation = 0;
|
||||
m_bAnimatingToFacing = false;
|
||||
m_pvAdditionalModelParts = NULL;
|
||||
m_uiAnimOverrideBitmask = 0L;
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::tick()
|
||||
{
|
||||
UIControl::tick();
|
||||
void UIControl_PlayerSkinPreview::tick() {
|
||||
UIControl::tick();
|
||||
|
||||
if( m_bAnimatingToFacing )
|
||||
{
|
||||
++m_framesAnimatingRotation;
|
||||
m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES );
|
||||
if (m_bAnimatingToFacing) {
|
||||
++m_framesAnimatingRotation;
|
||||
m_yRot = m_fOriginalRotation +
|
||||
m_framesAnimatingRotation *
|
||||
((m_fTargetRotation - m_fOriginalRotation) /
|
||||
CHANGING_SKIN_FRAMES);
|
||||
|
||||
//if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_incXRot ) IncrementXRotation();
|
||||
if( m_decXRot ) DecrementXRotation();
|
||||
if( m_incYRot ) IncrementYRotation();
|
||||
if( m_decYRot ) DecrementYRotation();
|
||||
// if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES)
|
||||
// m_bAnimatingToFacing = false;
|
||||
} else {
|
||||
if (m_incXRot) IncrementXRotation();
|
||||
if (m_decXRot) DecrementXRotation();
|
||||
if (m_incYRot) IncrementYRotation();
|
||||
if (m_decYRot) DecrementYRotation();
|
||||
|
||||
if(m_bAutoRotate)
|
||||
{
|
||||
++m_rotateTick;
|
||||
if (m_bAutoRotate) {
|
||||
++m_rotateTick;
|
||||
|
||||
if(m_rotateTick%4==0)
|
||||
{
|
||||
if(m_yRot >= LOOK_LEFT_EXTENT)
|
||||
{
|
||||
m_bRotatingLeft = false;
|
||||
}
|
||||
else if(m_yRot <= LOOK_RIGHT_EXTENT)
|
||||
{
|
||||
m_bRotatingLeft = true;
|
||||
}
|
||||
if (m_rotateTick % 4 == 0) {
|
||||
if (m_yRot >= LOOK_LEFT_EXTENT) {
|
||||
m_bRotatingLeft = false;
|
||||
} else if (m_yRot <= LOOK_RIGHT_EXTENT) {
|
||||
m_bRotatingLeft = true;
|
||||
}
|
||||
|
||||
if(m_bRotatingLeft)
|
||||
{
|
||||
IncrementYRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
DecrementYRotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_bRotatingLeft) {
|
||||
IncrementYRotation();
|
||||
} else {
|
||||
DecrementYRotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture)
|
||||
{
|
||||
m_customTextureUrl = url;
|
||||
m_backupTexture = backupTexture;
|
||||
void UIControl_PlayerSkinPreview::SetTexture(const std::wstring& url,
|
||||
TEXTURE_NAME backupTexture) {
|
||||
m_customTextureUrl = url;
|
||||
m_backupTexture = backupTexture;
|
||||
|
||||
unsigned int uiAnimOverrideBitmask = Player::getSkinAnimOverrideBitmask( app.getSkinIdFromPath(m_customTextureUrl) );
|
||||
unsigned int uiAnimOverrideBitmask = Player::getSkinAnimOverrideBitmask(
|
||||
app.getSkinIdFromPath(m_customTextureUrl));
|
||||
|
||||
if(app.GetGameSettings(eGameSetting_CustomSkinAnim)==0 )
|
||||
{
|
||||
// We have a force animation for some skins (claptrap)
|
||||
// 4J-PB - treat all the eAnim_Disable flags as a force anim
|
||||
if (app.GetGameSettings(eGameSetting_CustomSkinAnim) == 0) {
|
||||
// We have a force animation for some skins (claptrap)
|
||||
// 4J-PB - treat all the eAnim_Disable flags as a force anim
|
||||
|
||||
if((uiAnimOverrideBitmask & HumanoidModel::m_staticBitmaskIgnorePlayerCustomAnimSetting)!=0)
|
||||
{
|
||||
m_uiAnimOverrideBitmask=uiAnimOverrideBitmask;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiAnimOverrideBitmask=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiAnimOverrideBitmask = uiAnimOverrideBitmask;
|
||||
}
|
||||
if ((uiAnimOverrideBitmask &
|
||||
HumanoidModel::m_staticBitmaskIgnorePlayerCustomAnimSetting) !=
|
||||
0) {
|
||||
m_uiAnimOverrideBitmask = uiAnimOverrideBitmask;
|
||||
} else {
|
||||
m_uiAnimOverrideBitmask = 0;
|
||||
}
|
||||
} else {
|
||||
m_uiAnimOverrideBitmask = uiAnimOverrideBitmask;
|
||||
}
|
||||
|
||||
m_pvAdditionalModelParts=app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl));
|
||||
m_pvAdditionalModelParts =
|
||||
app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl));
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAnimate /*= false*/)
|
||||
{
|
||||
switch(facing)
|
||||
{
|
||||
case e_SkinPreviewFacing_Forward:
|
||||
m_fTargetRotation = 0;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Left:
|
||||
m_fTargetRotation = LOOK_LEFT_EXTENT;
|
||||
m_bRotatingLeft = false;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Right:
|
||||
m_fTargetRotation = LOOK_RIGHT_EXTENT;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
}
|
||||
void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing,
|
||||
bool bAnimate /*= false*/) {
|
||||
switch (facing) {
|
||||
case e_SkinPreviewFacing_Forward:
|
||||
m_fTargetRotation = 0;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Left:
|
||||
m_fTargetRotation = LOOK_LEFT_EXTENT;
|
||||
m_bRotatingLeft = false;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Right:
|
||||
m_fTargetRotation = LOOK_RIGHT_EXTENT;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!bAnimate)
|
||||
{
|
||||
m_yRot = m_fTargetRotation;
|
||||
m_bAnimatingToFacing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fOriginalRotation = m_yRot;
|
||||
m_bAnimatingToFacing = true;
|
||||
m_framesAnimatingRotation = 0;
|
||||
}
|
||||
if (!bAnimate) {
|
||||
m_yRot = m_fTargetRotation;
|
||||
m_bAnimatingToFacing = false;
|
||||
} else {
|
||||
m_fOriginalRotation = m_yRot;
|
||||
m_bAnimatingToFacing = true;
|
||||
m_framesAnimatingRotation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::CycleNextAnimation()
|
||||
{
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
|
||||
if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
void UIControl_PlayerSkinPreview::CycleNextAnimation() {
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
|
||||
if (m_currentAnimation >= e_SkinPreviewAnimation_Count)
|
||||
m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
|
||||
{
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||
void UIControl_PlayerSkinPreview::CyclePreviousAnimation() {
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
if (m_currentAnimation < e_SkinPreviewAnimation_Walking)
|
||||
m_currentAnimation =
|
||||
(ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion* region) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glPushMatrix();
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glPushMatrix();
|
||||
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width/2;
|
||||
float yo = height;
|
||||
|
||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||
//glTranslatef(120.0f, 294, 0.0f);
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width / 2;
|
||||
float yo = height;
|
||||
|
||||
float ss;
|
||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||
// glTranslatef(120.0f, 294, 0.0f);
|
||||
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = width / (m_fScreenWidth / m_fScreenHeight);
|
||||
float ss;
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = width / (m_fScreenWidth / m_fScreenHeight);
|
||||
|
||||
//glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
//glRotatef(-45 - 90, 0, 1, 0);
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
|
||||
glRotatef(-(float)m_xRot, 1, 0, 0);
|
||||
// glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
// glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
glRotatef(-(float)m_xRot, 1, 0, 0);
|
||||
|
||||
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
|
||||
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
|
||||
if (renderer != NULL)
|
||||
{
|
||||
// 4J-PB - any additional parts to turn on for this player (skin dependent)
|
||||
//std::vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in
|
||||
// split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
|
||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||
{
|
||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
||||
{
|
||||
ModelPart *pModelPart=*it;
|
||||
// EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0,
|
||||
// 0, 0, 0, 1);
|
||||
EntityRenderer* renderer =
|
||||
EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
|
||||
if (renderer != NULL) {
|
||||
// 4J-PB - any additional parts to turn on for this player (skin
|
||||
// dependent)
|
||||
// std::vector<ModelPart *>
|
||||
// *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
|
||||
pModelPart->visible=true;
|
||||
}
|
||||
}
|
||||
if (m_pvAdditionalModelParts && m_pvAdditionalModelParts->size() != 0) {
|
||||
for (AUTO_VAR(it, m_pvAdditionalModelParts->begin());
|
||||
it != m_pvAdditionalModelParts->end(); ++it) {
|
||||
ModelPart* pModelPart = *it;
|
||||
|
||||
render(renderer,0,0,0,0,1);
|
||||
//renderer->postRender(entity, x, y, z, rot, a);
|
||||
pModelPart->visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
// hide the additional parts
|
||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||
{
|
||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
||||
{
|
||||
ModelPart *pModelPart=*it;
|
||||
render(renderer, 0, 0, 0, 0, 1);
|
||||
// renderer->postRender(entity, x, y, z, rot, a);
|
||||
|
||||
pModelPart->visible=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// hide the additional parts
|
||||
if (m_pvAdditionalModelParts && m_pvAdditionalModelParts->size() != 0) {
|
||||
for (AUTO_VAR(it, m_pvAdditionalModelParts->begin());
|
||||
it != m_pvAdditionalModelParts->end(); ++it) {
|
||||
ModelPart* pModelPart = *it;
|
||||
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
pModelPart->visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
// 4J Stu - Modified version of MobRenderer::render that does not require an actual entity
|
||||
void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
// 4J Stu - Modified version of MobRenderer::render that does not require an
|
||||
// actual entity
|
||||
void UIControl_PlayerSkinPreview::render(EntityRenderer* renderer, double x,
|
||||
double y, double z, float rot,
|
||||
float a) {
|
||||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
HumanoidModel *model = (HumanoidModel *)renderer->getModel();
|
||||
HumanoidModel* model = (HumanoidModel*)renderer->getModel();
|
||||
|
||||
//getAttackAnim(mob, a);
|
||||
//if (armor != NULL) armor->attackTime = model->attackTime;
|
||||
//model->riding = mob->isRiding();
|
||||
//if (armor != NULL) armor->riding = model->riding;
|
||||
// getAttackAnim(mob, a);
|
||||
// if (armor != NULL) armor->attackTime = model->attackTime;
|
||||
// model->riding = mob->isRiding();
|
||||
// if (armor != NULL) armor->riding = model->riding;
|
||||
|
||||
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
model->idle = false;
|
||||
model->eating = false;
|
||||
model->eating_swing = 0;
|
||||
model->eating_t = 0;
|
||||
model->young = false;
|
||||
model->riding = false;
|
||||
// 4J Stu - Remember to reset these values once the rendering is done if you
|
||||
// add another one
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
model->idle = false;
|
||||
model->eating = false;
|
||||
model->eating_swing = 0;
|
||||
model->eating_t = 0;
|
||||
model->young = false;
|
||||
model->riding = false;
|
||||
|
||||
model->m_uiAnimOverrideBitmask = m_uiAnimOverrideBitmask;
|
||||
model->m_uiAnimOverrideBitmask = m_uiAnimOverrideBitmask;
|
||||
|
||||
if( !m_bAnimatingToFacing )
|
||||
{
|
||||
switch( m_currentAnimation )
|
||||
{
|
||||
case e_SkinPreviewAnimation_Sneaking:
|
||||
model->sneaking = true;
|
||||
break;
|
||||
case e_SkinPreviewAnimation_Attacking:
|
||||
model->holdingRightHand = true;
|
||||
m_swingTime++;
|
||||
if (m_swingTime >= (Player::SWING_DURATION * 3) )
|
||||
{
|
||||
m_swingTime = 0;
|
||||
}
|
||||
model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
if (!m_bAnimatingToFacing) {
|
||||
switch (m_currentAnimation) {
|
||||
case e_SkinPreviewAnimation_Sneaking:
|
||||
model->sneaking = true;
|
||||
break;
|
||||
case e_SkinPreviewAnimation_Attacking:
|
||||
model->holdingRightHand = true;
|
||||
m_swingTime++;
|
||||
if (m_swingTime >= (Player::SWING_DURATION * 3)) {
|
||||
m_swingTime = 0;
|
||||
}
|
||||
model->attackTime =
|
||||
m_swingTime / (float)(Player::SWING_DURATION * 3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
float bodyRot =
|
||||
m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a);
|
||||
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
|
||||
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
|
||||
|
||||
float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a);
|
||||
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
|
||||
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
|
||||
// setupPosition(mob, x, y, z);
|
||||
// is equivalent to
|
||||
glTranslatef((float)x, (float)y, (float)z);
|
||||
|
||||
//setupPosition(mob, x, y, z);
|
||||
// is equivalent to
|
||||
glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
//float bob = getBob(mob, a);
|
||||
// float bob = getBob(mob, a);
|
||||
#ifdef SKIN_PREVIEW_BOB_ANIM
|
||||
float bob = (m_bobTick + a)/2;
|
||||
float bob = (m_bobTick + a) / 2;
|
||||
|
||||
++m_bobTick;
|
||||
if(m_bobTick>=360*2) m_bobTick = 0;
|
||||
++m_bobTick;
|
||||
if (m_bobTick >= 360 * 2) m_bobTick = 0;
|
||||
#else
|
||||
float bob = 0.0f;
|
||||
float bob = 0.0f;
|
||||
#endif
|
||||
|
||||
//setupRotations(mob, bob, bodyRot, a);
|
||||
// is equivalent to
|
||||
glRotatef(180 - bodyRot, 0, 1, 0);
|
||||
// setupRotations(mob, bob, bodyRot, a);
|
||||
// is equivalent to
|
||||
glRotatef(180 - bodyRot, 0, 1, 0);
|
||||
|
||||
float _scale = 1 / 16.0f;
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glScalef(-1, -1, 1);
|
||||
float _scale = 1 / 16.0f;
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glScalef(-1, -1, 1);
|
||||
|
||||
//scale(mob, a);
|
||||
// is equivalent to
|
||||
float s = 15 / 16.0f;
|
||||
glScalef(s, s, s);
|
||||
// scale(mob, a);
|
||||
// is equivalent to
|
||||
float s = 15 / 16.0f;
|
||||
glScalef(s, s, s);
|
||||
|
||||
glTranslatef(0, -24 * _scale - 0.125f / 16.0f, 0);
|
||||
glTranslatef(0, -24 * _scale - 0.125f / 16.0f, 0);
|
||||
|
||||
#ifdef SKIN_PREVIEW_WALKING_ANIM
|
||||
m_walkAnimSpeedO = m_walkAnimSpeed;
|
||||
m_walkAnimSpeed += (0.1f - m_walkAnimSpeed) * 0.4f;
|
||||
m_walkAnimPos += m_walkAnimSpeed;
|
||||
float ws = m_walkAnimSpeedO + (m_walkAnimSpeed - m_walkAnimSpeedO) * a;
|
||||
float wp = m_walkAnimPos - m_walkAnimSpeed * (1 - a);
|
||||
m_walkAnimSpeedO = m_walkAnimSpeed;
|
||||
m_walkAnimSpeed += (0.1f - m_walkAnimSpeed) * 0.4f;
|
||||
m_walkAnimPos += m_walkAnimSpeed;
|
||||
float ws = m_walkAnimSpeedO + (m_walkAnimSpeed - m_walkAnimSpeedO) * a;
|
||||
float wp = m_walkAnimPos - m_walkAnimSpeed * (1 - a);
|
||||
#else
|
||||
float ws = 0;
|
||||
float wp = 0;
|
||||
float ws = 0;
|
||||
float wp = 0;
|
||||
#endif
|
||||
|
||||
if (ws > 1) ws = 1;
|
||||
if (ws > 1) ws = 1;
|
||||
|
||||
MemSect(31);
|
||||
bindTexture(m_customTextureUrl, m_backupTexture);
|
||||
MemSect(0);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
MemSect(31);
|
||||
bindTexture(m_customTextureUrl, m_backupTexture);
|
||||
MemSect(0);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
||||
//model->prepareMobModel(mob, wp, ws, a);
|
||||
model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
|
||||
/*for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmor(mob, i, a))
|
||||
{
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
}
|
||||
}*/
|
||||
// model->prepareMobModel(mob, wp, ws, a);
|
||||
model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale,
|
||||
true);
|
||||
/*for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmor(mob, i, a))
|
||||
{
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
}
|
||||
}*/
|
||||
|
||||
//additionalRendering(mob, a);
|
||||
if (bindTexture(m_capeTextureUrl, L"" ))
|
||||
{
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, 2 / 16.0f);
|
||||
// additionalRendering(mob, a);
|
||||
if (bindTexture(m_capeTextureUrl, L"")) {
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, 2 / 16.0f);
|
||||
|
||||
double xd = 0;//(mob->xCloakO + (mob->xCloak - mob->xCloakO) * a) - (mob->xo + (mob->x - mob->xo) * a);
|
||||
double yd = 0;//(mob->yCloakO + (mob->yCloak - mob->yCloakO) * a) - (mob->yo + (mob->y - mob->yo) * a);
|
||||
double zd = 0;//(mob->zCloakO + (mob->zCloak - mob->zCloakO) * a) - (mob->zo + (mob->z - mob->zo) * a);
|
||||
double xd = 0; //(mob->xCloakO + (mob->xCloak - mob->xCloakO) * a) -
|
||||
//(mob->xo + (mob->x - mob->xo) * a);
|
||||
double yd = 0; //(mob->yCloakO + (mob->yCloak - mob->yCloakO) * a) -
|
||||
//(mob->yo + (mob->y - mob->yo) * a);
|
||||
double zd = 0; //(mob->zCloakO + (mob->zCloak - mob->zCloakO) * a) -
|
||||
//(mob->zo + (mob->z - mob->zo) * a);
|
||||
|
||||
float yr = 1;//mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a;
|
||||
float yr = 1; // mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a;
|
||||
|
||||
double xa = sin(yr * PI / 180);
|
||||
double za = -cos(yr * PI / 180);
|
||||
double xa = sin(yr * PI / 180);
|
||||
double za = -cos(yr * PI / 180);
|
||||
|
||||
float flap = (float) yd * 10;
|
||||
if (flap < -6) flap = -6;
|
||||
if (flap > 32) flap = 32;
|
||||
float lean = (float) (xd * xa + zd * za) * 100;
|
||||
float lean2 = (float) (xd * za - zd * xa) * 100;
|
||||
if (lean < 0) lean = 0;
|
||||
float flap = (float)yd * 10;
|
||||
if (flap < -6) flap = -6;
|
||||
if (flap > 32) flap = 32;
|
||||
float lean = (float)(xd * xa + zd * za) * 100;
|
||||
float lean2 = (float)(xd * za - zd * xa) * 100;
|
||||
if (lean < 0) lean = 0;
|
||||
|
||||
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a;
|
||||
// float pow = 1;//mob->oBob + (bob - mob->oBob) * a;
|
||||
|
||||
flap += 1;//sin((mob->walkDistO + (mob->walkDist - mob->walkDistO) * a) * 6) * 32 * pow;
|
||||
if (model->sneaking)
|
||||
{
|
||||
flap += 25;
|
||||
}
|
||||
flap += 1; // sin((mob->walkDistO + (mob->walkDist - mob->walkDistO) *
|
||||
// a) * 6) * 32 * pow;
|
||||
if (model->sneaking) {
|
||||
flap += 25;
|
||||
}
|
||||
|
||||
glRotatef(6.0f + lean / 2 + flap, 1, 0, 0);
|
||||
glRotatef(lean2 / 2, 0, 0, 1);
|
||||
glRotatef(-lean2 / 2, 0, 1, 0);
|
||||
glRotatef(180, 0, 1, 0);
|
||||
model->renderCloak(1 / 16.0f,true);
|
||||
glPopMatrix();
|
||||
}
|
||||
/*
|
||||
float br = mob->getBrightness(a);
|
||||
int overlayColor = getOverlayColor(mob, br, a);
|
||||
glRotatef(6.0f + lean / 2 + flap, 1, 0, 0);
|
||||
glRotatef(lean2 / 2, 0, 0, 1);
|
||||
glRotatef(-lean2 / 2, 0, 1, 0);
|
||||
glRotatef(180, 0, 1, 0);
|
||||
model->renderCloak(1 / 16.0f, true);
|
||||
glPopMatrix();
|
||||
}
|
||||
/*
|
||||
float br = mob->getBrightness(a);
|
||||
int overlayColor = getOverlayColor(mob, br, a);
|
||||
|
||||
if (((overlayColor >> 24) & 0xff) > 0 || mob->hurtTime > 0 || mob->deathTime > 0)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
if (((overlayColor >> 24) & 0xff) > 0 || mob->hurtTime > 0 || mob->deathTime
|
||||
> 0)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
|
||||
// 4J - changed these renders to not use the compiled version of their models, because otherwise the render states set
|
||||
// about (in particular the depth & alpha test) don't work with our command buffer versions
|
||||
if (mob->hurtTime > 0 || mob->deathTime > 0)
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 4J - changed these renders to not use the compiled version of their
|
||||
models, because otherwise the render states set
|
||||
// about (in particular the depth & alpha test) don't work with our command
|
||||
buffer versions if (mob->hurtTime > 0 || mob->deathTime > 0)
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (((overlayColor >> 24) & 0xff) > 0)
|
||||
{
|
||||
float r = ((overlayColor >> 16) & 0xff) / 255.0f;
|
||||
float g = ((overlayColor >> 8) & 0xff) / 255.0f;
|
||||
float b = ((overlayColor) & 0xff) / 255.0f;
|
||||
float aa = ((overlayColor >> 24) & 0xff) / 255.0f;
|
||||
glColor4f(r, g, b, aa);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(r, g, b, aa);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((overlayColor >> 24) & 0xff) > 0)
|
||||
{
|
||||
float r = ((overlayColor >> 16) & 0xff) / 255.0f;
|
||||
float g = ((overlayColor >> 8) & 0xff) / 255.0f;
|
||||
float b = ((overlayColor) & 0xff) / 255.0f;
|
||||
float aa = ((overlayColor >> 24) & 0xff) / 255.0f;
|
||||
glColor4f(r, g, b, aa);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(r, g, b, aa);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
*/
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
*/
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
|
||||
MemSect(31);
|
||||
//renderName(mob, x, y, z);
|
||||
MemSect(0);
|
||||
MemSect(31);
|
||||
// renderName(mob, x, y, z);
|
||||
MemSect(0);
|
||||
|
||||
// Reset the model values to stop the changes we made here affecting anything in game (like the player hand render)
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
// Reset the model values to stop the changes we made here affecting
|
||||
// anything in game (like the player hand render)
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
}
|
||||
|
||||
bool UIControl_PlayerSkinPreview::bindTexture(const std::wstring& urlTexture, int backupTexture)
|
||||
{
|
||||
Textures *t = Minecraft::GetInstance()->textures;
|
||||
bool UIControl_PlayerSkinPreview::bindTexture(const std::wstring& urlTexture,
|
||||
int backupTexture) {
|
||||
Textures* t = Minecraft::GetInstance()->textures;
|
||||
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
|
||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
// int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
t->bind(id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (id >= 0) {
|
||||
t->bind(id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool UIControl_PlayerSkinPreview::bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture)
|
||||
{
|
||||
Textures *t = Minecraft::GetInstance()->textures;
|
||||
bool UIControl_PlayerSkinPreview::bindTexture(
|
||||
const std::wstring& urlTexture, const std::wstring& backupTexture) {
|
||||
Textures* t = Minecraft::GetInstance()->textures;
|
||||
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
|
||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
// int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
t->bind(id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (id >= 0) {
|
||||
t->bind(id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,85 +8,101 @@
|
||||
class ModelPart;
|
||||
class EntityRenderer;
|
||||
|
||||
class UIControl_PlayerSkinPreview : public UIControl
|
||||
{
|
||||
class UIControl_PlayerSkinPreview : public UIControl {
|
||||
private:
|
||||
static const int LOOK_LEFT_EXTENT = 45;
|
||||
static const int LOOK_RIGHT_EXTENT = -45;
|
||||
static const int LOOK_LEFT_EXTENT = 45;
|
||||
static const int LOOK_RIGHT_EXTENT = -45;
|
||||
|
||||
static const int CHANGING_SKIN_FRAMES = 15;
|
||||
static const int CHANGING_SKIN_FRAMES = 15;
|
||||
|
||||
enum ESkinPreviewAnimations
|
||||
{
|
||||
e_SkinPreviewAnimation_Walking,
|
||||
e_SkinPreviewAnimation_Sneaking,
|
||||
e_SkinPreviewAnimation_Attacking,
|
||||
enum ESkinPreviewAnimations {
|
||||
e_SkinPreviewAnimation_Walking,
|
||||
e_SkinPreviewAnimation_Sneaking,
|
||||
e_SkinPreviewAnimation_Attacking,
|
||||
|
||||
e_SkinPreviewAnimation_Count,
|
||||
};
|
||||
e_SkinPreviewAnimation_Count,
|
||||
};
|
||||
|
||||
bool m_bDirty;
|
||||
float m_fScale,m_fAlpha;
|
||||
bool m_bDirty;
|
||||
float m_fScale, m_fAlpha;
|
||||
|
||||
std::wstring m_customTextureUrl;
|
||||
TEXTURE_NAME m_backupTexture;
|
||||
std::wstring m_capeTextureUrl;
|
||||
unsigned int m_uiAnimOverrideBitmask;
|
||||
std::wstring m_customTextureUrl;
|
||||
TEXTURE_NAME m_backupTexture;
|
||||
std::wstring m_capeTextureUrl;
|
||||
unsigned int m_uiAnimOverrideBitmask;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
float m_fScreenWidth, m_fScreenHeight;
|
||||
float m_fRawWidth, m_fRawHeight;
|
||||
|
||||
int m_yRot,m_xRot;
|
||||
int m_yRot, m_xRot;
|
||||
|
||||
float m_bobTick;
|
||||
float m_bobTick;
|
||||
|
||||
float m_walkAnimSpeedO;
|
||||
float m_walkAnimSpeed;
|
||||
float m_walkAnimPos;
|
||||
float m_walkAnimSpeedO;
|
||||
float m_walkAnimSpeed;
|
||||
float m_walkAnimPos;
|
||||
|
||||
bool m_bAutoRotate, m_bRotatingLeft;
|
||||
std::uint8_t m_rotateTick;
|
||||
float m_fTargetRotation, m_fOriginalRotation;
|
||||
int m_framesAnimatingRotation;
|
||||
bool m_bAnimatingToFacing;
|
||||
bool m_bAutoRotate, m_bRotatingLeft;
|
||||
std::uint8_t m_rotateTick;
|
||||
float m_fTargetRotation, m_fOriginalRotation;
|
||||
int m_framesAnimatingRotation;
|
||||
bool m_bAnimatingToFacing;
|
||||
|
||||
float m_swingTime;
|
||||
float m_swingTime;
|
||||
|
||||
ESkinPreviewAnimations m_currentAnimation;
|
||||
// std::vector<Model::SKIN_BOX *> *m_pvAdditionalBoxes;
|
||||
std::vector<ModelPart*>* m_pvAdditionalModelParts;
|
||||
|
||||
ESkinPreviewAnimations m_currentAnimation;
|
||||
//std::vector<Model::SKIN_BOX *> *m_pvAdditionalBoxes;
|
||||
std::vector<ModelPart *> *m_pvAdditionalModelParts;
|
||||
public:
|
||||
enum ESkinPreviewFacing
|
||||
{
|
||||
e_SkinPreviewFacing_Forward,
|
||||
e_SkinPreviewFacing_Left,
|
||||
e_SkinPreviewFacing_Right,
|
||||
};
|
||||
enum ESkinPreviewFacing {
|
||||
e_SkinPreviewFacing_Forward,
|
||||
e_SkinPreviewFacing_Left,
|
||||
e_SkinPreviewFacing_Right,
|
||||
};
|
||||
|
||||
UIControl_PlayerSkinPreview();
|
||||
UIControl_PlayerSkinPreview();
|
||||
|
||||
virtual void tick();
|
||||
virtual void tick();
|
||||
|
||||
void render(IggyCustomDrawCallbackRegion *region);
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
|
||||
void SetTexture(const std::wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR);
|
||||
void SetCapeTexture(const std::wstring &url) { m_capeTextureUrl = url; }
|
||||
void ResetRotation() { m_xRot = 0; m_yRot = 0; }
|
||||
void IncrementYRotation() { m_yRot = (m_yRot+4); if(m_yRot >= 180) m_yRot = -180; }
|
||||
void DecrementYRotation() { m_yRot = (m_yRot-4); if(m_yRot <= -180) m_yRot = 180; }
|
||||
void IncrementXRotation() { m_xRot = (m_xRot+2); if(m_xRot > 22) m_xRot = 22; }
|
||||
void DecrementXRotation() { m_xRot = (m_xRot-2); if(m_xRot < -22) m_xRot = -22; }
|
||||
void SetAutoRotate(bool autoRotate) { m_bAutoRotate = autoRotate; }
|
||||
void SetFacing(ESkinPreviewFacing facing, bool bAnimate = false);
|
||||
void SetTexture(const std::wstring& url,
|
||||
TEXTURE_NAME backupTexture = TN_MOB_CHAR);
|
||||
void SetCapeTexture(const std::wstring& url) { m_capeTextureUrl = url; }
|
||||
void ResetRotation() {
|
||||
m_xRot = 0;
|
||||
m_yRot = 0;
|
||||
}
|
||||
void IncrementYRotation() {
|
||||
m_yRot = (m_yRot + 4);
|
||||
if (m_yRot >= 180) m_yRot = -180;
|
||||
}
|
||||
void DecrementYRotation() {
|
||||
m_yRot = (m_yRot - 4);
|
||||
if (m_yRot <= -180) m_yRot = 180;
|
||||
}
|
||||
void IncrementXRotation() {
|
||||
m_xRot = (m_xRot + 2);
|
||||
if (m_xRot > 22) m_xRot = 22;
|
||||
}
|
||||
void DecrementXRotation() {
|
||||
m_xRot = (m_xRot - 2);
|
||||
if (m_xRot < -22) m_xRot = -22;
|
||||
}
|
||||
void SetAutoRotate(bool autoRotate) { m_bAutoRotate = autoRotate; }
|
||||
void SetFacing(ESkinPreviewFacing facing, bool bAnimate = false);
|
||||
|
||||
void CycleNextAnimation();
|
||||
void CyclePreviousAnimation();
|
||||
void CycleNextAnimation();
|
||||
void CyclePreviousAnimation();
|
||||
|
||||
bool m_incXRot, m_decXRot;
|
||||
bool m_incYRot, m_decYRot;
|
||||
bool m_incXRot, m_decXRot;
|
||||
bool m_incYRot, m_decYRot;
|
||||
|
||||
private:
|
||||
void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a);
|
||||
bool bindTexture(const std::wstring& urlTexture, int backupTexture);
|
||||
bool bindTexture(const std::wstring& urlTexture, const std::wstring& backupTexture);
|
||||
void render(EntityRenderer* renderer, double x, double y, double z,
|
||||
float rot, float a);
|
||||
bool bindTexture(const std::wstring& urlTexture, int backupTexture);
|
||||
bool bindTexture(const std::wstring& urlTexture,
|
||||
const std::wstring& backupTexture);
|
||||
};
|
||||
|
||||
@@ -2,85 +2,87 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_Progress.h"
|
||||
|
||||
UIControl_Progress::UIControl_Progress()
|
||||
{
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_current = 0;
|
||||
m_lastPercent = 0.0f;
|
||||
m_showingBar = true;
|
||||
UIControl_Progress::UIControl_Progress() {
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_current = 0;
|
||||
m_lastPercent = 0.0f;
|
||||
m_showingBar = true;
|
||||
}
|
||||
|
||||
bool UIControl_Progress::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eProgress);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
bool UIControl_Progress::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eProgress);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//Progress specific initialisers
|
||||
m_setProgressFunc = registerFastName(L"setProgress");
|
||||
m_showBarFunc = registerFastName(L"ShowBar");
|
||||
// Progress specific initialisers
|
||||
m_setProgressFunc = registerFastName(L"setProgress");
|
||||
m_showBarFunc = registerFastName(L"ShowBar");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Progress::init(const std::wstring &label, int id, int min, int max, int current)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_current = current;
|
||||
void UIControl_Progress::init(const std::wstring& label, int id, int min,
|
||||
int max, int current) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_current = current;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_Progress::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label, m_id, m_min, m_max, m_current);
|
||||
void UIControl_Progress::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label, m_id, m_min, m_max, m_current);
|
||||
}
|
||||
|
||||
void UIControl_Progress::setProgress(int current)
|
||||
{
|
||||
m_current = current;
|
||||
void UIControl_Progress::setProgress(int current) {
|
||||
m_current = current;
|
||||
|
||||
float percent = (float)((m_current-m_min))/(m_max-m_min);
|
||||
float percent = (float)((m_current - m_min)) / (m_max - m_min);
|
||||
|
||||
if(percent != m_lastPercent)
|
||||
{
|
||||
m_lastPercent = percent;
|
||||
//app.DebugPrintf("Setting progress value to %d/%f\n", m_current, percent);
|
||||
if (percent != m_lastPercent) {
|
||||
m_lastPercent = percent;
|
||||
// app.DebugPrintf("Setting progress value to %d/%f\n", m_current,
|
||||
// percent);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setProgressFunc , 1 , value );
|
||||
}
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_setProgressFunc, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_Progress::showBar(bool show)
|
||||
{
|
||||
if(show != m_showingBar)
|
||||
{
|
||||
m_showingBar = show;
|
||||
//app.DebugPrintf("Setting progress value to %d/%f\n", m_current, percent);
|
||||
void UIControl_Progress::showBar(bool show) {
|
||||
if (show != m_showingBar) {
|
||||
m_showingBar = show;
|
||||
// app.DebugPrintf("Setting progress value to %d/%f\n", m_current,
|
||||
// percent);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = show;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_showBarFunc , 1 , value );
|
||||
}
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = show;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_showBarFunc, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Progress : public UIControl_Base
|
||||
{
|
||||
class UIControl_Progress : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_setProgressFunc, m_showBarFunc;
|
||||
int m_min;
|
||||
int m_max;
|
||||
int m_current;
|
||||
float m_lastPercent;
|
||||
bool m_showingBar;
|
||||
IggyName m_setProgressFunc, m_showBarFunc;
|
||||
int m_min;
|
||||
int m_max;
|
||||
int m_current;
|
||||
float m_lastPercent;
|
||||
bool m_showingBar;
|
||||
|
||||
public:
|
||||
UIControl_Progress();
|
||||
UIControl_Progress();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id, int min, int max, int current);
|
||||
virtual void ReInit();
|
||||
void init(const std::wstring& label, int id, int min, int max, int current);
|
||||
virtual void ReInit();
|
||||
|
||||
void setProgress(int current);
|
||||
void showBar(bool show);
|
||||
void setProgress(int current);
|
||||
void showBar(bool show);
|
||||
};
|
||||
@@ -2,113 +2,115 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_SaveList.h"
|
||||
|
||||
bool UIControl_SaveList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eSaveList);
|
||||
bool success = UIControl_ButtonList::setupControl(scene,parent,controlName);
|
||||
bool UIControl_SaveList::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eSaveList);
|
||||
bool success =
|
||||
UIControl_ButtonList::setupControl(scene, parent, controlName);
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_funcSetTextureName = registerFastName(L"SetTextureName");
|
||||
// SlotList specific initialisers
|
||||
m_funcSetTextureName = registerFastName(L"SetTextureName");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::wstring &label)
|
||||
{
|
||||
addItem(label, L"");
|
||||
void UIControl_SaveList::addItem(const std::wstring& label) {
|
||||
addItem(label, L"");
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::string &label)
|
||||
{
|
||||
addItem(label, L"");
|
||||
void UIControl_SaveList::addItem(const std::string& label) {
|
||||
addItem(label, L"");
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::wstring &label, int data)
|
||||
{
|
||||
addItem(label, L"", data);
|
||||
void UIControl_SaveList::addItem(const std::wstring& label, int data) {
|
||||
addItem(label, L"", data);
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::string &label, int data)
|
||||
{
|
||||
addItem(label, L"", data);
|
||||
void UIControl_SaveList::addItem(const std::string& label, int data) {
|
||||
addItem(label, L"", data);
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::string &label, const std::wstring &iconName)
|
||||
{
|
||||
addItem(label, iconName, m_itemCount);
|
||||
++m_itemCount;
|
||||
void UIControl_SaveList::addItem(const std::string& label,
|
||||
const std::wstring& iconName) {
|
||||
addItem(label, iconName, m_itemCount);
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::wstring &label, const std::wstring &iconName)
|
||||
{
|
||||
addItem(label, iconName, m_itemCount);
|
||||
++m_itemCount;
|
||||
void UIControl_SaveList::addItem(const std::wstring& label,
|
||||
const std::wstring& iconName) {
|
||||
addItem(label, iconName, m_itemCount);
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::string &label, const std::wstring &iconName, int data)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_SaveList::addItem(const std::string& label,
|
||||
const std::wstring& iconName, int data) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = (S32)label.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convName.c_str();
|
||||
stringVal2.length = convName.length();
|
||||
value[2].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[2].string16 = stringVal2;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value );
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convName.c_str();
|
||||
stringVal2.length = convName.length();
|
||||
value[2].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[2].string16 = stringVal2;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 3, value);
|
||||
}
|
||||
|
||||
void UIControl_SaveList::addItem(const std::wstring &label, const std::wstring &iconName, int data)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_SaveList::addItem(const std::wstring& label,
|
||||
const std::wstring& iconName, int data) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = (S32)convLabel.length();
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = m_itemCount;
|
||||
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convName.c_str();
|
||||
stringVal2.length = convName.length();
|
||||
value[2].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[2].string16 = stringVal2;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addNewItemFunc , 3 , value );
|
||||
IggyStringUTF16 stringVal2;
|
||||
stringVal2.string = convName.c_str();
|
||||
stringVal2.length = convName.length();
|
||||
value[2].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[2].string16 = stringVal2;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addNewItemFunc, 3, value);
|
||||
}
|
||||
|
||||
void UIControl_SaveList::setTextureName(int iId, const std::wstring &iconName)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
void UIControl_SaveList::setTextureName(int iId, const std::wstring& iconName) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iId;
|
||||
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
const std::u16string convName = convWstringToU16string(iconName);
|
||||
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetTextureName , 2 , value );
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetTextureName, 2, value);
|
||||
}
|
||||
|
||||
@@ -2,28 +2,29 @@
|
||||
|
||||
#include "UIControl_ButtonList.h"
|
||||
|
||||
class UIControl_SaveList : public UIControl_ButtonList
|
||||
{
|
||||
class UIControl_SaveList : public UIControl_ButtonList {
|
||||
private:
|
||||
IggyName m_funcSetTextureName;
|
||||
IggyName m_funcSetTextureName;
|
||||
|
||||
public:
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
using UIControl_ButtonList::addItem;
|
||||
using UIControl_ButtonList::addItem;
|
||||
|
||||
void addItem(const std::wstring &label);
|
||||
void addItem(const std::string &label);
|
||||
void addItem(const std::wstring& label);
|
||||
void addItem(const std::string& label);
|
||||
|
||||
void addItem(const std::wstring &label, int data);
|
||||
void addItem(const std::string &label, int data);
|
||||
void addItem(const std::wstring& label, int data);
|
||||
void addItem(const std::string& label, int data);
|
||||
|
||||
void addItem(const std::string &label, const std::wstring &iconName);
|
||||
void addItem(const std::wstring &label, const std::wstring &iconName);
|
||||
void setTextureName(int iId, const std::wstring &iconName);
|
||||
void addItem(const std::string& label, const std::wstring& iconName);
|
||||
void addItem(const std::wstring& label, const std::wstring& iconName);
|
||||
void setTextureName(int iId, const std::wstring& iconName);
|
||||
|
||||
private:
|
||||
void addItem(const std::string &label, const std::wstring &iconName, int data);
|
||||
void addItem(const std::wstring &label, const std::wstring &iconName, int data);
|
||||
|
||||
void addItem(const std::string& label, const std::wstring& iconName,
|
||||
int data);
|
||||
void addItem(const std::wstring& label, const std::wstring& iconName,
|
||||
int data);
|
||||
};
|
||||
@@ -2,120 +2,116 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_Slider.h"
|
||||
|
||||
UIControl_Slider::UIControl_Slider()
|
||||
{
|
||||
m_id = 0;
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_current = 0;
|
||||
UIControl_Slider::UIControl_Slider() {
|
||||
m_id = 0;
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_current = 0;
|
||||
}
|
||||
|
||||
bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eSlider);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
bool UIControl_Slider::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eSlider);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//Slider specific initialisers
|
||||
m_funcSetRelativeSliderPos = registerFastName(L"SetRelativeSliderPos");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
// Slider specific initialisers
|
||||
m_funcSetRelativeSliderPos = registerFastName(L"SetRelativeSliderPos");
|
||||
m_funcGetRealWidth = registerFastName(L"GetRealWidth");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Slider::init(const std::wstring &label, int id, int min, int max, int current)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_current = current;
|
||||
void UIControl_Slider::init(const std::wstring& label, int id, int min, int max,
|
||||
int current) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_current = current;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[5];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[5];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (int)id;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = (int)id;
|
||||
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = (int)min;
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = (int)min;
|
||||
|
||||
value[3].type = IGGY_DATATYPE_number;
|
||||
value[3].number = (int)max;
|
||||
value[3].type = IGGY_DATATYPE_number;
|
||||
value[3].number = (int)max;
|
||||
|
||||
value[4].type = IGGY_DATATYPE_number;
|
||||
value[4].number = (int)current;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 5 , value );
|
||||
value[4].type = IGGY_DATATYPE_number;
|
||||
value[4].number = (int)current;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 5, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add slider to the vita touch box list
|
||||
// 4J-TomK - add slider to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_Slider::handleSliderMove(int newValue)
|
||||
{
|
||||
if (m_current!=newValue)
|
||||
{
|
||||
ui.PlayUISFX(eSFX_Scroll);
|
||||
m_current = newValue;
|
||||
void UIControl_Slider::handleSliderMove(int newValue) {
|
||||
if (m_current != newValue) {
|
||||
ui.PlayUISFX(eSFX_Scroll);
|
||||
m_current = newValue;
|
||||
|
||||
if(newValue < m_allPossibleLabels.size())
|
||||
{
|
||||
setLabel(m_allPossibleLabels[newValue]);
|
||||
}
|
||||
}
|
||||
if (newValue < m_allPossibleLabels.size()) {
|
||||
setLabel(m_allPossibleLabels[newValue]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_Slider::SetSliderTouchPos(float fTouchPos)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = fTouchPos;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetRelativeSliderPos , 1 , value );
|
||||
}
|
||||
|
||||
S32 UIControl_Slider::GetRealWidth()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth , 0 , NULL );
|
||||
|
||||
S32 iRealWidth = m_width;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
void UIControl_Slider::SetSliderTouchPos(float fTouchPos) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = fTouchPos;
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
m_parentScene->getMovie(), &result, getIggyValuePath(),
|
||||
m_funcSetRelativeSliderPos, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_Slider::setAllPossibleLabels(int labelCount, wchar_t labels[][256])
|
||||
{
|
||||
for(unsigned int i = 0; i < labelCount; ++i)
|
||||
{
|
||||
m_allPossibleLabels.push_back(labels[i]);
|
||||
}
|
||||
UIControl_Base::setAllPossibleLabels(labelCount, labels);
|
||||
S32 UIControl_Slider::GetRealWidth() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcGetRealWidth, 0, NULL);
|
||||
|
||||
S32 iRealWidth = m_width;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealWidth = (S32)result.number;
|
||||
}
|
||||
return iRealWidth;
|
||||
}
|
||||
|
||||
void UIControl_Slider::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
init(m_label, m_id, m_min, m_max, m_current);
|
||||
void UIControl_Slider::setAllPossibleLabels(int labelCount,
|
||||
wchar_t labels[][256]) {
|
||||
for (unsigned int i = 0; i < labelCount; ++i) {
|
||||
m_allPossibleLabels.push_back(labels[i]);
|
||||
}
|
||||
UIControl_Base::setAllPossibleLabels(labelCount, labels);
|
||||
}
|
||||
|
||||
void UIControl_Slider::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
init(m_label, m_id, m_min, m_max, m_current);
|
||||
}
|
||||
|
||||
@@ -2,31 +2,32 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Slider : public UIControl_Base
|
||||
{
|
||||
class UIControl_Slider : public UIControl_Base {
|
||||
private:
|
||||
//int m_id; // 4J-TomK this is part of class UIControl and doesn't need to be here!
|
||||
int m_min;
|
||||
int m_max;
|
||||
int m_current;
|
||||
// int m_id; // 4J-TomK this is part of class UIControl and doesn't need to
|
||||
// be here!
|
||||
int m_min;
|
||||
int m_max;
|
||||
int m_current;
|
||||
|
||||
std::vector<std::wstring> m_allPossibleLabels;
|
||||
std::vector<std::wstring> m_allPossibleLabels;
|
||||
|
||||
// 4J-TomK - function for setting slider position on touch
|
||||
IggyName m_funcSetRelativeSliderPos;
|
||||
IggyName m_funcGetRealWidth;
|
||||
// 4J-TomK - function for setting slider position on touch
|
||||
IggyName m_funcSetRelativeSliderPos;
|
||||
IggyName m_funcGetRealWidth;
|
||||
|
||||
public:
|
||||
UIControl_Slider();
|
||||
UIControl_Slider();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id, int min, int max, int current);
|
||||
void init(const std::wstring& label, int id, int min, int max, int current);
|
||||
|
||||
void handleSliderMove(int newValue);
|
||||
void SetSliderTouchPos(float fTouchPos);
|
||||
virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]);
|
||||
void handleSliderMove(int newValue);
|
||||
void SetSliderTouchPos(float fTouchPos);
|
||||
virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]);
|
||||
|
||||
S32 GetRealWidth();
|
||||
virtual void ReInit();
|
||||
S32 GetRealWidth();
|
||||
virtual void ReInit();
|
||||
};
|
||||
|
||||
@@ -2,92 +2,87 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_SlotList.h"
|
||||
|
||||
UIControl_SlotList::UIControl_SlotList()
|
||||
{
|
||||
m_lastHighlighted = -1;
|
||||
UIControl_SlotList::UIControl_SlotList() { m_lastHighlighted = -1; }
|
||||
|
||||
bool UIControl_SlotList::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eSlotList);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// SlotList specific initialisers
|
||||
m_addSlotFunc = registerFastName(L"addSlot");
|
||||
m_setRedBoxFunc = registerFastName(L"SetSlotRedBox");
|
||||
m_setHighlightFunc = registerFastName(L"SetSlotHighlight");
|
||||
|
||||
m_lastHighlighted = 0;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_SlotList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eSlotList);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_SlotList::addSlot(int id) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_addSlotFunc = registerFastName(L"addSlot");
|
||||
m_setRedBoxFunc = registerFastName(L"SetSlotRedBox");
|
||||
m_setHighlightFunc = registerFastName(L"SetSlotHighlight");
|
||||
|
||||
m_lastHighlighted = 0;
|
||||
|
||||
return success;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = false;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = false;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addSlotFunc, 3, value);
|
||||
}
|
||||
|
||||
void UIControl_SlotList::addSlot(int id)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = false;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = false;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addSlotFunc ,3 , value );
|
||||
void UIControl_SlotList::addSlots(int iStartValue, int iCount) {
|
||||
for (unsigned int i = iStartValue; i < iStartValue + iCount; ++i) {
|
||||
addSlot(i);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_SlotList::addSlots(int iStartValue, int iCount)
|
||||
{
|
||||
for(unsigned int i = iStartValue; i < iStartValue + iCount; ++i)
|
||||
{
|
||||
addSlot(i);
|
||||
}
|
||||
void UIControl_SlotList::setHighlightSlot(int index) {
|
||||
if (index != m_lastHighlighted) {
|
||||
if (m_lastHighlighted != -1) {
|
||||
setSlotHighlighted(m_lastHighlighted, false);
|
||||
}
|
||||
setSlotHighlighted(index, true);
|
||||
m_lastHighlighted = index;
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_SlotList::setSlotHighlighted(int index, bool highlight) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
|
||||
void UIControl_SlotList::setHighlightSlot(int index)
|
||||
{
|
||||
if(index != m_lastHighlighted)
|
||||
{
|
||||
if(m_lastHighlighted != -1)
|
||||
{
|
||||
setSlotHighlighted(m_lastHighlighted, false);
|
||||
}
|
||||
setSlotHighlighted(index, true);
|
||||
m_lastHighlighted = index;
|
||||
}
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = highlight;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_setHighlightFunc, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_SlotList::setSlotHighlighted(int index, bool highlight)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
void UIControl_SlotList::showSlotRedBox(int index, bool show) {
|
||||
// app.DebugPrintf("Setting red box at index %d to %s\n", index,
|
||||
// show?"on":"off");
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = highlight;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_setHighlightFunc , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = show;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_setRedBoxFunc, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_SlotList::showSlotRedBox(int index, bool show)
|
||||
{
|
||||
//app.DebugPrintf("Setting red box at index %d to %s\n", index, show?"on":"off");
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = index;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = show;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_setRedBoxFunc , 2, value );
|
||||
}
|
||||
|
||||
void UIControl_SlotList::setFocus(bool focus)
|
||||
{
|
||||
if(m_lastHighlighted != -1)
|
||||
{
|
||||
if(focus) setSlotHighlighted(m_lastHighlighted, true);
|
||||
else setSlotHighlighted(m_lastHighlighted, false);
|
||||
}
|
||||
void UIControl_SlotList::setFocus(bool focus) {
|
||||
if (m_lastHighlighted != -1) {
|
||||
if (focus)
|
||||
setSlotHighlighted(m_lastHighlighted, true);
|
||||
else
|
||||
setSlotHighlighted(m_lastHighlighted, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,27 +2,28 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_SlotList : public UIControl_Base
|
||||
{
|
||||
class UIControl_SlotList : public UIControl_Base {
|
||||
private:
|
||||
//IggyName m_addSlotFunc, m_getSlotFunc, m_setRedBoxFunc, m_setHighlightFunc;
|
||||
IggyName m_addSlotFunc, m_setRedBoxFunc, m_setHighlightFunc;
|
||||
// IggyName m_addSlotFunc, m_getSlotFunc, m_setRedBoxFunc,
|
||||
// m_setHighlightFunc;
|
||||
IggyName m_addSlotFunc, m_setRedBoxFunc, m_setHighlightFunc;
|
||||
|
||||
int m_lastHighlighted;
|
||||
int m_lastHighlighted;
|
||||
|
||||
public:
|
||||
UIControl_SlotList();
|
||||
UIControl_SlotList();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void addSlot(int id);
|
||||
void addSlots(int iStartValue, int iCount);
|
||||
void addSlot(int id);
|
||||
void addSlots(int iStartValue, int iCount);
|
||||
|
||||
void setHighlightSlot(int index);
|
||||
void showSlotRedBox(int index, bool show);
|
||||
void setHighlightSlot(int index);
|
||||
void showSlotRedBox(int index, bool show);
|
||||
|
||||
virtual void setFocus(bool focus);
|
||||
virtual void setFocus(bool focus);
|
||||
|
||||
private:
|
||||
void setSlotHighlighted(int index, bool highlight);
|
||||
void setSlotHighlighted(int index, bool highlight);
|
||||
};
|
||||
|
||||
@@ -2,123 +2,121 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_SpaceIndicatorBar.h"
|
||||
|
||||
UIControl_SpaceIndicatorBar::UIControl_SpaceIndicatorBar()
|
||||
{
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_currentSave = 0;
|
||||
m_currentTotal = 0;
|
||||
m_currentOffset = 0.0f;
|
||||
UIControl_SpaceIndicatorBar::UIControl_SpaceIndicatorBar() {
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_currentSave = 0;
|
||||
m_currentTotal = 0;
|
||||
m_currentOffset = 0.0f;
|
||||
}
|
||||
|
||||
bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eProgress);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
bool UIControl_SpaceIndicatorBar::setupControl(UIScene* scene,
|
||||
IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eProgress);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//Progress specific initialisers
|
||||
m_setSaveSizeFunc = registerFastName(L"setSaveGameSize");
|
||||
m_setTotalSizeFunc = registerFastName(L"setTotalSize");
|
||||
m_setSaveGameOffsetFunc = registerFastName(L"setSaveGameOffset");
|
||||
// Progress specific initialisers
|
||||
m_setSaveSizeFunc = registerFastName(L"setSaveGameSize");
|
||||
m_setTotalSizeFunc = registerFastName(L"setTotalSize");
|
||||
m_setSaveGameOffsetFunc = registerFastName(L"setSaveGameOffset");
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::init(const std::wstring &label, int id, __int64 min, __int64 max)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
void UIControl_SpaceIndicatorBar::init(const std::wstring& label, int id,
|
||||
__int64 min, __int64 max) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label, m_id, m_min, m_max);
|
||||
setSaveSize(m_currentSave);
|
||||
setTotalSize(m_currentTotal);
|
||||
setSaveGameOffset(m_currentOffset);
|
||||
void UIControl_SpaceIndicatorBar::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label, m_id, m_min, m_max);
|
||||
setSaveSize(m_currentSave);
|
||||
setTotalSize(m_currentTotal);
|
||||
setSaveGameOffset(m_currentOffset);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::reset()
|
||||
{
|
||||
m_sizeAndOffsets.clear();
|
||||
m_currentTotal = 0;
|
||||
setTotalSize(0);
|
||||
setSaveSize(0);
|
||||
setSaveGameOffset(0.0f);
|
||||
void UIControl_SpaceIndicatorBar::reset() {
|
||||
m_sizeAndOffsets.clear();
|
||||
m_currentTotal = 0;
|
||||
setTotalSize(0);
|
||||
setSaveSize(0);
|
||||
setSaveGameOffset(0.0f);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::addSave(__int64 size)
|
||||
{
|
||||
float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
void UIControl_SpaceIndicatorBar::addSave(__int64 size) {
|
||||
float startPercent = (float)((m_currentTotal - m_min)) / (m_max - m_min);
|
||||
|
||||
m_sizeAndOffsets.push_back( std::pair<__int64, float>(size, startPercent) );
|
||||
m_sizeAndOffsets.push_back(std::pair<__int64, float>(size, startPercent));
|
||||
|
||||
m_currentTotal += size;
|
||||
setTotalSize(m_currentTotal);
|
||||
m_currentTotal += size;
|
||||
setTotalSize(m_currentTotal);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::selectSave(int index)
|
||||
{
|
||||
if(index >= 0 && index < m_sizeAndOffsets.size())
|
||||
{
|
||||
std::pair<__int64,float> values = m_sizeAndOffsets[index];
|
||||
setSaveSize(values.first);
|
||||
setSaveGameOffset(values.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
setSaveSize(0);
|
||||
setSaveGameOffset(0);
|
||||
}
|
||||
void UIControl_SpaceIndicatorBar::selectSave(int index) {
|
||||
if (index >= 0 && index < m_sizeAndOffsets.size()) {
|
||||
std::pair<__int64, float> values = m_sizeAndOffsets[index];
|
||||
setSaveSize(values.first);
|
||||
setSaveGameOffset(values.second);
|
||||
} else {
|
||||
setSaveSize(0);
|
||||
setSaveGameOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
|
||||
{
|
||||
m_currentSave = size;
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) {
|
||||
m_currentSave = size;
|
||||
|
||||
float percent = (float)((m_currentSave-m_min))/(m_max-m_min);
|
||||
float percent = (float)((m_currentSave - m_min)) / (m_max - m_min);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value );
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_setSaveSizeFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size)
|
||||
{
|
||||
float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size) {
|
||||
float percent = (float)((m_currentTotal - m_min)) / (m_max - m_min);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setTotalSizeFunc , 1 , value );
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = percent;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_setTotalSizeFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setSaveGameOffset(float offset)
|
||||
{
|
||||
m_currentOffset = offset;
|
||||
void UIControl_SpaceIndicatorBar::setSaveGameOffset(float offset) {
|
||||
m_currentOffset = offset;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = m_currentOffset;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveGameOffsetFunc , 1 , value );
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = m_currentOffset;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_setSaveGameOffsetFunc, 1, value);
|
||||
}
|
||||
|
||||
@@ -2,32 +2,31 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_SpaceIndicatorBar : public UIControl_Base
|
||||
{
|
||||
class UIControl_SpaceIndicatorBar : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
|
||||
__int64 m_min;
|
||||
__int64 m_max;
|
||||
__int64 m_currentSave, m_currentTotal;
|
||||
float m_currentOffset;
|
||||
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
|
||||
__int64 m_min;
|
||||
__int64 m_max;
|
||||
__int64 m_currentSave, m_currentTotal;
|
||||
float m_currentOffset;
|
||||
|
||||
std::vector<std::pair<__int64,float> > m_sizeAndOffsets;
|
||||
std::vector<std::pair<__int64, float> > m_sizeAndOffsets;
|
||||
|
||||
public:
|
||||
UIControl_SpaceIndicatorBar();
|
||||
UIControl_SpaceIndicatorBar();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id, __int64 min, __int64 max);
|
||||
virtual void ReInit();
|
||||
void reset();
|
||||
|
||||
void addSave(__int64 size);
|
||||
void selectSave(int index);
|
||||
void init(const std::wstring& label, int id, __int64 min, __int64 max);
|
||||
virtual void ReInit();
|
||||
void reset();
|
||||
|
||||
void addSave(__int64 size);
|
||||
void selectSave(int index);
|
||||
|
||||
private:
|
||||
void setSaveSize(__int64 size);
|
||||
void setTotalSize(__int64 totalSize);
|
||||
void setSaveGameOffset(float offset);
|
||||
void setSaveSize(__int64 size);
|
||||
void setTotalSize(__int64 totalSize);
|
||||
void setSaveGameOffset(float offset);
|
||||
};
|
||||
@@ -2,84 +2,81 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_TextInput.h"
|
||||
|
||||
UIControl_TextInput::UIControl_TextInput()
|
||||
{
|
||||
m_bHasFocus = false;
|
||||
UIControl_TextInput::UIControl_TextInput() { m_bHasFocus = false; }
|
||||
|
||||
bool UIControl_TextInput::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eTextInput);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// TextInput specific initialisers
|
||||
m_textName = registerFastName(L"text");
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
m_funcSetCharLimit = registerFastName(L"SetCharLimit");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eTextInput);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_TextInput::init(const std::wstring& label, int id) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
||||
//TextInput specific initialisers
|
||||
m_textName = registerFastName(L"text");
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
m_funcSetCharLimit = registerFastName(L"SetCharLimit");
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
return success;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 2, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this buttonlist to the vita touch box list
|
||||
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_TextInput::init(const std::wstring &label, int id)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
void UIControl_TextInput::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 2 , value );
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this buttonlist to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
init(m_label, m_id);
|
||||
}
|
||||
|
||||
void UIControl_TextInput::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
void UIControl_TextInput::setFocus(bool focus) {
|
||||
if (m_bHasFocus != focus) {
|
||||
m_bHasFocus = focus;
|
||||
|
||||
init(m_label, m_id);
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = focus ? 0 : 1;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_funcChangeState, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_TextInput::setFocus(bool focus)
|
||||
{
|
||||
if(m_bHasFocus != focus)
|
||||
{
|
||||
m_bHasFocus = focus;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = focus?0:1;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value );
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_TextInput::SetCharLimit(int iLimit)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iLimit;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCharLimit , 1 , value );
|
||||
void UIControl_TextInput::SetCharLimit(int iLimit) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iLimit;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetCharLimit, 1, value);
|
||||
}
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_TextInput : public UIControl_Base
|
||||
{
|
||||
class UIControl_TextInput : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_textName, m_funcChangeState, m_funcSetCharLimit;
|
||||
bool m_bHasFocus;
|
||||
IggyName m_textName, m_funcChangeState, m_funcSetCharLimit;
|
||||
bool m_bHasFocus;
|
||||
|
||||
public:
|
||||
UIControl_TextInput();
|
||||
UIControl_TextInput();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id);
|
||||
void ReInit();
|
||||
void init(const std::wstring& label, int id);
|
||||
void ReInit();
|
||||
|
||||
virtual void setFocus(bool focus);
|
||||
virtual void setFocus(bool focus);
|
||||
|
||||
void SetCharLimit(int iLimit);
|
||||
void SetCharLimit(int iLimit);
|
||||
};
|
||||
@@ -2,148 +2,152 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_TexturePackList.h"
|
||||
|
||||
UIControl_TexturePackList::UIControl_TexturePackList()
|
||||
{
|
||||
UIControl_TexturePackList::UIControl_TexturePackList() {}
|
||||
|
||||
bool UIControl_TexturePackList::setupControl(UIScene* scene,
|
||||
IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eTexturePackList);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
// SlotList specific initialisers
|
||||
m_addPackFunc = registerFastName(L"addPack");
|
||||
m_clearSlotsFunc = registerFastName(L"removeAllItems");
|
||||
m_funcSelectSlot = registerFastName(L"SelectSlot");
|
||||
m_funcEnableSelector = registerFastName(L"EnableSelector");
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_TexturePackList::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eTexturePackList);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
void UIControl_TexturePackList::init(const std::wstring& label, int id) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
||||
//SlotList specific initialisers
|
||||
m_addPackFunc = registerFastName(L"addPack");
|
||||
m_clearSlotsFunc = registerFastName(L"removeAllItems");
|
||||
m_funcSelectSlot = registerFastName(L"SelectSlot");
|
||||
m_funcEnableSelector = registerFastName(L"EnableSelector");
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger");
|
||||
m_funcGetRealHeight = registerFastName(L"GetRealHeight");
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
return success;
|
||||
}
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
void UIControl_TexturePackList::init(const std::wstring &label, int id)
|
||||
{
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 2 , value );
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 2, value);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
// 4J-TomK - add this texturepack list to the vita touch box list
|
||||
// 4J-TomK - add this texturepack list to the vita touch box list
|
||||
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_TexturePackList::addPack(int id, const std::wstring &textureName)
|
||||
{
|
||||
const std::u16string convName = convWstringToU16string(textureName);
|
||||
void UIControl_TexturePackList::addPack(int id,
|
||||
const std::wstring& textureName) {
|
||||
const std::u16string convName = convWstringToU16string(textureName);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addPackFunc ,2 , value );
|
||||
stringVal.string = convName.c_str();
|
||||
stringVal.length = convName.length();
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_addPackFunc, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_TexturePackList::selectSlot(int id)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSelectSlot ,1 , value );
|
||||
void UIControl_TexturePackList::selectSlot(int id) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSelectSlot, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_TexturePackList::clearSlots()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , NULL );
|
||||
void UIControl_TexturePackList::clearSlots() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_clearSlotsFunc, 0, NULL);
|
||||
}
|
||||
|
||||
void UIControl_TexturePackList::setEnabled(bool enable)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].number = enable;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcEnableSelector ,1 , value );
|
||||
void UIControl_TexturePackList::setEnabled(bool enable) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].number = enable;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcEnableSelector, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_TexturePackList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
void UIControl_TexturePackList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcSetTouchFocus, 3, value);
|
||||
}
|
||||
|
||||
bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcCanTouchTrigger, 2 , value );
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcCanTouchTrigger, 2, value);
|
||||
|
||||
S32 bCanTouchTrigger = false;
|
||||
if(result.type == IGGY_DATATYPE_boolean)
|
||||
{
|
||||
bCanTouchTrigger = (bool)result.boolval;
|
||||
}
|
||||
return bCanTouchTrigger;
|
||||
S32 bCanTouchTrigger = false;
|
||||
if (result.type == IGGY_DATATYPE_boolean) {
|
||||
bCanTouchTrigger = (bool)result.boolval;
|
||||
}
|
||||
return bCanTouchTrigger;
|
||||
}
|
||||
|
||||
S32 UIControl_TexturePackList::GetRealHeight()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL );
|
||||
S32 UIControl_TexturePackList::GetRealHeight() {
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_funcGetRealHeight, 0, NULL);
|
||||
|
||||
S32 iRealHeight = m_height;
|
||||
if(result.type == IGGY_DATATYPE_number)
|
||||
{
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
S32 iRealHeight = m_height;
|
||||
if (result.type == IGGY_DATATYPE_number) {
|
||||
iRealHeight = (S32)result.number;
|
||||
}
|
||||
return iRealHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,26 +2,27 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_TexturePackList : public UIControl_Base
|
||||
{
|
||||
class UIControl_TexturePackList : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_addPackFunc, m_funcSelectSlot, m_funcSetTouchFocus, m_funcCanTouchTrigger, m_funcGetRealHeight,m_clearSlotsFunc;
|
||||
IggyName m_funcEnableSelector;
|
||||
IggyName m_addPackFunc, m_funcSelectSlot, m_funcSetTouchFocus,
|
||||
m_funcCanTouchTrigger, m_funcGetRealHeight, m_clearSlotsFunc;
|
||||
IggyName m_funcEnableSelector;
|
||||
|
||||
public:
|
||||
UIControl_TexturePackList();
|
||||
UIControl_TexturePackList();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring &label, int id);
|
||||
void init(const std::wstring& label, int id);
|
||||
|
||||
void addPack(int id, const std::wstring &textureName);
|
||||
void selectSlot(int id);
|
||||
void clearSlots();
|
||||
void addPack(int id, const std::wstring& textureName);
|
||||
void selectSlot(int id);
|
||||
void clearSlots();
|
||||
|
||||
virtual void setEnabled(bool enable);
|
||||
virtual void setEnabled(bool enable);
|
||||
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
S32 GetRealHeight();
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
S32 GetRealHeight();
|
||||
};
|
||||
|
||||
@@ -2,38 +2,33 @@
|
||||
#include "UI.h"
|
||||
#include "UIControl_Touch.h"
|
||||
|
||||
UIControl_Touch::UIControl_Touch()
|
||||
{
|
||||
UIControl_Touch::UIControl_Touch() {}
|
||||
|
||||
bool UIControl_Touch::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName) {
|
||||
UIControl::setControlType(UIControl::eTouchControl);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool UIControl_Touch::setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eTouchControl);
|
||||
bool success = UIControl_Base::setupControl(scene,parent,controlName);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Touch::init(int iId)
|
||||
{
|
||||
m_id = iId;
|
||||
void UIControl_Touch::init(int iId) {
|
||||
m_id = iId;
|
||||
|
||||
#if !defined(__linux__)
|
||||
switch(m_parentScene->GetParentLayer()->m_iLayer)
|
||||
{
|
||||
case eUILayer_Error:
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this,m_parentScene);
|
||||
break;
|
||||
}
|
||||
switch (m_parentScene->GetParentLayer()->m_iLayer) {
|
||||
case eUILayer_Error:
|
||||
case eUILayer_Fullscreen:
|
||||
case eUILayer_Scene:
|
||||
case eUILayer_HUD:
|
||||
ui.TouchBoxAdd(this, m_parentScene);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIControl_Touch::ReInit()
|
||||
{
|
||||
UIControl_Base::ReInit();
|
||||
void UIControl_Touch::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
init(m_id);
|
||||
init(m_id);
|
||||
}
|
||||
@@ -2,15 +2,14 @@
|
||||
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Touch : public UIControl_Base
|
||||
{
|
||||
class UIControl_Touch : public UIControl_Base {
|
||||
private:
|
||||
|
||||
public:
|
||||
UIControl_Touch();
|
||||
UIControl_Touch();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const std::string &controlName);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
void init(int id);
|
||||
virtual void ReInit();
|
||||
};
|
||||
@@ -1,234 +1,237 @@
|
||||
#pragma once
|
||||
|
||||
// Defines the fixed groups for UI (lower numbers ticked first, rendered last (ie on top))
|
||||
enum EUIGroup
|
||||
{
|
||||
eUIGroup_Fullscreen,
|
||||
eUIGroup_Player1,
|
||||
// Defines the fixed groups for UI (lower numbers ticked first, rendered last
|
||||
// (ie on top))
|
||||
enum EUIGroup {
|
||||
eUIGroup_Fullscreen,
|
||||
eUIGroup_Player1,
|
||||
#ifndef __PSVITA__
|
||||
eUIGroup_Player2,
|
||||
eUIGroup_Player3,
|
||||
eUIGroup_Player4,
|
||||
eUIGroup_Player2,
|
||||
eUIGroup_Player3,
|
||||
eUIGroup_Player4,
|
||||
#endif
|
||||
|
||||
eUIGroup_COUNT,
|
||||
eUIGroup_COUNT,
|
||||
|
||||
eUIGroup_PAD, // Special case to determine the group from the pad (default)
|
||||
eUIGroup_PAD, // Special case to determine the group from the pad (default)
|
||||
};
|
||||
|
||||
// Defines the layers in a UI group (lower numbers ticked first, rendered last (ie on top))
|
||||
enum EUILayer
|
||||
{
|
||||
// Defines the layers in a UI group (lower numbers ticked first, rendered last
|
||||
// (ie on top))
|
||||
enum EUILayer {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
eUILayer_Debug,
|
||||
eUILayer_Debug,
|
||||
#endif
|
||||
eUILayer_Tooltips,
|
||||
eUILayer_Error,
|
||||
eUILayer_Alert,
|
||||
eUILayer_Fullscreen, // Note: Fullscreen in this context doesn't necessarily mean fill the whole screen, but fill the whole viewport for this group. Enables processes that don't interefere with normal scene stack
|
||||
eUILayer_Popup,
|
||||
eUILayer_Scene,
|
||||
//eUILayer_Chat,
|
||||
eUILayer_HUD,
|
||||
eUILayer_Tooltips,
|
||||
eUILayer_Error,
|
||||
eUILayer_Alert,
|
||||
eUILayer_Fullscreen, // Note: Fullscreen in this context doesn't
|
||||
// necessarily mean fill the whole screen, but fill
|
||||
// the whole viewport for this group. Enables
|
||||
// processes that don't interefere with normal scene
|
||||
// stack
|
||||
eUILayer_Popup,
|
||||
eUILayer_Scene,
|
||||
// eUILayer_Chat,
|
||||
eUILayer_HUD,
|
||||
|
||||
eUILayer_COUNT,
|
||||
eUILayer_COUNT,
|
||||
};
|
||||
|
||||
// Defines the scenes and components that can be added to a layer
|
||||
// If you add to the enums below, you need to add the scene name in the right place in CConsoleMinecraftApp::wchSceneA
|
||||
enum EUIScene
|
||||
{
|
||||
eUIScene_PartnernetPassword = 0,
|
||||
eUIScene_Intro,
|
||||
eUIScene_SaveMessage,
|
||||
eUIScene_MainMenu,
|
||||
eUIScene_FullscreenProgress,
|
||||
eUIScene_PauseMenu,
|
||||
eUIScene_Crafting2x2Menu,
|
||||
eUIScene_Crafting3x3Menu,
|
||||
eUIScene_FurnaceMenu,
|
||||
eUIScene_ContainerMenu,
|
||||
eUIScene_LargeContainerMenu,// for splitscreen
|
||||
eUIScene_InventoryMenu,
|
||||
eUIScene_DispenserMenu,
|
||||
eUIScene_DebugOptions,
|
||||
eUIScene_DebugTips,
|
||||
eUIScene_HelpAndOptionsMenu,
|
||||
eUIScene_HowToPlay,
|
||||
eUIScene_HowToPlayMenu,
|
||||
eUIScene_ControlsMenu,
|
||||
eUIScene_SettingsOptionsMenu,
|
||||
eUIScene_SettingsAudioMenu,
|
||||
eUIScene_SettingsControlMenu,
|
||||
eUIScene_SettingsGraphicsMenu,
|
||||
eUIScene_SettingsUIMenu,
|
||||
eUIScene_SettingsMenu,
|
||||
eUIScene_LeaderboardsMenu,
|
||||
eUIScene_Credits,
|
||||
eUIScene_DeathMenu,
|
||||
eUIComponent_TutorialPopup,
|
||||
eUIScene_CreateWorldMenu,
|
||||
eUIScene_LoadOrJoinMenu,
|
||||
eUIScene_JoinMenu,
|
||||
eUIScene_SignEntryMenu,
|
||||
eUIScene_InGameInfoMenu,
|
||||
eUIScene_ConnectingProgress,
|
||||
eUIScene_DLCOffersMenu,
|
||||
eUIScene_SocialPost,
|
||||
eUIScene_TrialExitUpsell,
|
||||
eUIScene_LoadMenu,
|
||||
eUIComponent_Chat,
|
||||
eUIScene_ReinstallMenu,
|
||||
eUIScene_SkinSelectMenu,
|
||||
eUIScene_TextEntry,
|
||||
eUIScene_InGameHostOptionsMenu,
|
||||
eUIScene_InGamePlayerOptionsMenu,
|
||||
eUIScene_CreativeMenu,
|
||||
eUIScene_LaunchMoreOptionsMenu,
|
||||
eUIScene_DLCMainMenu,
|
||||
eUIScene_NewUpdateMessage,
|
||||
eUIScene_EnchantingMenu,
|
||||
eUIScene_BrewingStandMenu,
|
||||
eUIScene_EndPoem,
|
||||
eUIScene_HUD,
|
||||
eUIScene_TradingMenu,
|
||||
eUIScene_AnvilMenu,
|
||||
eUIScene_TeleportMenu,
|
||||
// If you add to the enums below, you need to add the scene name in the right
|
||||
// place in CConsoleMinecraftApp::wchSceneA
|
||||
enum EUIScene {
|
||||
eUIScene_PartnernetPassword = 0,
|
||||
eUIScene_Intro,
|
||||
eUIScene_SaveMessage,
|
||||
eUIScene_MainMenu,
|
||||
eUIScene_FullscreenProgress,
|
||||
eUIScene_PauseMenu,
|
||||
eUIScene_Crafting2x2Menu,
|
||||
eUIScene_Crafting3x3Menu,
|
||||
eUIScene_FurnaceMenu,
|
||||
eUIScene_ContainerMenu,
|
||||
eUIScene_LargeContainerMenu, // for splitscreen
|
||||
eUIScene_InventoryMenu,
|
||||
eUIScene_DispenserMenu,
|
||||
eUIScene_DebugOptions,
|
||||
eUIScene_DebugTips,
|
||||
eUIScene_HelpAndOptionsMenu,
|
||||
eUIScene_HowToPlay,
|
||||
eUIScene_HowToPlayMenu,
|
||||
eUIScene_ControlsMenu,
|
||||
eUIScene_SettingsOptionsMenu,
|
||||
eUIScene_SettingsAudioMenu,
|
||||
eUIScene_SettingsControlMenu,
|
||||
eUIScene_SettingsGraphicsMenu,
|
||||
eUIScene_SettingsUIMenu,
|
||||
eUIScene_SettingsMenu,
|
||||
eUIScene_LeaderboardsMenu,
|
||||
eUIScene_Credits,
|
||||
eUIScene_DeathMenu,
|
||||
eUIComponent_TutorialPopup,
|
||||
eUIScene_CreateWorldMenu,
|
||||
eUIScene_LoadOrJoinMenu,
|
||||
eUIScene_JoinMenu,
|
||||
eUIScene_SignEntryMenu,
|
||||
eUIScene_InGameInfoMenu,
|
||||
eUIScene_ConnectingProgress,
|
||||
eUIScene_DLCOffersMenu,
|
||||
eUIScene_SocialPost,
|
||||
eUIScene_TrialExitUpsell,
|
||||
eUIScene_LoadMenu,
|
||||
eUIComponent_Chat,
|
||||
eUIScene_ReinstallMenu,
|
||||
eUIScene_SkinSelectMenu,
|
||||
eUIScene_TextEntry,
|
||||
eUIScene_InGameHostOptionsMenu,
|
||||
eUIScene_InGamePlayerOptionsMenu,
|
||||
eUIScene_CreativeMenu,
|
||||
eUIScene_LaunchMoreOptionsMenu,
|
||||
eUIScene_DLCMainMenu,
|
||||
eUIScene_NewUpdateMessage,
|
||||
eUIScene_EnchantingMenu,
|
||||
eUIScene_BrewingStandMenu,
|
||||
eUIScene_EndPoem,
|
||||
eUIScene_HUD,
|
||||
eUIScene_TradingMenu,
|
||||
eUIScene_AnvilMenu,
|
||||
eUIScene_TeleportMenu,
|
||||
|
||||
#ifdef _XBOX
|
||||
// eUIScene_TransferToXboxOne,
|
||||
#endif
|
||||
|
||||
// When adding new scenes here, you must also update the switches in CConsoleMinecraftApp::NavigateToScene
|
||||
// There are quite a few so you need to check them all
|
||||
// When adding new scenes here, you must also update the switches in
|
||||
// CConsoleMinecraftApp::NavigateToScene There are quite a few so you need to
|
||||
// check them all
|
||||
|
||||
#ifndef _XBOX
|
||||
// Anything non-xbox should be added here. The ordering of scenes above is required for sentient reporting on xbox 360 to continue to be accurate
|
||||
eUIComponent_Panorama,
|
||||
eUIComponent_Logo,
|
||||
eUIComponent_DebugUIConsole,
|
||||
eUIComponent_DebugUIMarketingGuide,
|
||||
eUIComponent_Tooltips,
|
||||
eUIComponent_PressStartToPlay,
|
||||
eUIComponent_MenuBackground,
|
||||
eUIScene_Keyboard,
|
||||
eUIScene_QuadrantSignin,
|
||||
eUIScene_MessageBox,
|
||||
eUIScene_Timer,
|
||||
eUIScene_EULA,
|
||||
eUIScene_InGameSaveManagementMenu,
|
||||
#endif // ndef _XBOX
|
||||
// Anything non-xbox should be added here. The ordering of scenes above is
|
||||
// required for sentient reporting on xbox 360 to continue to be accurate
|
||||
eUIComponent_Panorama,
|
||||
eUIComponent_Logo,
|
||||
eUIComponent_DebugUIConsole,
|
||||
eUIComponent_DebugUIMarketingGuide,
|
||||
eUIComponent_Tooltips,
|
||||
eUIComponent_PressStartToPlay,
|
||||
eUIComponent_MenuBackground,
|
||||
eUIScene_Keyboard,
|
||||
eUIScene_QuadrantSignin,
|
||||
eUIScene_MessageBox,
|
||||
eUIScene_Timer,
|
||||
eUIScene_EULA,
|
||||
eUIScene_InGameSaveManagementMenu,
|
||||
#endif // ndef _XBOX
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
eUIScene_DebugOverlay,
|
||||
eUIScene_DebugItemEditor,
|
||||
eUIScene_DebugOverlay,
|
||||
eUIScene_DebugItemEditor,
|
||||
#endif
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
eUIScene_DebugCreateSchematic,
|
||||
eUIScene_DebugSetCamera,
|
||||
eUIScene_DebugCreateSchematic,
|
||||
eUIScene_DebugSetCamera,
|
||||
#endif
|
||||
|
||||
eUIScene_COUNT,
|
||||
eUIScene_COUNT,
|
||||
};
|
||||
|
||||
// Used by the fullscreen progress scene to decide what to do when a thread finishes
|
||||
enum ProgressionCompletionType
|
||||
{
|
||||
e_ProgressCompletion_NoAction,
|
||||
e_ProgressCompletion_NavigateBack,
|
||||
e_ProgressCompletion_CloseUIScenes,
|
||||
e_ProgressCompletion_CloseAllPlayersUIScenes,
|
||||
e_ProgressCompletion_NavigateToHomeMenu,
|
||||
e_ProgressCompletion_AutosaveNavigateBack,
|
||||
e_ProgressCompletion_NavigateBackToScene,
|
||||
// Used by the fullscreen progress scene to decide what to do when a thread
|
||||
// finishes
|
||||
enum ProgressionCompletionType {
|
||||
e_ProgressCompletion_NoAction,
|
||||
e_ProgressCompletion_NavigateBack,
|
||||
e_ProgressCompletion_CloseUIScenes,
|
||||
e_ProgressCompletion_CloseAllPlayersUIScenes,
|
||||
e_ProgressCompletion_NavigateToHomeMenu,
|
||||
e_ProgressCompletion_AutosaveNavigateBack,
|
||||
e_ProgressCompletion_NavigateBackToScene,
|
||||
};
|
||||
|
||||
enum EToolTipButton
|
||||
{
|
||||
eToolTipButtonA = 0,
|
||||
eToolTipButtonB,
|
||||
eToolTipButtonX,
|
||||
eToolTipButtonY,
|
||||
eToolTipButtonLT,
|
||||
eToolTipButtonRT,
|
||||
eToolTipButtonLB,
|
||||
eToolTipButtonRB,
|
||||
eToolTipButtonLS,
|
||||
eToolTipNumButtons
|
||||
enum EToolTipButton {
|
||||
eToolTipButtonA = 0,
|
||||
eToolTipButtonB,
|
||||
eToolTipButtonX,
|
||||
eToolTipButtonY,
|
||||
eToolTipButtonLT,
|
||||
eToolTipButtonRT,
|
||||
eToolTipButtonLB,
|
||||
eToolTipButtonRB,
|
||||
eToolTipButtonLS,
|
||||
eToolTipNumButtons
|
||||
};
|
||||
|
||||
enum EToolTipItem
|
||||
{
|
||||
eToolTipNone = -1,
|
||||
eToolTipPickupPlace_OLD = 0, // To support existing menus.
|
||||
eToolTipExit,
|
||||
eToolTipPickUpGeneric,
|
||||
eToolTipPickUpAll,
|
||||
eToolTipPickUpHalf,
|
||||
eToolTipPlaceGeneric,
|
||||
eToolTipPlaceOne,
|
||||
eToolTipPlaceAll,
|
||||
eToolTipDropGeneric,
|
||||
eToolTipDropOne,
|
||||
eToolTipDropAll,
|
||||
eToolTipSwap,
|
||||
eToolTipQuickMove,
|
||||
eToolTipQuickMoveIngredient,
|
||||
eToolTipQuickMoveFuel,
|
||||
eToolTipWhatIsThis,
|
||||
eToolTipEquip,
|
||||
eToolTipClearQuickSelect,
|
||||
eToolTipQuickMoveTool,
|
||||
eToolTipQuickMoveArmor,
|
||||
eToolTipQuickMoveWeapon,
|
||||
eToolTipDye,
|
||||
eToolTipRepair,
|
||||
eNumToolTips
|
||||
enum EToolTipItem {
|
||||
eToolTipNone = -1,
|
||||
eToolTipPickupPlace_OLD = 0, // To support existing menus.
|
||||
eToolTipExit,
|
||||
eToolTipPickUpGeneric,
|
||||
eToolTipPickUpAll,
|
||||
eToolTipPickUpHalf,
|
||||
eToolTipPlaceGeneric,
|
||||
eToolTipPlaceOne,
|
||||
eToolTipPlaceAll,
|
||||
eToolTipDropGeneric,
|
||||
eToolTipDropOne,
|
||||
eToolTipDropAll,
|
||||
eToolTipSwap,
|
||||
eToolTipQuickMove,
|
||||
eToolTipQuickMoveIngredient,
|
||||
eToolTipQuickMoveFuel,
|
||||
eToolTipWhatIsThis,
|
||||
eToolTipEquip,
|
||||
eToolTipClearQuickSelect,
|
||||
eToolTipQuickMoveTool,
|
||||
eToolTipQuickMoveArmor,
|
||||
eToolTipQuickMoveWeapon,
|
||||
eToolTipDye,
|
||||
eToolTipRepair,
|
||||
eNumToolTips
|
||||
};
|
||||
|
||||
enum EHowToPlayPage
|
||||
{
|
||||
eHowToPlay_WhatsNew = 0,
|
||||
eHowToPlay_Basics,
|
||||
eHowToPlay_Multiplayer,
|
||||
eHowToPlay_HUD,
|
||||
eHowToPlay_Creative,
|
||||
eHowToPlay_Inventory,
|
||||
eHowToPlay_Chest,
|
||||
eHowToPlay_LargeChest,
|
||||
eHowToPlay_Enderchest,
|
||||
eHowToPlay_InventoryCrafting,
|
||||
eHowToPlay_CraftTable,
|
||||
eHowToPlay_Furnace,
|
||||
eHowToPlay_Dispenser,
|
||||
enum EHowToPlayPage {
|
||||
eHowToPlay_WhatsNew = 0,
|
||||
eHowToPlay_Basics,
|
||||
eHowToPlay_Multiplayer,
|
||||
eHowToPlay_HUD,
|
||||
eHowToPlay_Creative,
|
||||
eHowToPlay_Inventory,
|
||||
eHowToPlay_Chest,
|
||||
eHowToPlay_LargeChest,
|
||||
eHowToPlay_Enderchest,
|
||||
eHowToPlay_InventoryCrafting,
|
||||
eHowToPlay_CraftTable,
|
||||
eHowToPlay_Furnace,
|
||||
eHowToPlay_Dispenser,
|
||||
|
||||
eHowToPlay_Brewing,
|
||||
eHowToPlay_Enchantment,
|
||||
eHowToPlay_Anvil,
|
||||
eHowToPlay_FarmingAnimals,
|
||||
eHowToPlay_Breeding,
|
||||
eHowToPlay_Trading,
|
||||
eHowToPlay_Brewing,
|
||||
eHowToPlay_Enchantment,
|
||||
eHowToPlay_Anvil,
|
||||
eHowToPlay_FarmingAnimals,
|
||||
eHowToPlay_Breeding,
|
||||
eHowToPlay_Trading,
|
||||
|
||||
eHowToPlay_NetherPortal,
|
||||
eHowToPlay_TheEnd,
|
||||
eHowToPlay_NetherPortal,
|
||||
eHowToPlay_TheEnd,
|
||||
#ifdef _XBOX
|
||||
eHowToPlay_SocialMedia,
|
||||
eHowToPlay_BanList,
|
||||
eHowToPlay_SocialMedia,
|
||||
eHowToPlay_BanList,
|
||||
#endif
|
||||
eHowToPlay_HostOptions,
|
||||
eHowToPlay_NumPages
|
||||
eHowToPlay_HostOptions,
|
||||
eHowToPlay_NumPages
|
||||
};
|
||||
|
||||
// Credits
|
||||
enum ECreditTextTypes
|
||||
{
|
||||
eExtraLargeText = 0,
|
||||
eLargeText,
|
||||
eMediumText,
|
||||
eSmallText,
|
||||
eNumTextTypes
|
||||
enum ECreditTextTypes {
|
||||
eExtraLargeText = 0,
|
||||
eLargeText,
|
||||
eMediumText,
|
||||
eSmallText,
|
||||
eNumTextTypes
|
||||
};
|
||||
|
||||
#define NO_TRANSLATED_STRING ( -1 ) // String ID used to indicate that we are using non localised string.
|
||||
#define NO_TRANSLATED_STRING \
|
||||
(-1) // String ID used to indicate that we are using non localised string.
|
||||
|
||||
#define CONNECTING_PROGRESS_CHECK_TIME 500
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,132 +2,127 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
//using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
#define _DEBUG_BLOCK_CHARS 0
|
||||
|
||||
// For hardcoded font data.
|
||||
struct SFontData
|
||||
{
|
||||
struct SFontData {
|
||||
public:
|
||||
static const unsigned short FONTCOLS = 23;
|
||||
static const unsigned short FONTROWS = 20;
|
||||
static const unsigned short FONTCOLS = 23;
|
||||
static const unsigned short FONTROWS = 20;
|
||||
|
||||
static const unsigned short FONTSIZE = FONTCOLS * FONTROWS;
|
||||
static const unsigned short FONTSIZE = FONTCOLS * FONTROWS;
|
||||
|
||||
public:
|
||||
// Font name.
|
||||
std::string m_strFontName;
|
||||
// Font name.
|
||||
std::string m_strFontName;
|
||||
|
||||
// Filename of the glyph archive.
|
||||
std::wstring m_wstrFilename;
|
||||
// Filename of the glyph archive.
|
||||
std::wstring m_wstrFilename;
|
||||
|
||||
// Number of glyphs in the archive.
|
||||
unsigned int m_uiGlyphCount;
|
||||
// Number of glyphs in the archive.
|
||||
unsigned int m_uiGlyphCount;
|
||||
|
||||
// Unicode values of each glyph.
|
||||
unsigned short *m_arrCodepoints;
|
||||
// Unicode values of each glyph.
|
||||
unsigned short* m_arrCodepoints;
|
||||
|
||||
// X resolution of glyph archive.
|
||||
unsigned int m_uiGlyphMapX;
|
||||
// X resolution of glyph archive.
|
||||
unsigned int m_uiGlyphMapX;
|
||||
|
||||
// Y resolution of glyph archive.
|
||||
unsigned int m_uiGlyphMapY;
|
||||
// Y resolution of glyph archive.
|
||||
unsigned int m_uiGlyphMapY;
|
||||
|
||||
// Number of columns in the glyph archive.
|
||||
unsigned int m_uiGlyphMapCols;
|
||||
// Number of columns in the glyph archive.
|
||||
unsigned int m_uiGlyphMapCols;
|
||||
|
||||
// Number of rows in the glyph archive.
|
||||
unsigned int m_uiGlyphMapRows;
|
||||
// Number of rows in the glyph archive.
|
||||
unsigned int m_uiGlyphMapRows;
|
||||
|
||||
// Width of each glyph.
|
||||
unsigned int m_uiGlyphWidth;
|
||||
// Width of each glyph.
|
||||
unsigned int m_uiGlyphWidth;
|
||||
|
||||
// Height of each glyph.
|
||||
unsigned int m_uiGlyphHeight;
|
||||
// Height of each glyph.
|
||||
unsigned int m_uiGlyphHeight;
|
||||
|
||||
// Ascent of each glyph above the baseline (units?).
|
||||
float m_fAscent;
|
||||
// Ascent of each glyph above the baseline (units?).
|
||||
float m_fAscent;
|
||||
|
||||
// Descent of each glyph below the baseline (units?).
|
||||
float m_fDescent;
|
||||
// Descent of each glyph below the baseline (units?).
|
||||
float m_fDescent;
|
||||
|
||||
// How much to advance for each pixel wide the glyph is.
|
||||
float m_fAdvPerPixel;
|
||||
// How much to advance for each pixel wide the glyph is.
|
||||
float m_fAdvPerPixel;
|
||||
|
||||
// How many pixels wide any whitespace characters are.
|
||||
unsigned int m_uiWhitespaceWidth;
|
||||
// How many pixels wide any whitespace characters are.
|
||||
unsigned int m_uiWhitespaceWidth;
|
||||
|
||||
public:
|
||||
static unsigned short Codepoints[FONTSIZE];
|
||||
static SFontData Mojangles_7;
|
||||
static SFontData Mojangles_11;
|
||||
static unsigned short Codepoints[FONTSIZE];
|
||||
static SFontData Mojangles_7;
|
||||
static SFontData Mojangles_11;
|
||||
};
|
||||
|
||||
// Provides a common interface for dealing with font data.
|
||||
class CFontData
|
||||
{
|
||||
class CFontData {
|
||||
public:
|
||||
CFontData();
|
||||
CFontData();
|
||||
|
||||
// pbRawImage consumed by constructor.
|
||||
CFontData(SFontData &sFontData, int *pbRawImage);
|
||||
// pbRawImage consumed by constructor.
|
||||
CFontData(SFontData& sFontData, int* pbRawImage);
|
||||
|
||||
// Release memory.
|
||||
void release();
|
||||
// Release memory.
|
||||
void release();
|
||||
|
||||
protected:
|
||||
// Hardcoded font data.
|
||||
SFontData* m_sFontData;
|
||||
|
||||
// Hardcoded font data.
|
||||
SFontData *m_sFontData;
|
||||
// Map Unicodepoints to glyph ids.
|
||||
std::unordered_map<unsigned int, unsigned short> m_unicodeMap;
|
||||
|
||||
// Map Unicodepoints to glyph ids.
|
||||
std::unordered_map<unsigned int, unsigned short> m_unicodeMap;
|
||||
// Kerning value for each glyph.
|
||||
unsigned short* m_kerningTable;
|
||||
|
||||
// Kerning value for each glyph.
|
||||
unsigned short *m_kerningTable;
|
||||
// Binary blob of the archive image.
|
||||
unsigned char* m_pbRawImage;
|
||||
|
||||
// Binary blob of the archive image.
|
||||
unsigned char *m_pbRawImage;
|
||||
|
||||
// Total advance of each character.
|
||||
float *m_pfAdvanceTable;
|
||||
// Total advance of each character.
|
||||
float* m_pfAdvanceTable;
|
||||
|
||||
public:
|
||||
// Accessor for the font name in the internal SFontData.
|
||||
const std::string getFontName();
|
||||
|
||||
// Accessor for the font name in the internal SFontData.
|
||||
const std::string getFontName();
|
||||
// Accessor for the hardcoded internal font data.
|
||||
SFontData* getFontData();
|
||||
|
||||
// Accessor for the hardcoded internal font data.
|
||||
SFontData *getFontData();
|
||||
// Get the glyph id corresponding to a unicode point.
|
||||
unsigned short getGlyphId(unsigned int unicodepoint);
|
||||
|
||||
// Get the glyph id corresponding to a unicode point.
|
||||
unsigned short getGlyphId(unsigned int unicodepoint);
|
||||
// Get the unicodepoint corresponding to a glyph id.
|
||||
unsigned int getUnicode(unsigned short glyphId);
|
||||
|
||||
// Get the unicodepoint corresponding to a glyph id.
|
||||
unsigned int getUnicode(unsigned short glyphId);
|
||||
// Get a pointer to the top left pixel of a row/column in the raw image.
|
||||
unsigned char* topLeftPixel(int row, int col);
|
||||
|
||||
// Get a pointer to the top left pixel of a row/column in the raw image.
|
||||
unsigned char *topLeftPixel(int row, int col);
|
||||
// Get the row and column where a glyph appears in the archive.
|
||||
void getPos(unsigned short gyphId, int& row, int& col);
|
||||
|
||||
// Get the row and column where a glyph appears in the archive.
|
||||
void getPos(unsigned short gyphId, int &row, int &col);
|
||||
// Get the advance of this character (units?).
|
||||
float getAdvance(unsigned short glyphId);
|
||||
|
||||
// Get the advance of this character (units?).
|
||||
float getAdvance(unsigned short glyphId);
|
||||
// Get the width (in pixels) of a given character.
|
||||
int getWidth(unsigned short glyphId);
|
||||
|
||||
// Get the width (in pixels) of a given character.
|
||||
int getWidth(unsigned short glyphId);
|
||||
// Returns true if this glyph is whitespace.
|
||||
bool glyphIsWhitespace(unsigned short glyphId);
|
||||
|
||||
// Returns true if this glyph is whitespace.
|
||||
bool glyphIsWhitespace(unsigned short glyphId);
|
||||
|
||||
// Returns true if this unicodepoint is whitespace
|
||||
bool unicodeIsWhitespace(unsigned int unicodepoint);
|
||||
// Returns true if this unicodepoint is whitespace
|
||||
bool unicodeIsWhitespace(unsigned int unicodepoint);
|
||||
|
||||
private:
|
||||
|
||||
// Move a pointer in an image dx pixels right and dy pixels down, wrap around in either dimension leads to unknown behaviour.
|
||||
void moveCursor(unsigned char *&cursor, unsigned int dx, unsigned int dy);
|
||||
// Move a pointer in an image dx pixels right and dy pixels down, wrap
|
||||
// around in either dimension leads to unknown behaviour.
|
||||
void moveCursor(unsigned char*& cursor, unsigned int dx, unsigned int dy);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,422 +1,372 @@
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "UIGroup.h"
|
||||
|
||||
UIGroup::UIGroup(EUIGroup group, int iPad)
|
||||
{
|
||||
m_group = group;
|
||||
m_iPad = iPad;
|
||||
m_bMenuDisplayed = false;
|
||||
m_bPauseMenuDisplayed = false;
|
||||
m_bContainerMenuDisplayed = false;
|
||||
m_bIgnoreAutosaveMenuDisplayed = false;
|
||||
m_bIgnorePlayerJoinMenuDisplayed = false;
|
||||
// 4jcraft, moved this to the top
|
||||
// uninitialized memory was read.
|
||||
m_viewportType = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
|
||||
UIGroup::UIGroup(EUIGroup group, int iPad) {
|
||||
m_group = group;
|
||||
m_iPad = iPad;
|
||||
m_bMenuDisplayed = false;
|
||||
m_bPauseMenuDisplayed = false;
|
||||
m_bContainerMenuDisplayed = false;
|
||||
m_bIgnoreAutosaveMenuDisplayed = false;
|
||||
m_bIgnorePlayerJoinMenuDisplayed = false;
|
||||
// 4jcraft, moved this to the top
|
||||
// uninitialized memory was read.
|
||||
m_viewportType = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
|
||||
|
||||
m_updateFocusStateCountdown = 0;
|
||||
m_updateFocusStateCountdown = 0;
|
||||
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i] = new UILayer(this);
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i] = new UILayer(this);
|
||||
#ifdef __PSVITA__
|
||||
m_layers[i]->m_iLayer=(EUILayer)i;
|
||||
m_layers[i]->m_iLayer = (EUILayer)i;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
m_tooltips = (UIComponent_Tooltips *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_Tooltips);
|
||||
m_tooltips =
|
||||
(UIComponent_Tooltips*)m_layers[(int)eUILayer_Tooltips]->addComponent(
|
||||
0, eUIComponent_Tooltips);
|
||||
|
||||
m_tutorialPopup = NULL;
|
||||
m_hud = NULL;
|
||||
m_pressStartToPlay = NULL;
|
||||
if(m_group != eUIGroup_Fullscreen)
|
||||
{
|
||||
m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[(int)eUILayer_Popup]->addComponent(m_iPad, eUIComponent_TutorialPopup);
|
||||
m_tutorialPopup = NULL;
|
||||
m_hud = NULL;
|
||||
m_pressStartToPlay = NULL;
|
||||
if (m_group != eUIGroup_Fullscreen) {
|
||||
m_tutorialPopup =
|
||||
(UIComponent_TutorialPopup*)m_layers[(int)eUILayer_Popup]
|
||||
->addComponent(m_iPad, eUIComponent_TutorialPopup);
|
||||
|
||||
m_hud = (UIScene_HUD *)m_layers[(int)eUILayer_HUD]->addComponent(m_iPad, eUIScene_HUD);
|
||||
m_hud = (UIScene_HUD*)m_layers[(int)eUILayer_HUD]->addComponent(
|
||||
m_iPad, eUIScene_HUD);
|
||||
|
||||
//m_layers[(int)eUILayer_Chat]->addComponent(m_iPad, eUIComponent_Chat);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_PressStartToPlay);
|
||||
}
|
||||
// m_layers[(int)eUILayer_Chat]->addComponent(m_iPad,
|
||||
// eUIComponent_Chat);
|
||||
} else {
|
||||
m_pressStartToPlay =
|
||||
(UIComponent_PressStartToPlay*)m_layers[(int)eUILayer_Tooltips]
|
||||
->addComponent(0, eUIComponent_PressStartToPlay);
|
||||
}
|
||||
|
||||
// 4J Stu - Pre-allocate this for cached rendering in scenes. It's horribly slow to do dynamically, but we should only need one
|
||||
// per group as we will only be displaying one of these types of scenes at a time
|
||||
m_commandBufferList = MemoryTracker::genLists(1);
|
||||
// 4J Stu - Pre-allocate this for cached rendering in scenes. It's horribly
|
||||
// slow to do dynamically, but we should only need one per group as we will
|
||||
// only be displaying one of these types of scenes at a time
|
||||
m_commandBufferList = MemoryTracker::genLists(1);
|
||||
}
|
||||
|
||||
void UIGroup::DestroyAll()
|
||||
{
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->DestroyAll();
|
||||
}
|
||||
void UIGroup::DestroyAll() {
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->DestroyAll();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::ReloadAll()
|
||||
{
|
||||
// We only need to reload things when they are likely to be rendered
|
||||
int highestRenderable = 0;
|
||||
for(; highestRenderable < eUILayer_COUNT; ++highestRenderable)
|
||||
{
|
||||
if(m_layers[highestRenderable]->hidesLowerScenes()) break;
|
||||
}
|
||||
if(highestRenderable < eUILayer_Fullscreen) highestRenderable = eUILayer_Fullscreen;
|
||||
for(; highestRenderable >= 0; --highestRenderable)
|
||||
{
|
||||
if(highestRenderable < eUILayer_COUNT) m_layers[highestRenderable]->ReloadAll(highestRenderable != (int)eUILayer_Fullscreen);
|
||||
}
|
||||
void UIGroup::ReloadAll() {
|
||||
// We only need to reload things when they are likely to be rendered
|
||||
int highestRenderable = 0;
|
||||
for (; highestRenderable < eUILayer_COUNT; ++highestRenderable) {
|
||||
if (m_layers[highestRenderable]->hidesLowerScenes()) break;
|
||||
}
|
||||
if (highestRenderable < eUILayer_Fullscreen)
|
||||
highestRenderable = eUILayer_Fullscreen;
|
||||
for (; highestRenderable >= 0; --highestRenderable) {
|
||||
if (highestRenderable < eUILayer_COUNT)
|
||||
m_layers[highestRenderable]->ReloadAll(highestRenderable !=
|
||||
(int)eUILayer_Fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::tick()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->tick();
|
||||
void UIGroup::tick() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->tick();
|
||||
|
||||
// TODO: May wish to ignore ticking other layers here based on current layer
|
||||
}
|
||||
// TODO: May wish to ignore ticking other layers here based on current
|
||||
// layer
|
||||
}
|
||||
|
||||
// Handle deferred update focus
|
||||
if (m_updateFocusStateCountdown > 0)
|
||||
{
|
||||
m_updateFocusStateCountdown--;
|
||||
if (m_updateFocusStateCountdown == 0)_UpdateFocusState();
|
||||
}
|
||||
// Handle deferred update focus
|
||||
if (m_updateFocusStateCountdown > 0) {
|
||||
m_updateFocusStateCountdown--;
|
||||
if (m_updateFocusStateCountdown == 0) _UpdateFocusState();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::render()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
S32 width = 0;
|
||||
S32 height = 0;
|
||||
ui.getRenderDimensions(m_viewportType, width, height);
|
||||
int highestRenderable = 0;
|
||||
for(; highestRenderable < eUILayer_COUNT; ++highestRenderable)
|
||||
{
|
||||
if(m_layers[highestRenderable]->hidesLowerScenes()) break;
|
||||
}
|
||||
for(; highestRenderable >= 0; --highestRenderable)
|
||||
{
|
||||
if(highestRenderable < eUILayer_COUNT) m_layers[highestRenderable]->render(width, height,m_viewportType);
|
||||
}
|
||||
void UIGroup::render() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
S32 width = 0;
|
||||
S32 height = 0;
|
||||
ui.getRenderDimensions(m_viewportType, width, height);
|
||||
int highestRenderable = 0;
|
||||
for (; highestRenderable < eUILayer_COUNT; ++highestRenderable) {
|
||||
if (m_layers[highestRenderable]->hidesLowerScenes()) break;
|
||||
}
|
||||
for (; highestRenderable >= 0; --highestRenderable) {
|
||||
if (highestRenderable < eUILayer_COUNT)
|
||||
m_layers[highestRenderable]->render(width, height, m_viewportType);
|
||||
}
|
||||
}
|
||||
|
||||
bool UIGroup::hidesLowerScenes()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return false;
|
||||
bool hidesScenes = false;
|
||||
for(int i = eUILayer_COUNT - 1; i >= 0; --i)
|
||||
{
|
||||
hidesScenes = m_layers[i]->hidesLowerScenes();
|
||||
if(hidesScenes) break;
|
||||
}
|
||||
return hidesScenes;
|
||||
bool UIGroup::hidesLowerScenes() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return false;
|
||||
bool hidesScenes = false;
|
||||
for (int i = eUILayer_COUNT - 1; i >= 0; --i) {
|
||||
hidesScenes = m_layers[i]->hidesLowerScenes();
|
||||
if (hidesScenes) break;
|
||||
}
|
||||
return hidesScenes;
|
||||
}
|
||||
|
||||
void UIGroup::getRenderDimensions(S32 &width, S32 &height)
|
||||
{
|
||||
ui.getRenderDimensions(m_viewportType, width, height);
|
||||
void UIGroup::getRenderDimensions(S32& width, S32& height) {
|
||||
ui.getRenderDimensions(m_viewportType, width, height);
|
||||
}
|
||||
|
||||
// NAVIGATION
|
||||
bool UIGroup::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer)
|
||||
{
|
||||
bool succeeded = m_layers[(int)layer]->NavigateToScene(iPad, scene, initData);
|
||||
updateStackStates();
|
||||
return succeeded;
|
||||
bool UIGroup::NavigateToScene(int iPad, EUIScene scene, void* initData,
|
||||
EUILayer layer) {
|
||||
bool succeeded =
|
||||
m_layers[(int)layer]->NavigateToScene(iPad, scene, initData);
|
||||
updateStackStates();
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
bool UIGroup::NavigateBack(int iPad, EUIScene eScene, EUILayer eLayer)
|
||||
{
|
||||
// Keep navigating back on every layer until we hit the target scene
|
||||
bool foundTarget = false;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
if(eLayer < eUILayer_COUNT && eLayer != i) continue;
|
||||
foundTarget = m_layers[i]->NavigateBack(iPad, eScene);
|
||||
if(foundTarget) break;
|
||||
}
|
||||
updateStackStates();
|
||||
return foundTarget;
|
||||
bool UIGroup::NavigateBack(int iPad, EUIScene eScene, EUILayer eLayer) {
|
||||
// Keep navigating back on every layer until we hit the target scene
|
||||
bool foundTarget = false;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
if (eLayer < eUILayer_COUNT && eLayer != i) continue;
|
||||
foundTarget = m_layers[i]->NavigateBack(iPad, eScene);
|
||||
if (foundTarget) break;
|
||||
}
|
||||
updateStackStates();
|
||||
return foundTarget;
|
||||
}
|
||||
|
||||
void UIGroup::closeAllScenes()
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if( m_iPad >= 0 )
|
||||
{
|
||||
if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL )
|
||||
{
|
||||
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
|
||||
void UIGroup::closeAllScenes() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (m_iPad >= 0) {
|
||||
if (pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)pMinecraft->localgameModes[m_iPad];
|
||||
|
||||
// This just allows it to be shown
|
||||
gameMode->getTutorial()->showTutorialPopup(true);
|
||||
}
|
||||
}
|
||||
// This just allows it to be shown
|
||||
gameMode->getTutorial()->showTutorialPopup(true);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
// Ignore the error layer
|
||||
if(i != (int)eUILayer_Error) m_layers[i]->closeAllScenes();
|
||||
}
|
||||
updateStackStates();
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
// Ignore the error layer
|
||||
if (i != (int)eUILayer_Error) m_layers[i]->closeAllScenes();
|
||||
}
|
||||
updateStackStates();
|
||||
}
|
||||
|
||||
UIScene *UIGroup::GetTopScene(EUILayer layer)
|
||||
{
|
||||
return m_layers[(int)layer]->GetTopScene();
|
||||
UIScene* UIGroup::GetTopScene(EUILayer layer) {
|
||||
return m_layers[(int)layer]->GetTopScene();
|
||||
}
|
||||
|
||||
bool UIGroup::GetMenuDisplayed()
|
||||
{
|
||||
return m_bMenuDisplayed;
|
||||
bool UIGroup::GetMenuDisplayed() { return m_bMenuDisplayed; }
|
||||
|
||||
bool UIGroup::IsSceneInStack(EUIScene scene) {
|
||||
bool found = false;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
found = m_layers[i]->IsSceneInStack(scene);
|
||||
if (found) break;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
bool UIGroup::IsSceneInStack(EUIScene scene)
|
||||
{
|
||||
bool found = false;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
found = m_layers[i]->IsSceneInStack(scene);
|
||||
if(found) break;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
bool UIGroup::HasFocus(int iPad)
|
||||
{
|
||||
bool hasFocus = false;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
if( m_layers[i]->m_hasFocus)
|
||||
{
|
||||
if(m_layers[i]->HasFocus(iPad))
|
||||
{
|
||||
hasFocus = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return hasFocus;
|
||||
bool UIGroup::HasFocus(int iPad) {
|
||||
bool hasFocus = false;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
if (m_layers[i]->m_hasFocus) {
|
||||
if (m_layers[i]->HasFocus(iPad)) {
|
||||
hasFocus = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return hasFocus;
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
UIScene *UIGroup::getCurrentScene()
|
||||
{
|
||||
UIScene *pScene;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
pScene=m_layers[i]->getCurrentScene();
|
||||
UIScene* UIGroup::getCurrentScene() {
|
||||
UIScene* pScene;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
pScene = m_layers[i]->getCurrentScene();
|
||||
|
||||
if(pScene!=NULL) return pScene;
|
||||
}
|
||||
if (pScene != NULL) return pScene;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// INPUT
|
||||
void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->handleInput(iPad, key, repeat, pressed, released, handled);
|
||||
if(handled) break;
|
||||
}
|
||||
void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed,
|
||||
bool released, bool& handled) {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->handleInput(iPad, key, repeat, pressed, released, handled);
|
||||
if (handled) break;
|
||||
}
|
||||
}
|
||||
|
||||
// FOCUS
|
||||
// FOCUS
|
||||
|
||||
// Check that a layer may recieve focus, specifically that there is no infocus layer above
|
||||
bool UIGroup::RequestFocus(UILayer* layerPtr)
|
||||
{
|
||||
// Find the layer
|
||||
unsigned int layerIndex = GetLayerIndex(layerPtr);
|
||||
// Check that a layer may recieve focus, specifically that there is no infocus
|
||||
// layer above
|
||||
bool UIGroup::RequestFocus(UILayer* layerPtr) {
|
||||
// Find the layer
|
||||
unsigned int layerIndex = GetLayerIndex(layerPtr);
|
||||
|
||||
// Top layer is always allowed focus
|
||||
if (layerIndex == 0) return true;
|
||||
// Top layer is always allowed focus
|
||||
if (layerIndex == 0) return true;
|
||||
|
||||
// Check layers above to see if any of them have focus
|
||||
for (int i = layerIndex-1; i >= 0; i--)
|
||||
{
|
||||
if (m_layers[i]->m_hasFocus) return false;
|
||||
}
|
||||
// Check layers above to see if any of them have focus
|
||||
for (int i = layerIndex - 1; i >= 0; i--) {
|
||||
if (m_layers[i]->m_hasFocus) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void UIGroup::showComponent(int iPad, EUIScene scene, EUILayer layer, bool show)
|
||||
{
|
||||
m_layers[layer]->showComponent(iPad, scene, show);
|
||||
void UIGroup::showComponent(int iPad, EUIScene scene, EUILayer layer,
|
||||
bool show) {
|
||||
m_layers[layer]->showComponent(iPad, scene, show);
|
||||
}
|
||||
|
||||
UIScene *UIGroup::addComponent(int iPad, EUIScene scene, EUILayer layer)
|
||||
{
|
||||
return m_layers[layer]->addComponent(iPad, scene);
|
||||
UIScene* UIGroup::addComponent(int iPad, EUIScene scene, EUILayer layer) {
|
||||
return m_layers[layer]->addComponent(iPad, scene);
|
||||
}
|
||||
|
||||
void UIGroup::removeComponent(EUIScene scene, EUILayer layer)
|
||||
{
|
||||
m_layers[layer]->removeComponent(scene);
|
||||
void UIGroup::removeComponent(EUIScene scene, EUILayer layer) {
|
||||
m_layers[layer]->removeComponent(scene);
|
||||
}
|
||||
|
||||
void UIGroup::SetViewportType(C4JRender::eViewportType type)
|
||||
{
|
||||
if(m_viewportType != type)
|
||||
{
|
||||
m_viewportType = type;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->ReloadAll(true);
|
||||
}
|
||||
}
|
||||
void UIGroup::SetViewportType(C4JRender::eViewportType type) {
|
||||
if (m_viewportType != type) {
|
||||
m_viewportType = type;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->ReloadAll(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
C4JRender::eViewportType UIGroup::GetViewportType()
|
||||
{
|
||||
return m_viewportType;
|
||||
C4JRender::eViewportType UIGroup::GetViewportType() { return m_viewportType; }
|
||||
|
||||
void UIGroup::HandleDLCMountingComplete() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
app.DebugPrintf("UIGroup::HandleDLCMountingComplete - m_layers[%d]\n",
|
||||
i);
|
||||
m_layers[i]->HandleDLCMountingComplete();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::HandleDLCMountingComplete()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
app.DebugPrintf("UIGroup::HandleDLCMountingComplete - m_layers[%d]\n",i);
|
||||
m_layers[i]->HandleDLCMountingComplete();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::HandleDLCInstalled()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->HandleDLCInstalled();
|
||||
}
|
||||
void UIGroup::HandleDLCInstalled() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->HandleDLCInstalled();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
void UIGroup::HandleDLCLicenseChange()
|
||||
{
|
||||
// Ignore this group if the player isn't signed in
|
||||
if(m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->HandleDLCLicenseChange();
|
||||
}
|
||||
void UIGroup::HandleDLCLicenseChange() {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->HandleDLCLicenseChange();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool UIGroup::IsFullscreenGroup()
|
||||
{
|
||||
return m_group == eUIGroup_Fullscreen;
|
||||
bool UIGroup::IsFullscreenGroup() { return m_group == eUIGroup_Fullscreen; }
|
||||
|
||||
void UIGroup::handleUnlockFullVersion() {
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->handleUnlockFullVersion();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::updateStackStates() {
|
||||
m_bMenuDisplayed = false;
|
||||
m_bPauseMenuDisplayed = false;
|
||||
m_bContainerMenuDisplayed = false;
|
||||
m_bIgnoreAutosaveMenuDisplayed = false;
|
||||
m_bIgnorePlayerJoinMenuDisplayed = false;
|
||||
|
||||
void UIGroup::handleUnlockFullVersion()
|
||||
{
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_layers[i]->handleUnlockFullVersion();
|
||||
}
|
||||
}
|
||||
|
||||
void UIGroup::updateStackStates()
|
||||
{
|
||||
m_bMenuDisplayed = false;
|
||||
m_bPauseMenuDisplayed = false;
|
||||
m_bContainerMenuDisplayed = false;
|
||||
m_bIgnoreAutosaveMenuDisplayed = false;
|
||||
m_bIgnorePlayerJoinMenuDisplayed = false;
|
||||
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
m_bMenuDisplayed = m_bMenuDisplayed || m_layers[i]->m_bMenuDisplayed;
|
||||
m_bPauseMenuDisplayed = m_bPauseMenuDisplayed || m_layers[i]->m_bPauseMenuDisplayed;
|
||||
m_bContainerMenuDisplayed = m_bContainerMenuDisplayed || m_layers[i]->m_bContainerMenuDisplayed;
|
||||
m_bIgnoreAutosaveMenuDisplayed = m_bIgnoreAutosaveMenuDisplayed || m_layers[i]->m_bIgnoreAutosaveMenuDisplayed;
|
||||
m_bIgnorePlayerJoinMenuDisplayed = m_bIgnorePlayerJoinMenuDisplayed || m_layers[i]->m_bIgnorePlayerJoinMenuDisplayed;
|
||||
}
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_bMenuDisplayed = m_bMenuDisplayed || m_layers[i]->m_bMenuDisplayed;
|
||||
m_bPauseMenuDisplayed =
|
||||
m_bPauseMenuDisplayed || m_layers[i]->m_bPauseMenuDisplayed;
|
||||
m_bContainerMenuDisplayed =
|
||||
m_bContainerMenuDisplayed || m_layers[i]->m_bContainerMenuDisplayed;
|
||||
m_bIgnoreAutosaveMenuDisplayed =
|
||||
m_bIgnoreAutosaveMenuDisplayed ||
|
||||
m_layers[i]->m_bIgnoreAutosaveMenuDisplayed;
|
||||
m_bIgnorePlayerJoinMenuDisplayed =
|
||||
m_bIgnorePlayerJoinMenuDisplayed ||
|
||||
m_layers[i]->m_bIgnorePlayerJoinMenuDisplayed;
|
||||
}
|
||||
}
|
||||
|
||||
// Defer update focus till for 10 UI ticks
|
||||
void UIGroup::UpdateFocusState()
|
||||
{
|
||||
m_updateFocusStateCountdown = 10;
|
||||
}
|
||||
void UIGroup::UpdateFocusState() { m_updateFocusStateCountdown = 10; }
|
||||
|
||||
// Pass focus to uppermost layer that accepts focus
|
||||
void UIGroup::_UpdateFocusState()
|
||||
{
|
||||
bool groupFocusSet = false;
|
||||
void UIGroup::_UpdateFocusState() {
|
||||
bool groupFocusSet = false;
|
||||
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
groupFocusSet = m_layers[i]->updateFocusState(true);
|
||||
if (groupFocusSet) break;
|
||||
}
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
groupFocusSet = m_layers[i]->updateFocusState(true);
|
||||
if (groupFocusSet) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the index of the layer
|
||||
unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr)
|
||||
{
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
if (m_layers[i] == layerPtr) return i;
|
||||
}
|
||||
unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr) {
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
if (m_layers[i] == layerPtr) return i;
|
||||
}
|
||||
|
||||
// can't get here...
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIGroup::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||
{
|
||||
__int64 groupStatic = 0;
|
||||
__int64 groupDynamic = 0;
|
||||
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group);
|
||||
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
|
||||
{
|
||||
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n",i);
|
||||
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
|
||||
app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n",i);
|
||||
}
|
||||
app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n", groupStatic, groupDynamic);
|
||||
totalStatic += groupStatic;
|
||||
totalDynamic += groupDynamic;
|
||||
app.DebugPrintf(app.USER_SR, "-- END GROUP %d\n",m_group);
|
||||
// can't get here...
|
||||
return 0;
|
||||
}
|
||||
|
||||
int UIGroup::getCommandBufferList()
|
||||
{
|
||||
return m_commandBufferList;
|
||||
void UIGroup::PrintTotalMemoryUsage(__int64& totalStatic,
|
||||
__int64& totalDynamic) {
|
||||
__int64 groupStatic = 0;
|
||||
__int64 groupDynamic = 0;
|
||||
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n", m_group);
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n", i);
|
||||
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
|
||||
app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n", i);
|
||||
}
|
||||
app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n",
|
||||
groupStatic, groupDynamic);
|
||||
totalStatic += groupStatic;
|
||||
totalDynamic += groupDynamic;
|
||||
app.DebugPrintf(app.USER_SR, "-- END GROUP %d\n", m_group);
|
||||
}
|
||||
|
||||
// Returns the first scene of given type if it exists, NULL otherwise
|
||||
UIScene *UIGroup::FindScene(EUIScene sceneType)
|
||||
{
|
||||
UIScene *pScene = NULL;
|
||||
int UIGroup::getCommandBufferList() { return m_commandBufferList; }
|
||||
|
||||
for (int i = 0; i < eUILayer_COUNT; i++)
|
||||
{
|
||||
pScene = m_layers[i]->FindScene(sceneType);
|
||||
// Returns the first scene of given type if it exists, NULL otherwise
|
||||
UIScene* UIGroup::FindScene(EUIScene sceneType) {
|
||||
UIScene* pScene = NULL;
|
||||
|
||||
for (int i = 0; i < eUILayer_COUNT; i++) {
|
||||
pScene = m_layers[i]->FindScene(sceneType);
|
||||
#ifdef __PS3__
|
||||
if (pScene != NULL) return pScene;
|
||||
if (pScene != NULL) return pScene;
|
||||
#else
|
||||
if (pScene != nullptr) return pScene;
|
||||
if (pScene != nullptr) return pScene;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return pScene;
|
||||
return pScene;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user