Files
neoLegacy/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.h
T

122 lines
3.0 KiB
C++

#pragma once
#include "UIScene.h"
#include "UIControl_SuperflatLists.h"
#include "UIScene_SuperflatMenu.h"
class UIScene_SuperflatEditLayerMenu : public UIScene
{
private:
enum EControls
{
eControl_Grid = 0,
eControl_Preview = 1,
eControl_Height = 2,
eControl_Confirm = 3,
};
enum EFocus
{
eFocus_Grid = 0,
eFocus_Slider,
eFocus_Button,
};
enum EDrag
{
eDrag_None = 0,
eDrag_Slider,
eDrag_Scroll,
};
static const int kColumns = 10;
static const int kRows = 5;
UIControl_Label m_title;
UIControl_SlotList m_slotList;
UIControl_Slider m_heightSlider;
UIControl_Button m_confirmButton;
UIControl_Label m_heightLabel;
UIControl_Label m_typeLabel;
IggyName m_funcSetScrollBar;
IggyName m_funcSetCursorPos;
IggyName m_funcShowCursor;
IggyName m_funcSetCursorLabel;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_ELEMENT( m_title, "EditLayerTitle")
UI_MAP_ELEMENT( m_slotList, "containerList")
UI_MAP_ELEMENT( m_heightSlider, "LayerHeight")
UI_MAP_ELEMENT( m_confirmButton, "ConfirmLayer")
UI_MAP_ELEMENT( m_heightLabel, "LayerHeightLabel")
UI_MAP_ELEMENT( m_typeLabel, "LayerTypeLabel")
UI_MAP_NAME( m_funcSetScrollBar, L"SetScrollBar")
UI_MAP_NAME( m_funcSetCursorPos, L"SetCursorPos")
UI_MAP_NAME( m_funcShowCursor, L"ShowCursor")
UI_MAP_NAME( m_funcSetCursorLabel, L"SetCursorLabel")
UI_END_MAP_ELEMENTS_AND_NAMES()
SuperflatEditLayerInitData *m_data;
FlatLayerInfo m_original;
int m_iSelectedBlock;
int m_iCursorBlock;
int m_iScrollRow;
int m_iMaxHeight;
int m_focus;
bool m_bNeedsPopulate;
bool m_bPopulated;
bool m_bPendingConfirm;
bool m_bMouseMode;
F32 m_fMouseX;
F32 m_fMouseY;
int m_iHoverBlock;
int m_iDrag;
F32 m_fDragOffset;
FlatLayerInfo &layer();
wstring heightLabel(int height);
int totalRows();
void cancel();
void populate();
void updatePreview();
void updateCursor();
void updateScrollBar();
void setCursorBlock(int block);
void selectBlock(int block);
void enterGrid();
int slotAt(F32 x, F32 y);
int maxScrollRow();
float thumbPos();
void setScrollRow(int row);
void setCursorLabel(const wstring &label);
void setCursorPos(F32 x, F32 y);
void showCursor(bool show);
void refreshMouseHover();
void leaveMouseMode();
public:
UIScene_SuperflatEditLayerMenu(int iPad, void *initData, UILayer *parentLayer);
virtual EUIScene getSceneType() { return eUIScene_SuperflatEditLayerMenu; }
virtual void tick();
virtual void updateTooltips();
virtual void updateComponents();
virtual void handleDestroy();
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
protected:
virtual wstring getMoviePath();
public:
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
virtual void handlePress(F64 controlId, F64 childId);
virtual void handleFocusChange(F64 controlId, F64 childId);
virtual void handleSliderMove(F64 sliderId, F64 currentValue);
#if defined(_WINDOWS64) || defined(__linux__)
virtual bool handleMouseClick(F32 x, F32 y);
virtual bool canMoveSlider(F64 sliderId);
virtual void handleMouseHover(F32 x, F32 y);
#endif
};