mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
added graphic buttons for remove/add friend and chat ignore/notice
This commit is contained in:
parent
34a9ca20a7
commit
867f944459
BIN
data/gui_buttons.png
Normal file
BIN
data/gui_buttons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -228,6 +228,7 @@ image_browseicons = Image("browseicons", "browse_icons.png")
|
||||||
image_emoticons = Image("emoticons", "emoticons.png")
|
image_emoticons = Image("emoticons", "emoticons.png")
|
||||||
image_demobuttons = Image("demobuttons", "demo_buttons.png")
|
image_demobuttons = Image("demobuttons", "demo_buttons.png")
|
||||||
image_fileicons = Image("fileicons", "file_icons.png")
|
image_fileicons = Image("fileicons", "file_icons.png")
|
||||||
|
image_guibuttons = Image("guibuttons", "gui_buttons.png")
|
||||||
|
|
||||||
container.images.Add(image_null)
|
container.images.Add(image_null)
|
||||||
container.images.Add(image_game)
|
container.images.Add(image_game)
|
||||||
|
@ -240,6 +241,7 @@ container.images.Add(Image("console_bg", "console.png"))
|
||||||
container.images.Add(Image("console_bar", "console_bar.png"))
|
container.images.Add(Image("console_bar", "console_bar.png"))
|
||||||
container.images.Add(image_demobuttons)
|
container.images.Add(image_demobuttons)
|
||||||
container.images.Add(image_fileicons)
|
container.images.Add(image_fileicons)
|
||||||
|
container.images.Add(image_guibuttons)
|
||||||
|
|
||||||
container.pickups.Add(Pickup("health"))
|
container.pickups.Add(Pickup("health"))
|
||||||
container.pickups.Add(Pickup("armor"))
|
container.pickups.Add(Pickup("armor"))
|
||||||
|
@ -253,6 +255,7 @@ set_browseicons = SpriteSet("browseicons", image_browseicons, 4, 1)
|
||||||
set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
|
set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
|
||||||
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
|
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
|
||||||
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
|
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
|
||||||
|
set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 16, 2)
|
||||||
|
|
||||||
container.spritesets.Add(set_particles)
|
container.spritesets.Add(set_particles)
|
||||||
container.spritesets.Add(set_game)
|
container.spritesets.Add(set_game)
|
||||||
|
@ -261,6 +264,7 @@ container.spritesets.Add(set_browseicons)
|
||||||
container.spritesets.Add(set_emoticons)
|
container.spritesets.Add(set_emoticons)
|
||||||
container.spritesets.Add(set_demobuttons)
|
container.spritesets.Add(set_demobuttons)
|
||||||
container.spritesets.Add(set_fileicons)
|
container.spritesets.Add(set_fileicons)
|
||||||
|
container.spritesets.Add(set_guibuttons)
|
||||||
|
|
||||||
container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
|
container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
|
||||||
container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
|
container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
|
||||||
|
@ -383,6 +387,11 @@ container.sprites.Add(Sprite("file_folder", set_fileicons, 2,0,1,1))
|
||||||
container.sprites.Add(Sprite("file_map1", set_fileicons, 5,0,1,1))
|
container.sprites.Add(Sprite("file_map1", set_fileicons, 5,0,1,1))
|
||||||
container.sprites.Add(Sprite("file_map2", set_fileicons, 6,0,1,1))
|
container.sprites.Add(Sprite("file_map2", set_fileicons, 6,0,1,1))
|
||||||
|
|
||||||
|
container.sprites.Add(Sprite("guibutton_chatoff", set_guibuttons, 0,0,4,2))
|
||||||
|
container.sprites.Add(Sprite("guibutton_chaton", set_guibuttons, 4,0,4,2))
|
||||||
|
container.sprites.Add(Sprite("guibutton_friendadd", set_guibuttons, 8,0,4,2))
|
||||||
|
container.sprites.Add(Sprite("guibutton_friendrem", set_guibuttons, 12,0,4,2))
|
||||||
|
|
||||||
|
|
||||||
anim = Animation("base")
|
anim = Animation("base")
|
||||||
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
|
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CMenus : public CComponent
|
||||||
|
|
||||||
|
|
||||||
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
int DoButton_DemoPlayer_Sprite(const void *pID, int SpriteId, int Checked, const CUIRect *pRect);
|
int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect);
|
||||||
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners);
|
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners);
|
||||||
int DoButton_PageMenu(const void *pID, const char *pText, int Checked, bool Active, const CUIRect *pRect, int Corners);
|
int DoButton_PageMenu(const void *pID, const char *pText, int Checked, bool Active, const CUIRect *pRect, int Corners);
|
||||||
|
|
|
@ -26,10 +26,10 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked,
|
||||||
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMenus::DoButton_DemoPlayer_Sprite(const void *pID, int SpriteID, int Checked, const CUIRect *pRect)
|
int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect)
|
||||||
{
|
{
|
||||||
RenderTools()->DrawUIRect(pRect, vec4(1,1,1, Checked ? 0.10f : 0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(pRect, vec4(1,1,1, Checked ? 0.10f : 0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f);
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_DEMOBUTTONS].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
RenderTools()->SelectSprite(SpriteID);
|
RenderTools()->SelectSprite(SpriteID);
|
||||||
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
||||||
|
@ -147,12 +147,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
static int s_PlayPauseButton = 0;
|
static int s_PlayPauseButton = 0;
|
||||||
if(!pInfo->m_Paused)
|
if(!pInfo->m_Paused)
|
||||||
{
|
{
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_PlayPauseButton, SPRITE_DEMOBUTTON_PAUSE, pInfo->m_Paused, &Button))
|
if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PAUSE, pInfo->m_Paused, &Button))
|
||||||
DemoPlayer()->Pause();
|
DemoPlayer()->Pause();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_PlayPauseButton, SPRITE_DEMOBUTTON_PLAY, !pInfo->m_Paused, &Button))
|
if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_PLAY, !pInfo->m_Paused, &Button))
|
||||||
DemoPlayer()->Unpause();
|
DemoPlayer()->Unpause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static int s_ResetButton = 0;
|
static int s_ResetButton = 0;
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_ResetButton, SPRITE_DEMOBUTTON_STOP, false, &Button))
|
if(DoButton_Sprite(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, false, &Button))
|
||||||
{
|
{
|
||||||
m_pClient->OnReset();
|
m_pClient->OnReset();
|
||||||
DemoPlayer()->Pause();
|
DemoPlayer()->Pause();
|
||||||
|
@ -172,14 +172,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static int s_SlowDownButton = 0;
|
static int s_SlowDownButton = 0;
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_SlowDownButton, SPRITE_DEMOBUTTON_SLOWER, 0, &Button) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, 0, &Button) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||||
DecreaseDemoSpeed = true;
|
DecreaseDemoSpeed = true;
|
||||||
|
|
||||||
// fastforward
|
// fastforward
|
||||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static int s_FastForwardButton = 0;
|
static int s_FastForwardButton = 0;
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_FastForwardButton, SPRITE_DEMOBUTTON_FASTER, 0, &Button))
|
if(DoButton_Sprite(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, 0, &Button))
|
||||||
IncreaseDemoSpeed = true;
|
IncreaseDemoSpeed = true;
|
||||||
|
|
||||||
// speed meter
|
// speed meter
|
||||||
|
|
|
@ -121,11 +121,11 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
if(!m_pClient->m_Snap.m_paPlayerInfos[i] || i == m_pClient->m_Snap.m_LocalClientID)
|
if(!m_pClient->m_Snap.m_paPlayerInfos[i] || i == m_pClient->m_Snap.m_LocalClientID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Options.HSplitTop(25.0f, &ButtonBar, &Options);
|
Options.HSplitTop(28.0f, &ButtonBar, &Options);
|
||||||
ButtonBar.VSplitRight(200.0f, &Player, &ButtonBar);
|
ButtonBar.VSplitRight(200.0f, &Player, &ButtonBar);
|
||||||
|
|
||||||
// player info
|
// player info
|
||||||
Player.VSplitLeft(25.0f, &Button, &Player);
|
Player.VSplitLeft(28.0f, &Button, &Player);
|
||||||
CTeeRenderInfo Info = m_pClient->m_aClients[i].m_RenderInfo;
|
CTeeRenderInfo Info = m_pClient->m_aClients[i].m_RenderInfo;
|
||||||
Info.m_Size = Button.h;
|
Info.m_Size = Button.h;
|
||||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1.0f, 0.0f), vec2(Button.x+Button.h/2, Button.y+Button.h/2));
|
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1.0f, 0.0f), vec2(Button.x+Button.h/2, Button.y+Button.h/2));
|
||||||
|
@ -142,19 +142,30 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[i].m_aClan, -1);
|
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[i].m_aClan, -1);
|
||||||
|
|
||||||
// ignore button
|
// ignore button
|
||||||
ButtonBar.VSplitMid(&Button, &ButtonBar);
|
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||||
Button.VSplitRight(10.0f, &Button, 0);
|
ButtonBar.VSplitLeft(ButtonBar.h*2.0f, &Button, &ButtonBar);
|
||||||
if(DoButton_CheckBox(&s_aPlayerIDs[i][0], Localize("Ignore"), m_pClient->m_aClients[i].m_ChatIgnore, &Button))
|
if(m_pClient->m_aClients[i].m_ChatIgnore)
|
||||||
m_pClient->m_aClients[i].m_ChatIgnore ^= 1;
|
{
|
||||||
|
if(DoButton_Sprite(&s_aPlayerIDs[i][0], IMAGE_GUIBUTTONS, SPRITE_GUIBUTTON_CHATON, m_pClient->m_aClients[i].m_ChatIgnore, &Button))
|
||||||
|
m_pClient->m_aClients[i].m_ChatIgnore = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(DoButton_Sprite(&s_aPlayerIDs[i][0], IMAGE_GUIBUTTONS, SPRITE_GUIBUTTON_CHATOFF, !m_pClient->m_aClients[i].m_ChatIgnore, &Button))
|
||||||
|
m_pClient->m_aClients[i].m_ChatIgnore = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// friend button
|
// friend button
|
||||||
ButtonBar.VSplitMid(&Button, &ButtonBar);
|
ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
|
||||||
Button.VSplitLeft(10.0f, 0, &Button);
|
ButtonBar.VSplitLeft(ButtonBar.h*2.0f, &Button, &ButtonBar);
|
||||||
if(DoButton_CheckBox(&s_aPlayerIDs[i][1], Localize("Friend"), m_pClient->m_aClients[i].m_Friend, &Button))
|
if(m_pClient->m_aClients[i].m_Friend)
|
||||||
{
|
{
|
||||||
if(m_pClient->m_aClients[i].m_Friend)
|
if(DoButton_Sprite(&s_aPlayerIDs[i][1], IMAGE_GUIBUTTONS, SPRITE_GUIBUTTON_FRIENDREM, m_pClient->m_aClients[i].m_Friend, &Button))
|
||||||
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(DoButton_Sprite(&s_aPlayerIDs[i][1], IMAGE_GUIBUTTONS, SPRITE_GUIBUTTON_FRIENDADD, !m_pClient->m_aClients[i].m_Friend, &Button))
|
||||||
m_pClient->Friends()->AddFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
m_pClient->Friends()->AddFriend(m_pClient->m_aClients[i].m_aName, m_pClient->m_aClients[i].m_aClan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue