void Scene::construct() { fader.setFull(); fader.setFade(10, 0.0f, 0.02f); //!< Fade in scene when it was started running=true; doExit=false; _doShutDown=false; dif = 0; updateTickValue(); }
void PGE_TextInputBox::construct(std::string msg, PGE_TextInputBox::msgType _type, PGE_Point pos, double _padding, std::string texture) { loadTexture(std::move(texture)); updateTickValue(); PGE_BoxBase::restart(); message = std::move(msg); setType(_type); m_cursor = 0; m_selectionLength = 0; m_blinkShown = true; m_blinkTimeout = 250.0; m_fontID = FontManager::getFontID(ConfigManager::setup_message_box.font_name); m_fontRgba = ConfigManager::setup_message_box.font_rgba; m_borderWidth = ConfigManager::setup_message_box.borderWidth; if(_padding < 0) _padding = ConfigManager::setup_message_box.box_padding; /****************Word wrap*********************/ FontManager::optimizeText(message, 27); /****************Word wrap*end*****************/ PGE_Size boxSize = FontManager::textSize(message, m_fontID, 27); std::string w27 = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"; PGE_Size textinputSize = FontManager::textSize(w27, m_fontID, 27); m_textInput_h_offset = boxSize.h(); boxSize.setWidth(textinputSize.w()); boxSize.setHeight(static_cast<int>(boxSize.h() + textinputSize.h() + _padding)); setBoxSize(boxSize.w() / 2, boxSize.h() / 2, _padding); if((pos.x() == -1) && (pos.y() == -1)) { m_sizeRect.setLeft(static_cast<int>(PGE_Window::Width / 2 - m_width - m_padding)); m_sizeRect.setTop(static_cast<int>(PGE_Window::Height / 3 - m_height - m_padding)); m_sizeRect.setRight(static_cast<int>(PGE_Window::Width / 2 + m_width + m_padding)); m_sizeRect.setBottom(static_cast<int>(PGE_Window::Height / 3 + m_height + m_padding)); if(m_sizeRect.top() < m_padding) m_sizeRect.setY(static_cast<int>(m_padding)); } else { m_sizeRect.setLeft(static_cast<int>(pos.x() - m_width - m_padding)); m_sizeRect.setTop(static_cast<int>(pos.y() - m_height - m_padding)); m_sizeRect.setRight(static_cast<int>(pos.x() + m_width + m_padding)); m_sizeRect.setBottom(static_cast<int>(pos.y() + m_height + m_padding)); } }
void PGE_QuestionBox::construct(QString _title, PGE_MenuBox::msgType _type, PGE_Point pos, float _padding, QString texture) { if(!texture.isEmpty()) loadTexture(texture); updateTickValue(); _page=0; running=false; _answer_id = -1; _pos=pos; _menu.setTextLenLimit(30, true); _menu.setItemsNumber(2); setTitleFont(ConfigManager::setup_menu_box.title_font_name); setTitleFontColor(ConfigManager::setup_menu_box.title_font_rgba); /****************Word wrap*********************/ title = _title; FontManager::optimizeText(title, 27); title_size = FontManager::textSize(_title, fontID, 27); /****************Word wrap*end*****************/ setPadding(_padding); setType(_type); updateSize(); }