void BoggleWindow::setBoardSizeLarge() { updateBoardSize(LARGE); }
void MainMenuUi::initWindow() { window->SetStyle(Style::Fullscreen); window->SetRequisition(Vector2f((float) ct::WindowWidth, (float) ct::WindowHeight)); auto mMpLabel = Label::Create("Minesweeper: Multiplayer Edition"); mMpLabel->SetAlignment(Vector2f(0.5f, 0.5f)); mMpLabel->SetClass("MMpLabel"); auto playSpButton = Button::Create("Play Singleplayer"); playSpButton->GetSignal(Widget::OnLeftClick).Connect(playSpAction); auto playLocalMpButton = Button::Create("Play Local Multiplayer"); playLocalMpButton->GetSignal(Widget::OnLeftClick).Connect(playLocalMpAction); auto exitButton = Button::Create("Exit"); exitButton->GetSignal(Widget::OnLeftClick).Connect(exitAction); auto mainBox = Box::Create(Box::Orientation::VERTICAL, 2); auto playBox = Box::Create(Box::Orientation::VERTICAL, 2); playBox->Pack(playSpButton); playBox->Pack(playLocalMpButton); auto playFrame = Frame::Create("Play"); playFrame->Add(playBox); playFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.2f)); auto boardSizeBox = Box::Create(Box::Orientation::HORIZONTAL, 5); boardSizeScale = Scale::Create(8.0f, 20.0f, 1.0f, Scale::Orientation::HORIZONTAL); boardSizeScale->SetValue(15.0f); boardSizeScale->SetRequisition(Vector2f(0.0f, ct::WindowWidth * 0.08f)); boardSizeScale->GetAdjustment()->GetSignal(Adjustment::OnChange) .Connect(bind(&MainMenuUi::updateBoardSize, this)); boardSizeLabel = Label::Create(); boardSizeLabel->SetRequisition(Vector2f(ct::WindowWidth * 0.05f, 0.0f)); boardSizeBox->Pack(Label::Create("Size:"), false, false); boardSizeBox->Pack(createAlignment(boardSizeScale, Vector2f(0.5f, 0.5f), Vector2f(1.0f, 1.0f))); boardSizeBox->Pack(createAlignment(boardSizeLabel, Vector2f(1.0f, 0.5f), Vector2f(0.0f, 0.0f)), false, false); auto mineCountBox = Box::Create(Box::Orientation::HORIZONTAL, 5); mineCountScale = Scale::Create(Range::Orientation::HORIZONTAL); mineCountScale->SetIncrements(1.0f, 1.0f); mineCountScale->SetRequisition(Vector2f(0.0f, ct::WindowWidth * 0.08f)); mineCountScale->GetAdjustment()->GetSignal(Adjustment::OnChange) .Connect(bind(&MainMenuUi::updateMineCount, this)); mineCountLabel = Label::Create(); mineCountLabel->SetRequisition(Vector2f(ct::WindowWidth * 0.05f, 0.0f)); mineCountBox->Pack(Label::Create("Mines: "), false, false); mineCountBox->Pack(createAlignment(mineCountScale, Vector2f(0.5f, 0.5f), Vector2f(1.0f, 1.0f))); mineCountBox->Pack(createAlignment(mineCountLabel, Vector2f(1.0f, 0.5f), Vector2f(0.0f, 0.0f)), false, false); updateBoardSize(); auto settingsBox = Box::Create(Box::Orientation::VERTICAL, 0); settingsBox->Pack(boardSizeBox); settingsBox->Pack(mineCountBox); auto settingsFrame = Frame::Create("Settings"); settingsFrame->Add(settingsBox); settingsFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.15f)); mainBox->Pack(mMpLabel); mainBox->Pack(playFrame); mainBox->Pack(settingsFrame); mainBox->Pack(exitButton); window->Add(createAlignment(mainBox, Vector2f(0.5f, 0.5f), Vector2f(0.7f, 0.7f))); }
void BoggleWindow::setBoardSizeSmall() { updateBoardSize(SMALL); }