forked from cafeberry/cafeberry
added some kbm stuff
This commit is contained in:
@@ -97,6 +97,13 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
|
||||
fPanelHeight = m_controlBackgroundPanel.getHeight();
|
||||
fPanelX = m_controlBackgroundPanel.getXPos();
|
||||
fPanelY = m_controlBackgroundPanel.getYPos();
|
||||
if (fPanelWidth <= 0 || fPanelHeight <= 0)
|
||||
{
|
||||
fPanelX = 0.0f;
|
||||
fPanelY = 0.0f;
|
||||
fPanelWidth = (float)m_movieWidth;
|
||||
fPanelHeight = (float)m_movieHeight;
|
||||
}
|
||||
// Get size of pointer
|
||||
m_fPointerImageOffsetX = 0; //floor(fPointerWidth/2.0f);
|
||||
m_fPointerImageOffsetY = 0; //floor(fPointerHeight/2.0f);
|
||||
@@ -142,11 +149,46 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
|
||||
|
||||
UIVec2D sectionPos;
|
||||
GetPositionOfSection( m_eCurrSection, &( sectionPos ) );
|
||||
UIControl *pInitPanel = GetMainPanel();
|
||||
if (pInitPanel)
|
||||
{
|
||||
pInitPanel->UpdateControl();
|
||||
sectionPos.x += (float)pInitPanel->getXPos();
|
||||
sectionPos.y += (float)pInitPanel->getYPos();
|
||||
float fMainX = (float)pInitPanel->getXPos();
|
||||
float fMainY = (float)pInitPanel->getYPos();
|
||||
float fMainMaxX = fMainX + (float)pInitPanel->getWidth();
|
||||
float fMainMaxY = fMainY + (float)pInitPanel->getHeight();
|
||||
float fInvMinX = fMainX + (float)m_slotListInventory.getXPos();
|
||||
float fInvMaxX = fInvMinX + (float)m_slotListInventory.getWidth();
|
||||
float fHotMinX = fMainX + (float)m_slotListHotbar.getXPos();
|
||||
float fHotMaxX = fHotMinX + (float)m_slotListHotbar.getWidth();
|
||||
if (fMainX < m_fPanelMinX) m_fPanelMinX = fMainX;
|
||||
if (fMainY < m_fPanelMinY) m_fPanelMinY = fMainY;
|
||||
if (fMainMaxX > m_fPanelMaxX) m_fPanelMaxX = fMainMaxX;
|
||||
if (fMainMaxY > m_fPanelMaxY) m_fPanelMaxY = fMainMaxY;
|
||||
if (fInvMinX < m_fPanelMinX) m_fPanelMinX = fInvMinX;
|
||||
if (fHotMinX < m_fPanelMinX) m_fPanelMinX = fHotMinX;
|
||||
if (fInvMaxX > m_fPanelMaxX) m_fPanelMaxX = fInvMaxX;
|
||||
if (fHotMaxX > m_fPanelMaxX) m_fPanelMaxX = fHotMaxX;
|
||||
if (m_fPanelMinX - fPointerWidth < m_fPointerMinX) m_fPointerMinX = m_fPanelMinX - fPointerWidth;
|
||||
if (m_fPanelMaxX + fPointerWidth > m_fPointerMaxX) m_fPointerMaxX = m_fPanelMaxX + fPointerWidth;
|
||||
if (m_fPanelMaxY + (fPointerHeight/2) > m_fPointerMaxY) m_fPointerMaxY = m_fPanelMaxY + (fPointerHeight/2);
|
||||
}
|
||||
|
||||
UIVec2D vPointerPos = sectionPos;
|
||||
vPointerPos += itemPos;
|
||||
vPointerPos.x += ( itemSize.x / 2.0f );
|
||||
vPointerPos.y += ( itemSize.y / 2.0f );
|
||||
#ifdef _WINDOWS64
|
||||
{ FILE *cf = fopen("inv_debug.log", "a"); if (cf) { int isz = m_slotListInventory.GetSlotSize(); int ihz = m_slotListHotbar.GetSlotSize();
|
||||
int icnt = m_slotListInventory.GetFlashSlotCount(); int hcnt = m_slotListHotbar.GetFlashSlotCount();
|
||||
fprintf(cf, "INIT mainpanel=(%.1f,%.1f) invlist=(%d,%d %dx%d) slotread_inv=%d slotread_hot=%d flashcount_inv=%d flashcount_hot=%d bg=(%.1f,%.1f %.1fx%.1f) pmin=(%.1f,%.1f) pmax=(%.1f,%.1f)\n",
|
||||
pInitPanel ? (float)pInitPanel->getXPos() : -999.0f, pInitPanel ? (float)pInitPanel->getYPos() : -999.0f,
|
||||
m_slotListInventory.getXPos(), m_slotListInventory.getYPos(), m_slotListInventory.getWidth(), m_slotListInventory.getHeight(), isz, ihz, icnt, hcnt,
|
||||
fPanelX, fPanelY, fPanelWidth, fPanelHeight, m_fPointerMinX, m_fPointerMinY, m_fPointerMaxX, m_fPointerMaxY);
|
||||
fclose(cf); } }
|
||||
#endif
|
||||
|
||||
vPointerPos.x -= m_fPointerImageOffsetX;
|
||||
vPointerPos.y -= m_fPointerImageOffsetY;
|
||||
@@ -172,11 +214,11 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::tick()
|
||||
void UIScene_AbstractContainerMenu::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
|
||||
onMouseTick();
|
||||
onMouseTick(this);
|
||||
|
||||
IggyEvent mouseEvent;
|
||||
S32 width, height;
|
||||
@@ -193,6 +235,26 @@ void UIScene_AbstractContainerMenu::tick()
|
||||
|
||||
IggyEventResult result;
|
||||
IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result );
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
{
|
||||
IggyValuePath pointerPath;
|
||||
if (IggyValuePathMakeNameRef(&pointerPath, m_rootPath, "pointerIcon"))
|
||||
{
|
||||
IggyValueSetBooleanRS(&pointerPath, registerFastName(L"visible"), NULL, true);
|
||||
}
|
||||
if (hasMovie())
|
||||
{
|
||||
UIControl *pMainPanel = GetMainPanel();
|
||||
if (pMainPanel)
|
||||
{
|
||||
pMainPanel->UpdateControl();
|
||||
IggyValueSetF64RS(m_cursorPath.getIggyValuePath(), registerFastName(L"x"), NULL, (F64)(m_pointerPos.x - (float)pMainPanel->getXPos()));
|
||||
IggyValueSetF64RS(m_cursorPath.getIggyValuePath(), registerFastName(L"y"), NULL, (F64)(m_pointerPos.y - (float)pMainPanel->getYPos()));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eViewportType viewpBort)
|
||||
|
||||
Reference in New Issue
Block a user