EditorPanel::EditorPanel(const std::string& name_, rapidxml::xml_node<>* elem_) : GUI::Widget(name_, elem_) , _tooltipExist(false) , _tooltip(Core::resourceManager.Get<Render::Text>("EditorTooltipText")) { std::string textureID = Xml::GetStringAttributeOrDef(elem_, "tex", "EditPanel"); _texture = Core::resourceManager.Get<Render::Texture>(textureID); int col_count = Xml::GetIntAttributeOrDef(elem_, "col_count", 19); _cellSize = Xml::GetIntAttributeOrDef(elem_, "side", 19); _scrollable = Xml::GetBoolAttributeOrDef(elem_, "scrollable", false); _buttons.clear(); rapidxml::xml_node<>* xml_button = elem_->first_node("button"); int i = 0; while(xml_button) { IRect rect(i % col_count * _cellSize, i / col_count * _cellSize, _cellSize, _cellSize); _buttons.push_back( ButtonInfo(rect, xml_button) ); xml_button = xml_button->next_sibling("button"); i++; } IPoint pos(elem_); pos.y += MyApplication::GAME_HEIGHT; int width = col_count * _cellSize; int height = (i - 1) / col_count * _cellSize + _cellSize; setClientRect(IRect(pos.x, pos.y, width, height) ); }
bool MyDirectDrawSw::initWindow() { if(mHWnd) { if(!mHDC) { if(mSettings->drawOnScreen()) { mHDC = ::GetDC(nullptr); } else { mHDC = ::GetDC(mHWnd); } if(nullptr == mHDC) { LOG_ERROR() << "GetDC failed: " << getWinError(); return false; } } if(mIsFullscreen) { if(mSettings->addWindowFrame()) { const LONG_PTR newStyle = (mWndStyle |= WS_CAPTION); ::SetWindowLongPtr(mHWnd, GWL_STYLE, newStyle); } return setClientRect(mHWnd, mDispMode.width, mDispMode.height); } } return true; }