Merge pull request #1969 from Dune-jr/exp-menus-checkboxes

More hover effects
This commit is contained in:
oy 2019-01-11 18:45:56 +01:00 committed by GitHub
commit ac452d7c20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View file

@ -295,7 +295,7 @@ set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 12, 4)
set_guiicons = SpriteSet("guiicons", image_guiicons, 8, 2)
set_menuicons = SpriteSet("menuicons", image_menuicons, 2, 2)
set_menuicons = SpriteSet("menuicons", image_menuicons, 4, 4)
set_toolicons = SpriteSet("toolicons", image_toolicons, 4, 2)
set_arrowicons = SpriteSet("arrowicons", image_arrowicons, 4, 3)
set_friendicons = SpriteSet("friendicons", image_friendicons, 2, 2)
@ -488,6 +488,7 @@ container.sprites.Add(Sprite("guiicon_friend", set_guiicons, 4,0,4,2))
container.sprites.Add(Sprite("menu_checkbox_active", set_menuicons, 0,0,1,1))
container.sprites.Add(Sprite("menu_checkbox_inactive", set_menuicons, 0,1,1,1))
container.sprites.Add(Sprite("menu_checkbox_hover", set_menuicons, 0,2,1,1))
container.sprites.Add(Sprite("menu_collapsed", set_menuicons, 1,0,1,1))
container.sprites.Add(Sprite("menu_expanded", set_menuicons, 1,1,1,1))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -326,7 +326,13 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
c.Margin(2.0f, &c);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MENUICONS].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, UI()->HotItem() == pID ? 1.0f : 0.6f);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
if(UI()->HotItem() == pID)
{
RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_HOVER);
IGraphics::CQuadItem QuadItem(c.x, c.y, c.w, c.h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
}
if(Checked)
RenderTools()->SelectSprite(SPRITE_MENU_CHECKBOX_ACTIVE);
else

View file

@ -566,6 +566,8 @@ int CEditor::DoButton_File(const void *pID, const char *pText, int Checked, cons
{
if(Checked)
RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_ALL, 3.0f);
else if(UI()->HotItem() == pID)
RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.33f), CUI::CORNER_ALL, 3.0f);
CUIRect t = *pRect;
t.VMargin(5.0f, &t);