void CritterDialogReview::init() { if (_initialized) return; State::init(); setFullscreen(false); setModal(false); auto background = new UI::Image("art/intrface/review.frm"); Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2); background->setPosition(backgroundPos); // Interface buttons auto doneButton = new UI::ImageButton(UI::ImageButton::Type::DIALOG_DONE_BUTTON, backgroundPos + Point(500, 398)); doneButton->mouseClickHandler().add(std::bind(&CritterDialogReview::onDoneButtonClick, this, std::placeholders::_1)); auto upButton = new UI::ImageButton(UI::ImageButton::Type::DIALOG_BIG_UP_ARROW, backgroundPos + Point(476, 154)); upButton->mouseClickHandler().add(std::bind(&CritterDialogReview::onUpButtonClick, this, std::placeholders::_1)); auto downButton = new UI::ImageButton(UI::ImageButton::Type::DIALOG_BIG_DOWN_ARROW, backgroundPos + Point(476, 192)); downButton->mouseClickHandler().add(std::bind(&CritterDialogReview::onDownButtonClick, this, std::placeholders::_1)); addUI(background); addUI(doneButton); addUI(upButton); addUI(downButton); auto list = new UI::TextAreaList(Point(88,76)); list->setSize(Size(340,340)); addUI("list",list); }
void LoadGame::init() { if (_initialized) return; State::init(); setModal(true); setFullscreen(true); auto game = Game::getInstance(); //auto player = Game::getInstance()->player(); // background auto bg = new UI::Image("art/intrface/lsgame.frm"); Point bgPos = Point((game->renderer()->size() - bg->size()) / 2); auto bgX = bgPos.x(); auto bgY = bgPos.y(); bg->setPosition(bgPos); addUI(bg); // BUTTONS // button: up arrow addUI("button_up", new UI::ImageButton(UI::ImageButton::Type::SMALL_UP_ARROW, bgX+35, bgY+58)); // button: down arrow addUI("button_down", new UI::ImageButton(UI::ImageButton::Type::SMALL_DOWN_ARROW, bgX+35, bgY+72)); // button: Done auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, bgX+391, bgY+349); doneButton->mouseClickHandler().add(std::bind(&LoadGame::onDoneButtonClick, this, std::placeholders::_1)); addUI(doneButton); // button: Cancel auto cancelButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, bgX+495, bgY+349); cancelButton->mouseClickHandler().add([this](Event::Event* event){ this->doCancel(); }); addUI(cancelButton); // LABELS auto font3_907824ff = ResourceManager::getInstance()->font("font3.aaf"); SDL_Color color = {0x90, 0x78, 0x24, 0xff}; // LOAD GAME LABEL auto saveGameLabel = new UI::TextArea(_t(MSG_LOAD_SAVE, 110), bgX+48, bgY+27); saveGameLabel->setFont(font3_907824ff, color); addUI(saveGameLabel); // DONE BUTTON LABEL auto doneButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 300), bgX+410, bgY+348); doneButtonLabel->setFont(font3_907824ff, color); addUI(doneButtonLabel); // CANCEL BUTTON LABEL auto cancelButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 121), bgX+515, bgY+348); cancelButtonLabel->setFont(font3_907824ff, color); addUI(cancelButtonLabel); }
/* * TODO: * ==== * - display value of a port (nice to have) * - triangle port (nice to have) * - mouse over (over a node or port) (nice to have) * - round shaped nodes (nice to have) */ namespace Magus { //****************************************************************************/ QtNodeEditor::QtNodeEditor(QWidget* parent) : QWidget(parent) { QVBoxLayout* mainLayout = new QVBoxLayout; mView = new QGraphicsView(this); mScene = new QtNodeGraphicsScene(); mScene->installEventFilter(this); mView->setScene(mScene); mView->setRenderHint(QPainter::Antialiasing, true); mView->setInteractive(true); mView->setMouseTracking(true); mainLayout->addWidget(mView); mLastRemovedNode = 0; mRubberBand = 0; mZoom = 1.0f; mFisheyeViewEnabled = false; mFisheyeMaxZoom = 1.0f; mFisheyeSteps = 5; mHeaderTitleIcon = NODE_HEADER_COMPOUND_ICON; mAction1Icon = NODE_HEADER_ACTION1_ICON; mAction2Icon = NODE_HEADER_ACTION2_ICON; mCompoundNodeDropped = 0; mRubberbandSelection = false; mContextMenuEnabled = true; mContextMenu = new QMenu(this); mContextMenu->addAction(new QAction(NODE_ACTION_DELETE, this)); mContextMenu->addAction(new QAction(NODE_ACTION_CENTER, this)); mZoomSubMenu = mContextMenu->addMenu(NODE_ACTION_ZOOM); QAction* action; QActionGroup actionGroupZoom(mZoomSubMenu); actionGroupZoom.setExclusive(true); action = new QAction(NODE_ACTION_ZOOM_10, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_25, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_50, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_75, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_90, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_100, this); action->setCheckable(true); action->setChecked(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_150, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_200, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_250, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_300, this); action->setCheckable(true); actionGroupZoom.addAction(action); mZoomSubMenu->addActions(actionGroupZoom.actions()); mFisheyeViewSubMenu = mContextMenu->addMenu(NODE_ACTION_FISHEY_VIEW); QActionGroup actionGroupFisheye(mFisheyeViewSubMenu); actionGroupFisheye.setExclusive(true); action = new QAction(NODE_ACTION_FISHEYE_DISABLED, this); action->setCheckable(true); action->setChecked(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_NORMAL, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_NORMAL_SUBTLE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_LARGE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_LARGE_SUBTLE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); mFisheyeViewSubMenu->addActions(actionGroupFisheye.actions()); mContextMenu->addAction(new QAction(NODE_ACTION_SELECTED_TO_COMPOUND, this)); mContextMenu->addAction(new QAction(NODE_ACTION_COLLAPSE_ALL, this)); mContextMenu->addAction(new QAction(NODE_ACTION_EXPAND_ALL, this)); mContextMenu->addAction(new QAction(NODE_ACTION_EXPAND_COMPOUNDS, this)); mContextMenu->addAction(new QAction(NODE_ACTION_CENTER, this)); setMenuZoomEnabled(true); setMenuSelectionToCompoundEnabled(true); setMenuCollapseExpandEnabled(true); setMenuExpandCompoundsEnabled(true); setMenuFisheyeViewEnabled(true); setContextMenuPolicy(Qt::CustomContextMenu); connect(mContextMenu, SIGNAL(triggered(QAction*)), this, SLOT(contextMenuItemSelected(QAction*))); setLayout(mainLayout); } //****************************************************************************/ QtNodeEditor::~QtNodeEditor(void) { } //****************************************************************************/ void QtNodeEditor::setContextMenuEnabled(bool enabled) { mContextMenuEnabled = enabled; } //****************************************************************************/ void QtNodeEditor::setCompoundHeaderTitleIcon(const QString& fileNameIcon) { mHeaderTitleIcon = fileNameIcon; } //****************************************************************************/ void QtNodeEditor::setCompoundAction1Icon(const QString& fileNameIcon) { mAction1Icon = fileNameIcon; } //****************************************************************************/ void QtNodeEditor::setCompoundAction2Icon(const QString& fileNameIcon) { mAction2Icon = fileNameIcon; } //****************************************************************************/ bool QtNodeEditor::isContextMenuEnabled(void) { return mContextMenuEnabled; } //****************************************************************************/ void QtNodeEditor::setMenuZoomEnabled(bool enabled) { mMenuZoomEnabled = enabled; QAction* action = getActionFromContextMenu(NODE_ACTION_ZOOM); if (action) action->setVisible(enabled); } //****************************************************************************/ bool QtNodeEditor::isMenuZoomEnabled(void) { return mMenuZoomEnabled; } //****************************************************************************/ void QtNodeEditor::setMenuSelectionToCompoundEnabled(bool enabled) { mMenuSelectionToCompoundEnabled = enabled; QAction* action = getActionFromContextMenu(NODE_ACTION_SELECTED_TO_COMPOUND); if (action) action->setVisible(enabled); } //****************************************************************************/ bool QtNodeEditor::isMenuSelectionToCompoundEnabled(void) { return mMenuSelectionToCompoundEnabled; } //****************************************************************************/ void QtNodeEditor::setMenuCollapseExpandEnabled(bool enabled) { mMenuCollapseExpandEnabled = enabled; QAction* action = getActionFromContextMenu(NODE_ACTION_EXPAND_ALL); if (action) action->setVisible(enabled); action = getActionFromContextMenu(NODE_ACTION_COLLAPSE_ALL); if (action) action->setVisible(enabled); } //****************************************************************************/ bool QtNodeEditor::isMenuCollapseExpandEnabled(void) { return mMenuCollapseExpandEnabled; } //****************************************************************************/ void QtNodeEditor::setMenuExpandCompoundsEnabled(bool enabled) { mMenuExpandCompoundsEnabled = enabled; QAction* action = getActionFromContextMenu(NODE_ACTION_EXPAND_COMPOUNDS); if (action) action->setVisible(enabled); } //****************************************************************************/ bool QtNodeEditor::isMenuExpandCompoundsEnabled(void) { return mMenuExpandCompoundsEnabled; } //****************************************************************************/ void QtNodeEditor::setMenuFisheyeViewEnabled(bool enabled) { mMenuFisheyeViewEnabled = enabled; QAction* action = getActionFromContextMenu(NODE_ACTION_FISHEY_VIEW); if (action) action->setVisible(enabled); } //****************************************************************************/ bool QtNodeEditor::isMenuFisheyeViewEnabled(void) { return mMenuFisheyeViewEnabled; } //****************************************************************************/ void QtNodeEditor::setFisheyeView(bool enabled, qreal maxZoom, unsigned int steps) { mFisheyeViewEnabled = enabled; mFisheyeMaxZoom = maxZoom; mFisheyeSteps = steps; } //****************************************************************************/ QGraphicsItem* QtNodeEditor::itemAtExceptActiveConnection(const QPointF& pos) { QList<QGraphicsItem*> items = mScene->items(QRectF(pos - QPointF(1,1), QSize(3,3))); bool isActive = isActiveConnection(); foreach(QGraphicsItem* item, items) { // If there is an active connection, it is not returned as a selected item // Finalized (established) connections are returned if (item->isVisible()) { if (isConnection(item)) { if (!isActive) return item; } else return item; } } return 0; } //****************************************************************************/ QtCompoundNode* QtNodeEditor::nodeOverCompound(QtNode* node) { if (!node) return 0; QtCompoundNode* compound; QList<QGraphicsItem*> items = mScene->items(); int subType; qreal halfWidth; foreach(QGraphicsItem* item, items) { if (isCompoundNode(item) && item->isVisible()) { compound = static_cast<QtCompoundNode*>(item); if (node != compound && !compound->isSelected()) { halfWidth = 0.5 * compound->getWidth(); if (node->scenePos().x() > compound->scenePos().x() - halfWidth && node->scenePos().x() < compound->scenePos().x() + halfWidth && node->scenePos().y() > compound->scenePos().y() && node->scenePos().y() < compound->scenePos().y() + compound->getHeigth()) { return compound; } } } } return 0; } //****************************************************************************/ bool QtNodeEditor::eventFilter(QObject* object, QEvent* event) { QGraphicsSceneMouseEvent* mouseEvent = (QGraphicsSceneMouseEvent*) event; QGraphicsItem* item = 0; switch ((int) event->type()) { case QEvent::GraphicsSceneMousePress: mouseClickHandler(mouseEvent); break; case QEvent::GraphicsSceneMouseDoubleClick: mouseDoubleClickHandler(mouseEvent); break; case QEvent::GraphicsSceneMouseMove: { mouseMoveHandler(mouseEvent); } break; case QEvent::GraphicsSceneMouseRelease: { mouseReleaseHandler(mouseEvent); } break; } return QObject::eventFilter(object, event); }
void PlayerEditAge::init() { if (_initialized) return; State::init(); setFullscreen(false); setModal(true); Point backgroundPos = Point((Game::getInstance()->renderer()->size() - Point(640, 480)) / 2); int backgroundX = backgroundPos.x(); int backgroundY = backgroundPos.y(); auto bg = new UI::Image("art/intrface/charwin.frm"); bg->setPosition(backgroundPos + Point(160, 0)); auto ageBox = new UI::Image("art/intrface/agebox.frm"); ageBox->setPosition(backgroundPos + Point(168, 10)); auto doneBox = new UI::Image("art/intrface/donebox.frm"); doneBox->setPosition(backgroundPos + Point(175, 40)); auto decButton = new UI::ImageButton(UI::ImageButton::Type::LEFT_ARROW, backgroundX+178, backgroundY+14); decButton->mouseClickHandler().add(std::bind(&PlayerEditAge::onDecButtonClick, this, std::placeholders::_1)); auto incButton = new UI::ImageButton(UI::ImageButton::Type::RIGHT_ARROW, backgroundX+262, backgroundY+14); incButton->mouseClickHandler().add(std::bind(&PlayerEditAge::onIncButtonClick, this, std::placeholders::_1)); auto doneButton= new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+188, backgroundY+43); doneButton->mouseClickHandler().add(std::bind(&PlayerEditAge::onDoneButtonClick, this, std::placeholders::_1)); auto doneLabel = new UI::TextArea(_t(MSG_EDITOR, 100), backgroundX+210, backgroundY+43); doneLabel->setFont("font3.aaf", {0xb8, 0x9c, 0x28, 0xff}); _counter = new UI::BigCounter(backgroundX+215, backgroundY+13); _counter->setNumber(Game::getInstance()->player()->age()); addUI(bg); addUI(ageBox); addUI(doneBox); addUI(incButton); addUI(decButton); addUI(doneLabel); addUI(doneButton); addUI(_counter); }
/**************************************************************************** ** ** Copyright (C) 2015 ** ** This file is generated by the Magus toolkit ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ // Include #include <QHBoxLayout> #include <QVBoxLayout> #include <QMessageBox> #include <QHeaderView> #include <QEvent> #include <QImage> #include <QPixmap> #include <QTreeWidgetItem> #include "tool_sceneviewwidget.h" namespace Magus { //****************************************************************************/ QtSceneViewWidget::QtSceneViewWidget(const QString& iconDir, QWidget* parent) : QWidget(parent) { setWindowTitle(QString("Scene view")); mIconDir = iconDir; QVBoxLayout* mainLayout = new QVBoxLayout; mSearchLayout = new QHBoxLayout; mTreeLayout = new QVBoxLayout; // Create edit mSearchLine = new QLineEdit(); connect(mSearchLine, SIGNAL(textChanged(QString)), this, SLOT(searchLineTextChanged(QString))); // Create findbutton QImage imageSearch(mIconDir + TOOL_SCENEVIEW_ICON_SEARCH); QPixmap pixMapSearch = QPixmap::fromImage(imageSearch).scaled(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH); mSearchLabel = new QLabel(); mSearchLabel->setPixmap(pixMapSearch); mSearchLabel->setContentsMargins(-8, -8, -8, -8); // Create clearbutton QImage imageClear(mIconDir + TOOL_SCENEVIEW_ICON_CLOSE); QPixmap pixMapClear = QPixmap::fromImage(imageClear).scaled(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH); mSearchClearButton = new QPushButton(); mSearchClearButton->setStyleSheet(QString("QPushButton {border: none; background: transparent;} QPushButton:hover {background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #565656, stop:1 #464646);}")); mSearchClearButton->setIcon(QIcon(pixMapClear)); mSearchClearButton->setIconSize(QSize(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH)); mSearchClearButton->setContentsMargins(-8, -8, -8, -8); connect(mSearchClearButton, SIGNAL(clicked()), this, SLOT(clearSearchLine())); // Misc mVisibilityIconVisibleForGroups = true; mVisibilityIconVisibleForAssets = true; mDeletionIconVisibleForGroups = true; mDeletionIconVisibleForAssets = true; // Layout mSearchLayout->addWidget(mSearchLabel, 1); mSearchLayout->addWidget(mSearchLine, 2000); mSearchLayout->addWidget(mSearchClearButton, 1); setVisibilitySearchWidgets(false); mainLayout->addLayout(mSearchLayout, 1); mainLayout->addLayout(mTreeLayout, 2000); setLayout(mainLayout); } //****************************************************************************/ QtSceneViewWidget::~QtSceneViewWidget(void) { // Delete all QtAssetGroups in mAssetGroupMap foreach (QtAssetGroup* group, mAssetGroupMap) delete group; mAssetGroupMap.clear(); } //****************************************************************************/ bool QtSceneViewWidget::eventFilter(QObject* object, QEvent* event) { QMouseEvent* mouseEvent = (QMouseEvent*) event; switch ((int) event->type()) { case QEvent::MouseButtonPress: mouseClickHandler(mouseEvent); break; } return QObject::eventFilter(object, event); }
/**************************************************************************** ** ** Copyright (C) 2016 - 2017 ** ** This file is generated by the Magus toolkit ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ // Include #include <QApplication> #include <QDesktopWidget> #include <QRect> #include <QHBoxLayout> #include <QVBoxLayout> #include <QMessageBox> #include <QHeaderView> #include <QEvent> #include <QPixmap> #include <QImage> #include <QMimeData> #include <QTableWidgetItem> #include <QTreeWidgetItem> #include <QVector2D> #include "constants.h" #include "paintlayer_widget.h" #include "paintlayer_dockwidget.h" #include "paintlayer_dialog.h" //****************************************************************************/ PaintLayerWidget::PaintLayerWidget(const QString& iconDir, PaintLayerDockWidget* paintLayerDockWidget, QWidget* parent) : QWidget(parent), mPaintLayerDockWidget(paintLayerDockWidget) { setWindowTitle(QString("Layers")); QHBoxLayout* mainLayout = new QHBoxLayout; QVBoxLayout* tableLayout = new QVBoxLayout; mIconDir = iconDir; mLayerIdCounter = 1; mListenToSceneId = 0; mListenToDeleteEvents = true; helperIntVector.clear(); // Create table mTable = new QTableWidget(0, 4, this); mTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mTable->setEditTriggers(QAbstractItemView::NoEditTriggers); mTable->setAcceptDrops(false); mTable->setShowGrid(false); mTable->viewport()->installEventFilter(this); QRect rect = QApplication::desktop()->screenGeometry(); mTable->setColumnWidth(TOOL_LAYER_COLUMN_ICON, 2 * TOOL_LAYER_ICON_WIDTH); mTable->setColumnWidth(TOOL_LAYER_COLUMN_NAME, TOOL_LAYER_NAME_WIDTH); mTable->setColumnWidth(TOOL_LAYER_COLUMN_VISIBILITY, 2 * TOOL_LAYER_ICON_WIDTH); mTable->setColumnWidth(TOOL_LAYER_COLUMN_FILLER, rect.width()); mTable->setSelectionBehavior(QAbstractItemView::SelectRows); setStyleSheet("QLineEdit{padding: 0 0px; margin-left: 0px; margin-right: 0px; max-height: 28px; height: 28px;}"); connect(mTable, SIGNAL(clicked(QModelIndex)), this, SLOT(tableClicked(QModelIndex))); connect(mTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(handleTableDoubleClicked(QModelIndex))); // Set headers QStringList headers; headers << tr("Edit") << tr("Layer name") << tr("Visibility") << tr(""); mTable->setHorizontalHeaderLabels(headers); QFont font; font.setBold(true); mTable->horizontalHeader()->setFont(font); mTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); // Contextmenu setContextMenuPolicy(Qt::CustomContextMenu); mContextMenu = new QMenu(mTable); mContextMenu->addAction(new QAction(TOOL_LAYER_ACTION_CREATE_LAYER, mTable)); mContextMenu->addAction(new QAction(TOOL_LAYER_ACTION_EDIT_LAYER, mTable)); mContextMenu->addAction(new QAction(TOOL_LAYER_ACTION_DELETE_LAYER, mTable)); mContextMenu->addAction(new QAction(TOOL_LAYER_ACTION_RENAME_LAYER, mTable)); mContextMenu->addAction(new QAction(TOOL_LAYER_ACTION_ALL_VISIBLE, mTable)); //mContextMenu->addAction(new QAction(QString("TEST"), mTable)); connect(mContextMenu, SIGNAL(triggered(QAction*)), this, SLOT(contextMenuItemSelected(QAction*))); // Layout tableLayout->addWidget(mTable); mainLayout->addLayout(tableLayout); setLayout(mainLayout); } //****************************************************************************/ PaintLayerWidget::~PaintLayerWidget(void) { QVector<QtLayer*>::iterator it; for (it = mLayerVec.begin(); it != mLayerVec.end(); ++it) delete *it; mLayerVec.clear(); // The table is automatically deleted when this widget is deleted } //****************************************************************************/ bool PaintLayerWidget::eventFilter(QObject* object, QEvent* event) { QMouseEvent* mouseEvent = (QMouseEvent*) event; switch ((int) event->type()) { case QEvent::MouseButtonPress: mouseClickHandler(mouseEvent); break; case QEvent::MouseButtonDblClick: mouseDblClickHandler(mouseEvent); break; break; } return QObject::eventFilter(object, event); }
void NewGame::init() { if (_initialized) return; State::init(); setFullscreen(true); setModal(true); auto renderer = Game::getInstance()->renderer(); setPosition((renderer->size() - Point(640, 480)) / 2); addUI("background", new UI::Image("art/intrface/pickchar.frm")); auto beginGameButton = addUI(new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, 81, 322)); beginGameButton->mouseClickHandler().add(std::bind(&NewGame::onBeginGameButtonClick, this, std::placeholders::_1)); auto editButton = addUI(new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, 436, 319)); editButton->mouseClickHandler().add(std::bind(&NewGame::onEditButtonClick, this, std::placeholders::_1)); auto createButton = addUI(new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, 81, 424)); createButton->mouseClickHandler().add(std::bind(&NewGame::onCreateButtonClick, this, std::placeholders::_1)); auto backButton = addUI(new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, 461, 424)); backButton->mouseClickHandler().add(std::bind(&NewGame::onBackButtonClick, this, std::placeholders::_1)); auto prevCharacterButton = addUI(new UI::ImageButton(UI::ImageButton::Type::LEFT_ARROW, 292, 320)); prevCharacterButton->mouseClickHandler().add(std::bind(&NewGame::onPrevCharacterButtonClick, this, std::placeholders::_1)); auto nextCharacterButton = addUI(new UI::ImageButton(UI::ImageButton::Type::RIGHT_ARROW, 318, 320)); nextCharacterButton->mouseClickHandler().add(std::bind(&NewGame::onNextCharacterButtonClick, this, std::placeholders::_1)); addUI("images", new UI::ImageList({ "art/intrface/combat.frm", "art/intrface/stealth.frm", "art/intrface/diplomat.frm" }, 27, 23)); addUI("name", new UI::TextArea(300, 40)); addUI("stats_1", new UI::TextArea(0, 70)); getTextArea("stats_1")->setWidth(362); getTextArea("stats_1")->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT); addUI("stats_2", new UI::TextArea(374, 70)); addUI("bio", new UI::TextArea(437, 40)); addUI("stats_3", new UI::TextArea(294, 150)); getTextArea("stats_3")->setWidth(85); getTextArea("stats_3")->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT); addUI("stats3_values", new UI::TextArea(383, 150)); }
void PlayerEditGender::init() { if (_initialized) return; State::init(); setFullscreen(false); setModal(true); Point bgPos = Point((Game::getInstance()->renderer()->size() - Point(640, 480)) / 2); int bgX = bgPos.x(); int bgY = bgPos.y(); auto bg = new UI::Image("art/intrface/charwin.frm"); bg->setPosition(bgPos + Point(236, 0)); _maleImage = new UI::ImageList((std::vector<std::string>){ "art/intrface/maleoff.frm", "art/intrface/maleon.frm" }, bgX+260, bgY+2); _maleImage->mouseClickHandler().add(std::bind(&PlayerEditGender::onMaleButtonPress, this, std::placeholders::_1)); _femaleImage = new UI::ImageList((std::vector<std::string>){ "art/intrface/femoff.frm", "art/intrface/femon.frm" }, bgX+310, bgY+2); _femaleImage->mouseClickHandler().add(std::bind(&PlayerEditGender::onFemaleButtonPress, this, std::placeholders::_1)); auto doneBox = new UI::Image("art/intrface/donebox.frm"); doneBox->setPosition(bgPos + Point(250, 42)); auto doneLabel = new UI::TextArea(_t(MSG_EDITOR, 100), bgX+281, bgY+45); doneLabel->setFont("font3.aaf", {0xb8, 0x9c, 0x28, 0xff}); auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, bgX+260, bgY+45); doneButton->mouseClickHandler().add(std::bind(&PlayerEditGender::onDoneButtonClick, this, std::placeholders::_1)); addUI(bg); addUI(doneBox); addUI(doneButton); addUI(doneLabel); addUI(_maleImage); addUI(_femaleImage); setGender(Game::getInstance()->player()->gender()); }
MultistateImageButton::MultistateImageButton(Type type, int x, int y) : Falltergeist::UI::Base(Point(x, y)) { mouseClickHandler() += std::bind(&MultistateImageButton::_onMouseClick, this, std::placeholders::_1); mouseUpHandler().add(std::bind(&MultistateImageButton::_onMouseUp, this, std::placeholders::_1)); switch (type) { case Type::BIG_SWITCH: { _sprite = make_shared<Graphics::Sprite>("art/intrface/prfbknbs.frm"); _rects.push_back({0,0*47,46,47}); _rects.push_back({0,1*47,46,47}); _rects.push_back({0,2*47,46,47}); _rects.push_back({0,3*47,46,47}); _maxState = 4; _size = Size(46,47); _downSound = "sound/sfx/ib3p1xx1.acm"; _upSound = "sound/sfx/ib3lu1x1.acm"; break; } case Type::SMALL_SWITCH: { _sprite = make_shared<Graphics::Sprite>("art/intrface/prflknbs.frm"); _rects.push_back({0,0*25,22,25}); _rects.push_back({0,1*25,22,25}); _maxState = 2; _size = Size(22,25); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; } default: throw Exception("MultistateImageButton::MultistateImageButton(unsigned int type, x, y) - unsupported type"); } }
void ImageButton::_init(Type type) { switch(type) { case Type::SMALL_RED_CIRCLE: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/lilredup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/lilreddn.frm")); _downSound = "sound/sfx/ib1p1xx1.acm"; _upSound = "sound/sfx/ib1lu1x1.acm"; break; case Type::BIG_RED_CIRCLE: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/bigredup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/bigreddn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::MENU_RED_CIRCLE: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/menuup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/menudown.frm")); _downSound = "sound/sfx/nmselec0.acm"; _upSound = "sound/sfx/nmselec1.acm"; break; case Type::SKILL_TOGGLE: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/tgskloff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/tgsklon.frm")); break; case Type::PLUS: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/splsoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/splson.frm")); break; case Type::MINUS: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/snegoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/snegon.frm")); break; case Type::LEFT_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/slu.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sld.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::RIGHT_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sru.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/srd.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::CHECKBOX: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/prfxout.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/prfxin.frm")); _upSound = "sound/sfx/ib2p1xx1.acm"; _checkboxMode = true; break; case Type::PLAYER_NAME: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/nameoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/nameon.frm")); break; case Type::PLAYER_AGE: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/ageoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/ageon.frm")); break; case Type::PLAYER_GENDER: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sexoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sexon.frm")); break; case Type::PANEL_INVENTORY: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invbutup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invbutdn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::PANEL_OPTIONS: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/optiup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/optidn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::PANEL_ATTACK: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sattkbup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/sattkbdn.frm")); _downSound = "sound/sfx/ib3p1xx1.acm"; _upSound = "sound/sfx/ib3lu1x1.acm"; break; case Type::PANEL_MAP: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/mapup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/mapdn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::PANEL_CHA: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/chaup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/chadn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::PANEL_PIP: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/pipup.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/pipdn.frm")); _downSound = "sound/sfx/ib2p1xx1.acm"; _upSound = "sound/sfx/ib2lu1x1.acm"; break; case Type::OPTIONS_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/opbtnoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/opbtnon.frm")); _downSound = "sound/sfx/ib3p1xx1.acm"; _upSound = "sound/sfx/ib3lu1x1.acm"; break; case Type::SKILLDEX_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/skldxoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/skldxon.frm")); _downSound = "sound/sfx/ib2lu1x1.acm"; _upSound = "sound/sfx/ib1p1xx1.acm"; break; case Type::INVENTORY_UP_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invupout.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invupin.frm")); break; case Type::INVENTORY_DOWN_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invdnout.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/invdnin.frm")); break; case Type::PIPBOY_ALARM_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/alarmout.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/alarmin.frm")); break; case Type::DIALOG_RED_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_rdbt2.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_rdbt1.frm")); break; case Type::DIALOG_REVIEW_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_rest1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_rest2.frm")); break; case Type::DIALOG_DONE_BUTTON: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_done1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_done2.frm")); break; case Type::DIALOG_BIG_UP_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_bgup1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_bgup2.frm")); break; case Type::DIALOG_BIG_DOWN_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_bgdn1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_bgdn2.frm")); break; case Type::DIALOG_UP_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_up1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_up2.frm")); break; case Type::DIALOG_DOWN_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_down1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/di_down2.frm")); break; case Type::SMALL_UP_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/uparwoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/uparwon.frm")); break; case Type::SMALL_DOWN_ARROW: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/dnarwoff.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/dnarwon.frm")); break; case Type::MAP_HOTSPOT: _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/hotspot1.frm")); _textures.push_back(ResourceManager::getInstance()->texture("art/intrface/hotspot2.frm")); break; default: throw Exception("ImageButton::Imagebutton() - wrong button type"); } mouseClickHandler().add(std::bind(&ImageButton::_onMouseClick, this, std::placeholders::_1)); mouseDownHandler().add(std::bind(&ImageButton::_onMouseDown, this, std::placeholders::_1)); mouseOutHandler().add(std::bind(&ImageButton::_onMouseOut, this, std::placeholders::_1)); }
void GameMenu::init() { if (_initialized) return; State::init(); setModal(true); setFullscreen(false); auto background = new UI::Image("art/intrface/opbase.frm"); auto panelHeight = Game::getInstance()->locationState()->playerPanel()->size().height(); auto backgroundPos = (Game::getInstance()->renderer()->size() - background->size() - Point(0, panelHeight)) / 2; int backgroundX = backgroundPos.x(); int backgroundY = backgroundPos.y(); auto saveGameButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18); auto loadGameButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37); auto preferencesButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*2); auto exitGameButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*3); auto doneButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*4); preferencesButton->mouseClickHandler().add([this](Event::Event* event){ this->doPreferences(); }); exitGameButton->mouseClickHandler().add( [this](Event::Event* event){ this->doExit(); }); doneButton->mouseClickHandler().add( [this](Event::Event* event){ this->closeMenu(); }); auto font = ResourceManager::getInstance()->font("font3.aaf", 0xb89c28ff); // label: save game auto saveGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 0), backgroundX+8, backgroundY+26); saveGameButtonLabel->setFont(font); saveGameButtonLabel->setSize({150, 0}); saveGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); saveGameButton->mouseClickHandler().add([this](Event::Event* event){ this->doSaveGame(); }); // label: load game auto loadGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 1), backgroundX+8, backgroundY+26+37); loadGameButtonLabel->setFont(font); loadGameButtonLabel->setSize({150, 0}); loadGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); loadGameButton->mouseClickHandler().add([this](Event::Event* event){ this->doLoadGame(); }); // label: preferences auto preferencesButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 2), backgroundX+8, backgroundY+26+37*2); preferencesButtonLabel->setFont(font); preferencesButtonLabel->setSize({150, 0}); preferencesButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); // label: exit game auto exitGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 3), backgroundX+8, backgroundY+26+37*3); exitGameButtonLabel->setFont(font); exitGameButtonLabel->setSize({150, 0}); exitGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); // label: done auto doneButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 4), backgroundX+8, backgroundY+26+37*4); doneButtonLabel->setFont(font); doneButtonLabel->setSize({150, 0}); doneButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); background->setPosition(backgroundPos); addUI(background); addUI(saveGameButton); addUI(loadGameButton); addUI(preferencesButton); addUI(exitGameButton); addUI(doneButton); addUI(saveGameButtonLabel); addUI(loadGameButtonLabel); addUI(preferencesButtonLabel); addUI(exitGameButtonLabel); addUI(doneButtonLabel); }
void SettingsMenu::init() { if (_initialized) return; State::init(); setModal(true); setFullscreen(true); // background auto background = new UI::Image("art/intrface/prefscrn.frm"); Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2); int backgroundX = backgroundPos.x(); int backgroundY = backgroundPos.y(); background->setPosition(backgroundPos); addUI(background); auto settings = Game::getInstance()->settings(); // Switches (big) auto combatDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+149); combatDifficultySwitch->setMaxState(3); combatDifficultySwitch->setState(settings->combatDifficulty()); addUI("combat_difficulty",combatDifficultySwitch); auto gameDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+71); gameDifficultySwitch->setMaxState(3); gameDifficultySwitch->setState(settings->gameDifficulty()); addUI("game_difficulty",gameDifficultySwitch); auto violenceLevelSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+227); violenceLevelSwitch->setState(settings->violenceLevel()); addUI("violence_level",violenceLevelSwitch); auto targetHighlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+309); targetHighlightSwitch->setMaxState(3); targetHighlightSwitch->setState(settings->targetHighlight()); addUI("target_highlight",targetHighlightSwitch); auto combatLooksSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+387); combatLooksSwitch->setMaxState(2); combatLooksSwitch->setState(settings->combatLooks()); addUI("combat_looks",combatLooksSwitch); // Switches (small) auto combatMessagesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74); combatMessagesSwitch->setState(settings->combatMessages()); addUI("combat_messages",combatMessagesSwitch); auto combatTauntsSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66); combatTauntsSwitch->setState(settings->combatTaunts()); addUI("combat_taunts",combatTauntsSwitch); auto languageFilterSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*2); languageFilterSwitch->setState(settings->languageFilter()); addUI("language_filter",languageFilterSwitch); auto runningSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*3); runningSwitch->setState(settings->running()); addUI("running",runningSwitch); auto subtitlesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*4); subtitlesSwitch->setState(settings->subtitles()); addUI("subtitles",subtitlesSwitch); auto itemHightlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*5); itemHightlightSwitch->setState(settings->itemHighlight()); addUI("item_highlight",itemHightlightSwitch); // LABELS SDL_Color color = {0x90, 0x78, 0x24, 0xff}; std::string font1_907824ff = "font1.aaf"; std::string font3_907824ff = "font3.aaf"; std::string font4_907824ff = "font4.aaf"; // GAME PREFERENCES _addTextArea(_t(MSG_OPTIONS, 100), backgroundX+74, backgroundY+10)->setFont(font4_907824ff, color); // COMBAT DIFFICULTY auto difficulty = _addTextArea(_t(MSG_OPTIONS, 101), backgroundX+21, backgroundY+48); difficulty->setWidth(158); difficulty->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER); difficulty->setFont(font3_907824ff, color); // GAME DIFFICULTY _addTextArea(difficulty, backgroundX+21, backgroundY+48+77)->setText(_t(MSG_OPTIONS, 102)); // VIOLENCE LEVEL _addTextArea(difficulty, backgroundX+21, backgroundY+48+156)->setText(_t(MSG_OPTIONS, 103)); // TARGET HIGHLIGHT _addTextArea(difficulty, backgroundX+21, backgroundY+128+158)->setText(_t(MSG_OPTIONS, 104)); // COMBAT LOOKS _addTextArea(difficulty, backgroundX+21, backgroundY+128+235)->setText(_t(MSG_OPTIONS, 105)); // COMBAT MESSAGES auto combatMessages = _addTextArea(_t(MSG_OPTIONS, 106), backgroundX+206, backgroundY+49); combatMessages->setFont(font3_907824ff, color); // COMBAT TAUNTS _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66)->setText(_t(MSG_OPTIONS, 107)); // LANGUAGE FILTER _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*2)->setText(_t(MSG_OPTIONS, 108)); // RUNNING _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*3)->setText(_t(MSG_OPTIONS, 109)); // SUBTITLES _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*4)->setText(_t(MSG_OPTIONS, 110)); // ITEM HIGHLIGHT _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*5)->setText(_t(MSG_OPTIONS, 111)); // COMBAT SPEED auto combatSpeed = _addTextArea(_t(MSG_OPTIONS, 112), backgroundX+384, backgroundY+19); combatSpeed->setFont(font3_907824ff, color); // TEXT DELAY _addTextArea(combatSpeed, backgroundX+384, backgroundY+95)->setText(_t(MSG_OPTIONS, 113)); // MASTER AUDIO VOLUME _addTextArea(combatSpeed, backgroundX+384, backgroundY+165)->setText(_t(MSG_OPTIONS, 114)); // MUSIC/MOVIE VOLUME _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51)->setText(_t(MSG_OPTIONS, 115)); // SOUND EFFECTS VOLUME _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*2)->setText(_t(MSG_OPTIONS, 116)); // SPEECH VOLUME _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*3)->setText(_t(MSG_OPTIONS, 117)); // BRIGHTNESS LEVEL _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*4)->setText(_t(MSG_OPTIONS, 118)); // MOUSE SENSITIVITY _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*5)->setText(_t(MSG_OPTIONS, 119)); // DEFAULT BUTTON LABEL auto label = _addTextArea(combatSpeed, backgroundX+43, backgroundY+449); label->setText(_t(MSG_OPTIONS, 120)); label->setFont(font3_907824ff, color); // DONE BUTTON LABEL label = _addTextArea(combatSpeed, backgroundX+169, backgroundY+449); label->setText(_t(MSG_OPTIONS, 300)); label->setFont(font3_907824ff, color); // CANCEL BUTTON LABEL label = _addTextArea(combatSpeed, backgroundX+283, backgroundY+449); label->setText(_t(MSG_OPTIONS, 121)); label->setFont(font3_907824ff, color); // COMBAT DIFFICULTY SWITCH LABELS _addTextArea(_t(MSG_OPTIONS, 203), backgroundX+50, backgroundY+81)->setFont(font1_907824ff, color); // EASY _addTextArea(_t(MSG_OPTIONS, 204), backgroundX+81, backgroundY+67)->setFont(font1_907824ff, color); // NORMAL _addTextArea(_t(MSG_OPTIONS, 205), backgroundX+122, backgroundY+81)->setFont(font1_907824ff, color); // HARD // GAME DIFFICULTY SWITCH LABELS _addTextArea(_t(MSG_OPTIONS, 206), backgroundX+45, backgroundY+159)->setFont(font1_907824ff, color); // WIMPY _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+83, backgroundY+145)->setFont(font1_907824ff, color); // NORMAL _addTextArea(_t(MSG_OPTIONS, 208), backgroundX+122, backgroundY+159)->setFont(font1_907824ff, color); // ROUGH // VIOLENCE LEVEL SWITCH LABELS _addTextArea(_t(MSG_OPTIONS, 214), backgroundX+48, backgroundY+236)->setFont(font1_907824ff, color); // NONE _addTextArea(_t(MSG_OPTIONS, 215), backgroundX+83, backgroundY+222)->setFont(font1_907824ff, color); // MINIMUM _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+122, backgroundY+236)->setFont(font1_907824ff, color); // NORMAL label = _addTextArea(_t(MSG_OPTIONS, 216).insert(8, " "), backgroundX+122, backgroundY+257); label->setFont(font1_907824ff, color); label->setWidth(50); label->setWordWrap(true); // MAXIMUM BLOOD // TARGET HIGHLIGHT SWITCH LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+319)->setFont(font1_907824ff, color); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+305)->setFont(font1_907824ff, color); // ON label = _addTextArea(_t(MSG_OPTIONS, 213).insert(10, " "), backgroundX+122, backgroundY+319); label->setFont(font1_907824ff, color); label->setWidth(60); label->setWordWrap(true); // TARGETING ONLY // COMBAT LOOKS SWITCH LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+397)->setFont(font1_907824ff, color); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+383)->setFont(font1_907824ff, color); // ON // COMBAT MESSAGES SWITCH LABELS auto verboseLabel = _addTextArea(_t(MSG_OPTIONS, 211), backgroundX+203, backgroundY+69); // VERBOSE verboseLabel->setFont(font1_907824ff, color); verboseLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT); verboseLabel->setWidth(100); _addTextArea(_t(MSG_OPTIONS, 212), backgroundX+320, backgroundY+69)->setFont(font1_907824ff, color); // BRIEF // COMBAT TAUNTS SWITCH LABELS _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67)->setText(_t(MSG_OPTIONS, 202)); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67)->setFont(font1_907824ff, color); // ON // LANGUAGE FILTER SWITCH LABELS _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66)->setText(_t(MSG_OPTIONS, 202)); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67+66)->setFont(font1_907824ff, color); // ON // RUNNING SWITCH LABELS _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64)->setText(_t(MSG_OPTIONS, 209)); // NORMAL _addTextArea(_t(MSG_OPTIONS, 219), backgroundX+320, backgroundY+69+67+66+64)->setFont(font1_907824ff, color); // ALWAYS // SUBTITLES SWITCH LABELS _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+66+65)->setText(_t(MSG_OPTIONS, 202)); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+66+67+66+65)->setFont(font1_907824ff, color); // OFF // ITEM HIGHLIGHT SWITCH LABELS _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64+65+68)->setText(_t(MSG_OPTIONS, 202)); // OFF _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+64+67+66+65+68)->setFont(font1_907824ff, color); // ON // AFFECT PLAYER SPEECH _addTextArea(_t(MSG_OPTIONS, 122), backgroundX+405, backgroundY+72)->setFont(font1_907824ff, color); // COMBAT SPEED SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+38)->setFont(font1_907824ff, color); // NORMAL auto fastestLabel = _addTextArea(_t(MSG_OPTIONS, 210), backgroundX+524, backgroundY+38); // FASTEST fastestLabel->setFont(font1_907824ff, color); fastestLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT); fastestLabel->setWidth(100); // TEXT DELAY SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 217), backgroundX+384, backgroundY+113)->setFont(font1_907824ff, color); // SLOW _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+484, backgroundY+113)->setFont(font1_907824ff, color); // NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+113)->setText(_t(MSG_OPTIONS, 218)); // FASTER // MASTER AUDIO VOLUME SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184)->setFont(font1_907824ff, color); // OFF _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184)->setFont(font1_907824ff, color); // QUIET _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184)->setFont(font1_907824ff, color); // NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184)->setText(_t(MSG_OPTIONS, 222)); // LOUD // MUSIC/MOVIE VOLUME SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51)->setFont(font1_907824ff, color); // OFF _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51)->setFont(font1_907824ff, color); // QUIET _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51)->setFont(font1_907824ff, color); // NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51)->setText(_t(MSG_OPTIONS, 222)); // LOUD // SOUND EFFECTS SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*2)->setFont(font1_907824ff, color);// OFF _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*2)->setFont(font1_907824ff, color);// QUIET _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*2)->setFont(font1_907824ff, color);// NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*2)->setText(_t(MSG_OPTIONS, 222)); // LOUD // SPEECH VOLUME SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*3)->setFont(font1_907824ff, color);// OFF _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*3)->setFont(font1_907824ff, color);// QUIET _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*3)->setFont(font1_907824ff, color);// NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*3)->setText(_t(MSG_OPTIONS, 222)); // LOUD // BRIGHTNESS LEVEL SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*4)->setFont(font1_907824ff, color);// NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*4)->setText(_t(MSG_OPTIONS, 223)); // BRIGHTER // MOUSE SENSITIVITY SLIDER LABELS _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*5)->setFont(font1_907824ff, color);// NORMAL _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*5)->setText(_t(MSG_OPTIONS, 218)); // FASTER // BUTTONS // button: Default auto defaultButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+23, backgroundY+450); defaultButton->mouseClickHandler().add(std::bind(&SettingsMenu::onDefaultButtonClick, this, std::placeholders::_1)); addUI(defaultButton); // button: Done auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+148, backgroundY+450); doneButton->mouseClickHandler().add([this](Event::Event* event){ this->doSave(); }); addUI(doneButton); // button: Cancel auto cancelButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+263, backgroundY+450); cancelButton->mouseClickHandler().add([this](Event::Event* event){ this->doCancel(); }); addUI(cancelButton); // button: Affect player speed auto affectPlayerSpeedCheckBox = new UI::ImageButton(UI::ImageButton::Type::CHECKBOX, backgroundX+383, backgroundY+68); affectPlayerSpeedCheckBox->setChecked(settings->playerSpeedup()); addUI("player_speedup", affectPlayerSpeedCheckBox); // SLIDERS // COMBAT SPEED SLIDER auto combatSpeedSlider = new UI::Slider(backgroundX+384, backgroundY+50); combatSpeedSlider->setMinValue(0.0); combatSpeedSlider->setMaxValue(50.0); combatSpeedSlider->setValue(settings->combatSpeed()); addUI("combat_speed",combatSpeedSlider); // TEXT DELAY SLIDER auto textDelaySlider = new UI::Slider(backgroundX+384, backgroundY+125); textDelaySlider->setValue(settings->textDelay()); addUI("text_delay",textDelaySlider); // MASTER AUDIO VOLUME SLIDER auto masterAudioVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196); masterAudioVolumeSlider->setValue(settings->masterVolume()); addUI("master_volume", masterAudioVolumeSlider); // MUSIC VOLUME SLIDER auto musicVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51); musicVolumeSlider->setValue(settings->musicVolume()); addUI("music_volume", musicVolumeSlider); musicVolumeSlider->changeHandler().add([=](Event::Event* evt) { Game::getInstance()->mixer()->setMusicVolume(musicVolumeSlider->value()); }); // SOUND EFFECTS VOLUME SLIDER auto soundEffectsVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*2); soundEffectsVolumeSlider->setValue(settings->sfxVolume()); addUI("sfx_volume", soundEffectsVolumeSlider); // SPEECH VOLUME SLIDER auto speechVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*3); speechVolumeSlider->setValue(settings->voiceVolume()); addUI("voice_volume", speechVolumeSlider); // BRIGHTNESS LEVEL SLIDER auto brightnessLevelSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*4); brightnessLevelSlider->setValue(settings->brightness()); addUI("brightness", brightnessLevelSlider); // MOUSE SENSITIVITY SLIDER auto mouseSensitivitySlider = new UI::Slider(backgroundX+384, backgroundY+196+51*5); mouseSensitivitySlider->setValue(settings->mouseSensitivity()); addUI("mouse_sensitivity",mouseSensitivitySlider); }
MultistateImageButton::MultistateImageButton(const Point& pos) : Falltergeist::UI::Base(pos) { mouseClickHandler() += std::bind(&MultistateImageButton::_onMouseClick, this, std::placeholders::_1); }
void PipBoy::init() { if (_initialized) return; State::init(); setModal(true); setFullscreen(true); Game::getInstance()->mouse()->pushState(Input::Mouse::Cursor::BIG_ARROW); // Background auto background = new UI::Image("art/intrface/pip.frm"); Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2); int backgroundX = backgroundPos.x(); int backgroundY = backgroundPos.y(); background->setPosition(backgroundPos); // Buttons auto alarmButton = new UI::ImageButton(UI::ImageButton::Type::PIPBOY_ALARM_BUTTON, backgroundX+124, backgroundY+13); auto statusButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+53, backgroundY+340); auto automapsButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+53, backgroundY+394); auto archivesButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+53, backgroundY+423); auto closeButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+53, backgroundY+448); closeButton->mouseClickHandler().add(std::bind(&PipBoy::onCloseButtonClick, this, std::placeholders::_1)); // Date and time // Date auto day = new UI::SmallCounter(backgroundPos + Point(21, 17)); day->setLength(2); day->setNumber(Game::getInstance()->gameTime()->day()); day->setColor(UI::SmallCounter::Color::WHITE); day->setType(UI::SmallCounter::Type::UNSIGNED); auto month = new UI::MonthCounter( static_cast<UI::MonthCounter::Month>(Game::getInstance()->gameTime()->month()), backgroundPos + Point(46, 18) ); auto year = new UI::SmallCounter(backgroundPos + Point(84, 17)); year->setLength(4); year->setNumber(Game::getInstance()->gameTime()->year()); year->setColor(UI::SmallCounter::Color::WHITE); year->setType(UI::SmallCounter::Type::UNSIGNED); // Time auto time = new UI::SmallCounter(backgroundPos + Point(160, 17)); time->setLength(4); time->setNumber((Game::getInstance()->gameTime()->hours() * 100) + Game::getInstance()->gameTime()->minutes()); time->setColor(UI::SmallCounter::Color::WHITE); time->setType(UI::SmallCounter::Type::UNSIGNED); addUI(background); addUI(alarmButton); addUI(statusButton); addUI(automapsButton); addUI(archivesButton); addUI(day); addUI(month); addUI(year); addUI(time); addUI(closeButton); }