mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-17 16:59:17 +01:00
Adds a second drawing-pass for drawing tooltips. Now tooltips allways on top and no more overlapped by other buttons.
This commit is contained in:
parent
1c632d82a7
commit
fc549f113f
@ -372,6 +372,7 @@ class GuiElement
|
||||
virtual void Update(GuiTrigger * t);
|
||||
//!Called constantly to redraw the element
|
||||
virtual void Draw();
|
||||
virtual void DrawTooltip();
|
||||
protected:
|
||||
//int position2; //! B Scrollbariable
|
||||
bool visible; //!< Visibility of the element. If false, Draw() is skipped
|
||||
@ -472,6 +473,7 @@ class GuiWindow : public GuiElement
|
||||
void MoveSelectionVert(int d);
|
||||
//!Draws all the elements in this GuiWindow
|
||||
void Draw();
|
||||
void DrawTooltip();
|
||||
//!Updates the window and all elements contains within
|
||||
//!Allows the GuiWindow and all elements to respond to the input data specified
|
||||
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
|
||||
@ -696,6 +698,7 @@ class GuiButton : public GuiElement
|
||||
void SetToolTip(GuiImage* i, GuiText * t, int x, int y);
|
||||
//!Constantly called to draw the GuiButton
|
||||
void Draw();
|
||||
void DrawTooltip();
|
||||
//!Constantly called to allow the GuiButton to respond to updated input data
|
||||
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
|
||||
void Update(GuiTrigger * t);
|
||||
|
@ -173,6 +173,7 @@ void GuiButton::Draw()
|
||||
}
|
||||
|
||||
//draw ToolTip
|
||||
/*
|
||||
if(state == STATE_SELECTED && toolTip)
|
||||
{
|
||||
if (time2 == 0)
|
||||
@ -188,10 +189,27 @@ void GuiButton::Draw()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
this->UpdateEffects();
|
||||
}
|
||||
void GuiButton::DrawTooltip()
|
||||
{
|
||||
if(state == STATE_SELECTED && toolTip)
|
||||
{
|
||||
if (time2 == 0)
|
||||
time(&time2);
|
||||
|
||||
time(&time1);
|
||||
|
||||
if (difftime(time1, time2) >= 2) {
|
||||
toolTip->Draw();
|
||||
if (toolTipTxt)
|
||||
{
|
||||
toolTipTxt->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void GuiButton::ScrollIsOn(int f)
|
||||
{
|
||||
scrollison = f;
|
||||
|
@ -563,6 +563,13 @@ void GuiElement::Draw()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw Tooltips on screen.
|
||||
*/
|
||||
void GuiElement::DrawTooltip()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a position is inside the GuiElement.
|
||||
* @param[in] x X position in pixel.
|
||||
|
@ -97,7 +97,17 @@ void GuiWindow::Draw()
|
||||
//Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0xbe, 0xca, 0xd5, 0x70},1);
|
||||
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, 0x70},1);
|
||||
}
|
||||
void GuiWindow::DrawTooltip()
|
||||
{
|
||||
if(_elements.size() == 0 || !this->IsVisible())
|
||||
return;
|
||||
|
||||
for (u8 i = 0; i < _elements.size(); i++)
|
||||
{
|
||||
try { _elements.at(i)->DrawTooltip(); }
|
||||
catch (const std::exception& e) { }
|
||||
}
|
||||
}
|
||||
void GuiWindow::ResetState()
|
||||
{
|
||||
if(state != STATE_DISABLED)
|
||||
|
@ -1671,6 +1671,7 @@ UpdateGUI (void *arg)
|
||||
else
|
||||
{
|
||||
mainWindow->Draw();
|
||||
mainWindow->DrawTooltip();
|
||||
|
||||
#ifdef HW_RVL
|
||||
for(int i=3; i >= 0; i--) // so that player 1's cursor appears on top!
|
||||
|
Loading…
Reference in New Issue
Block a user