Button::Button(int x1, int y1, int x2, int y2) { m_Topleft = v2d(x1, y1); m_BotRight = v2d(x2, y2); m_BackColor = irr::video::SColor(255, 0, 0, 0); m_FrontColor = irr::video::SColor(255, 255, 255, 255); borderthickness = 1; m_backdrop = GraphicsRect(x1, y1, x2, y2); m_backdrop.SetColor(m_BackColor); m_main = GraphicsRect(x1 + borderthickness, y1 + borderthickness, x2 - borderthickness, y2 - borderthickness); m_main.SetColor(m_FrontColor); m_TextColor = irr::video::SColor(255, 0, 0, 0); pressed = false; }
Button::Button() { m_BackColor = irr::video::SColor(255, 0, 0, 0); m_FrontColor = irr::video::SColor(255, 255, 255, 255); m_Topleft = v2d(0, 0); m_BotRight = v2d(0, 0); borderthickness = 1; m_backdrop = GraphicsRect(m_Topleft.X, m_Topleft.Y, m_BotRight.X, m_BotRight.Y); m_backdrop.SetColor(m_BackColor); m_main = GraphicsRect(m_Topleft.X + borderthickness, m_Topleft.Y + borderthickness, m_BotRight.X - borderthickness, m_BotRight.Y - borderthickness); m_main.SetColor(m_FrontColor); m_TextColor = irr::video::SColor(255, 0, 0, 0); pressed = false; }
Button::Button(InventorySlot& slot, v2d iconPos, v2d qtyPos, IrrlichtDevice* device) { //initialize variables pressed = false; selected = false; //set rectangle corners for icon i_TopLeft = iconPos; i_BotRight = v2d(iconPos.X + 32, iconPos.Y + 32); //set rectangle corners for qty q_TopLeft = qtyPos; q_BotRight = v2d(qtyPos.X + 8, qtyPos.Y + 8); //initialize selected border area borderthickness = 2; selectedBorder = GraphicsRect(i_TopLeft.X + borderthickness, i_TopLeft.Y + borderthickness, i_BotRight.X - borderthickness, i_BotRight.Y - borderthickness); pressed = false; //save the inventory slot data iSlot = slot; //set up the font for text rendering m_font = device->getGUIEnvironment()->getBuiltInFont(); }
Button::Button(GraphicsImage& image, IrrlichtDevice* device) { //initialize variables pressed = false; selected = false; //set rectangle corners for icon i_TopLeft = image.GetPosition(); i_BotRight = v2d(i_TopLeft.X + 128, i_TopLeft.Y + 64); //set rectangle corners for qty q_TopLeft = v2d(0, 0); q_BotRight = v2d(0, 0); //initialize selected border area borderthickness = 2; selectedBorder = GraphicsRect(i_TopLeft.X + borderthickness, i_TopLeft.Y + borderthickness, i_BotRight.X - borderthickness, i_BotRight.Y - borderthickness); pressed = false; buttonImage = image; m_font = device->getGUIEnvironment()->getBuiltInFont(); }