gave info button a function

This commit is contained in:
SushiTee 2012-11-07 17:15:03 +01:00
parent 02648e14b2
commit 9fd796162a
3 changed files with 13 additions and 9 deletions

View file

@ -55,6 +55,8 @@ CMenus::CMenus()
m_MenuPage = PAGE_START;
m_InfoMode = false;
m_EscapePressed = false;
m_EnterPressed = false;
m_DeletePressed = false;
@ -373,13 +375,13 @@ int CMenus::DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect
return ReturnValue;
}
int CMenus::DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect)
int CMenus::DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, bool Blend)
{
int Inside = UI()->MouseInside(pRect);
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, Inside ? 1.0f : 0.6f);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, !Blend || Inside ? 1.0f : 0.6f);
RenderTools()->SelectSprite(SpriteID);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
@ -410,12 +412,13 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
bool UpdateOffset = false;
static int s_AtIndex = 0;
static bool s_DoScroll = false;
static float s_ScrollStart = 0.0f;
FontSize *= UI()->Scale();
if(UI()->LastActiveItem() == pID)
{
static float s_ScrollStart = 0.0f;
int Len = str_length(pStr);
if(Len == 0)
s_AtIndex = 0;
@ -1667,7 +1670,6 @@ int CMenus::Render()
// make sure that other windows doesn't do anything funnay!
//UI()->SetHotItem(0);
//UI()->SetActiveItem(0);
char aBuf[128];
const char *pTitle = "";
const char *pExtraText = "";
const char *pButtonText = "";
@ -1860,6 +1862,7 @@ int CMenus::Render()
if(Client()->MapDownloadTotalsize() > 0)
{
char aBuf[128];
int64 Now = time_get();
if(Now-m_DownloadLastCheckTime >= time_freq())
{

View file

@ -37,7 +37,7 @@ class CMenus : public CComponent
int DoButton_DemoPlayer(const void *pID, const char *pText, const CUIRect *pRect);
int DoButton_SpriteID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, bool Fade=true);
int DoButton_SpriteClean(int ImageID, int SpriteID, const CUIRect *pRect);
int DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect);
int DoButton_SpriteCleanID(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, bool Blend=true);
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners=CUI::CORNER_ALL, float r=5.0f, float FontFactor=0.0f, vec4 ColorHot=vec4(1.0f, 1.0f, 1.0f, 0.75f), bool TextFade=true);
int DoButton_MenuImage(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, float r=5.0f, float FontFactor=0.0f);
@ -150,6 +150,7 @@ class CMenus : public CComponent
bool m_MenuActive;
bool m_UseMouseButtons;
vec2 m_MousePos;
bool m_InfoMode;
// images
struct CMenuImage

View file

@ -322,13 +322,13 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect *pRect, const CServerInfo *p
else if(ID == COL_PLAYERS)
{
// handle mouse over
if(UI()->MouseInside(&Button))
if(m_InfoMode && UI()->MouseInside(&Button))
{
// overlay
SetOverlay(CInfoOverlay::OVERLAY_PLAYERSINFO, UI()->MouseX(), UI()->MouseY(), pEntry);
// rect
RenderTools()->DrawUIRect(&Button, vec4(0.973f, 0.863f, 0.207, 1.0f), CUI::CORNER_ALL, 5.0f);
RenderTools()->DrawUIRect(&Button, vec4(0.973f, 0.863f, 0.207, 0.75f), CUI::CORNER_ALL, 5.0f);
}
TextRender()->TextColor(TextBaseColor.r, TextBaseColor.g, TextBaseColor.b, TextAplpha);
@ -788,9 +788,9 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
{
InfoButton.Margin(2.0f, &InfoButton);
static int s_InfoButton = 0;
if(DoButton_SpriteCleanID(&s_InfoButton, IMAGE_INFOICONS, SPRITE_INFO_A, &InfoButton))
if(DoButton_SpriteCleanID(&s_InfoButton, IMAGE_INFOICONS, ((m_InfoMode && !UI()->MouseInside(&InfoButton)) || (!m_InfoMode && UI()->MouseInside(&InfoButton))) ? SPRITE_INFO_B : SPRITE_INFO_A, &InfoButton, false))
{
m_InfoMode ^= 1;
}
}