void SelectLevel() { unsigned char i, j; SCROLL_WHEEL_DIRECTION scrollDir; char buffer[32]; oledPutROMString((ROM_STRING)" SELECT LEVEL ",0,0); scrollDir = GetScrollDirection(); if (scrollDir == SCROLL_UP) { if (g_menuSelected > 0) g_menuSelected --; } else if (scrollDir == SCROLL_DOWN) { if (g_menuSelected < (LEVELS-1)) g_menuSelected ++; } if ((g_menuSelected - firstLevel) == 3 && (firstLevel < (LEVELS-4))) firstLevel++; if ((g_menuSelected - firstLevel) == 0 && (firstLevel > 0)) firstLevel--; j = 0; for (i = firstLevel; i < firstLevel+4; i++) { sprintf((char *)buffer, (const far rom char *)(" Level %d "), i); if (g_menuSelected == i) { oledPutNegString((unsigned char *)buffer,j+2,0); } else oledPutString((unsigned char *)buffer,j+2,0); j++; } w1 = mTouchReadButton(3); if (w1 < 600) { DemoIntroState = 6; g_menuSelected = 1; } w1 = mTouchReadButton(0); if (w1 < 600) { DemoIntroState = 0xFF; g_level=g_menuSelected; loadLevel(g_level); } }
bool ListPanel::ArrangeChildren(const Rect2F& limitRect/*=Rect2F::Zero*/,NodeLayoutArrangeFlags arrangeFlags/*=NodeLayoutArrangeFlags::None*/) { Point2F totalMovment=mScrollModel->Offset(); Rect2F targetBoundingBox=mScrollModel->CurrentWindow(); //at this point,node tree is changed if (GetScrollDirection().IsHorizontal()) { Point2F begin(0,0); begin+=totalMovment; Rect2F childRect=Rect2F::Zero; childRect.Size.Height=mSize.Height; childRect.Origin=begin; for (auto child : mItems) { const Size2F& childMeasuredSize=child->MeasuredSize(); childRect.Size.Width=childMeasuredSize.Width; childRect.Origin.X+=childRect.Size.Width; child->ArrangeRecursively(childRect,arrangeFlags); } targetBoundingBox.Size.Height=mSize.Height; targetBoundingBox.Size.Width=childRect.Right(); targetBoundingBox.Origin=begin; } else { Point2F begin(0,mSize.Height); begin+=totalMovment; Rect2F childRect=Rect2F::Zero; childRect.Size.Width=mSize.Width; childRect.Origin=begin; for (auto child : mItems) { const Size2F& childMeasuredSize=child->MeasuredSize(); childRect.Size.Height=childMeasuredSize.Height; childRect.Origin.Y-=childRect.Size.Height; child->ArrangeRecursively(childRect,arrangeFlags); } targetBoundingBox.Size.Width=mSize.Width; targetBoundingBox.Size.Height=childRect.Origin.Y-begin.Y; targetBoundingBox.Origin=begin; } OnInitializeTargetBoundingBox(); UpdateScrollStatus(); return true; }
bool ScrollPanel::IsHorizontal() const { return GetScrollDirection().IsHorizontal(); }
bool ScrollPanel::IsVertical() const { return GetScrollDirection().IsVertical(); }
void DemoIntroduction(void) { unsigned char i ; unsigned int w1, w2; unsigned char touchedNow; SCROLL_WHEEL_DIRECTION scrollDir; switch(DemoIntroState) { case 0: ResetDevice(); FillDisplay(0x00); oledPutROMString((ROM_STRING)" Labyrinth Demo v1.0 ",0,0); oledPutROMString((ROM_STRING)" by Daniel Szot ",1,0); oledPutROMString((ROM_STRING)" ",2,0); oledPutROMString((ROM_STRING)" MB Turnkey Design ",3,0); oledPutROMString((ROM_STRING)" mbturnkeydesign.com ",4,0); oledPutROMString((ROM_STRING)"Press Menu to proceed",6,0); DemoIntroState = 1; break; case 1: if(CheckButtonPressed() == TRUE) { DemoIntroState=4; } break; case 4: oledPutROMString((ROM_STRING)" 1. Use scroll to ",0,0); oledPutROMString((ROM_STRING)" select menu items. ",1,0); oledPutROMString((ROM_STRING)" 2. Tilt the board ",2,0); oledPutROMString((ROM_STRING)" to move the ball. ",3,0); oledPutROMString((ROM_STRING)" 3. Have a good time.",4,0); oledPutROMString((ROM_STRING)" ",5,0); oledPutROMString((ROM_STRING)"Press Menu to proceed",6,0); DemoIntroState = 5; break; case 5: if(CheckButtonPressed() == TRUE) { DemoIntroState++; } break; case 6: scrollDir = GetScrollDirection(); if (scrollDir == SCROLL_UP) { if (g_menuSelected > 0) g_menuSelected --; } else if (scrollDir == SCROLL_DOWN) { if (g_menuSelected < 3) g_menuSelected ++; } oledPutROMString((ROM_STRING)" LABIRYNTH MENU ",0,0); oledPutROMString(empty_line,1,0); if (g_menuSelected == 0) oledPutROMNegString((ROM_STRING)" NEW GAME ",2,0); else oledPutROMString((ROM_STRING)" NEW GAME ",2,0); if (g_menuSelected == 1) oledPutROMNegString((ROM_STRING)" SELECT LEVEL ",3,0); else oledPutROMString((ROM_STRING)" SELECT LEVEL ",3,0); if (g_menuSelected == 2) oledPutROMNegString((ROM_STRING)" CALIBRATE ",4,0); else oledPutROMString((ROM_STRING)" CALIBRATE ",4,0); if (g_menuSelected == 3) oledPutROMNegString((ROM_STRING)" QUIT GAME ",5,0); else oledPutROMString((ROM_STRING)" QUIT GAME ",5,0); oledPutROMString(empty_line,6,0); w1 = mTouchReadButton(0); if (w1 < 600) { switch(g_menuSelected) { case 0: DemoIntroState = 0xFF; g_level=0; loadLevel(g_level); break; case 1: DemoIntroState = 9; DelayMs(100); FillDisplay(0x00); g_menuSelected = 0; firstLevel = 0; break; case 2: DemoIntroState = 7; DelayMs(100); FillDisplay(0x00); break; case 3: _asm RESET _endasm break; } } break; case 7: CalibrateAcc(); break; case 8: FillDisplay(0xFF); oledPutROMNegString((ROM_STRING)" CORNGRATULATIONS! ",0,0); oledPutROMNegString((ROM_STRING)" You won nothing ",2,0); oledPutROMNegString((ROM_STRING)" You just waste your ",3,0); oledPutROMNegString((ROM_STRING)" PRECIOUS time :) ",4,0); DelayMs(2000); DemoIntroState = 6; FillDisplay(0x00); g_level = 0; g_ballGtt = 0; break; case 9: SelectLevel(); break; default: break; } }