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)); } }
PGE_Point Render_SW_SDL::MapToScr(PGE_Point point) { return MapToScr(point.x(), point.y()); }
void PGE_Menu::setPos(PGE_Point p) { menuRect.setX(p.x()); menuRect.setY(p.y()-_font_offset); refreshRect(); }
PGE_Point Render_OpenGL31::MapToScr(PGE_Point point) { return MapToScr(point.x(), point.y()); }