mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge branch 'master' of http://github.com/oy/teeworlds
This commit is contained in:
commit
d1b3e01892
|
@ -25,6 +25,12 @@
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
#if defined(CONF_FAMILY_WINDOWS)
|
||||||
|
#define _WIN32_WINNT 0x0500
|
||||||
|
#define NOGDI
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void CGraph::Init(float Min, float Max)
|
void CGraph::Init(float Min, float Max)
|
||||||
{
|
{
|
||||||
|
@ -2024,6 +2030,17 @@ extern "C" int SDL_main(int argc, const char **argv) // ignore_convention
|
||||||
int main(int argc, const char **argv) // ignore_convention
|
int main(int argc, const char **argv) // ignore_convention
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#if defined(CONF_FAMILY_WINDOWS)
|
||||||
|
for(int i = 1; i < argc; i++) // ignore_convention
|
||||||
|
{
|
||||||
|
if(str_comp("-s", argv[i]) == 0 || str_comp("--silent", argv[i]) == 0) // ignore_convention
|
||||||
|
{
|
||||||
|
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// init the engine
|
// init the engine
|
||||||
dbg_msg("client", "starting...");
|
dbg_msg("client", "starting...");
|
||||||
m_Client.InitEngine("Teeworlds");
|
m_Client.InitEngine("Teeworlds");
|
||||||
|
|
|
@ -24,6 +24,7 @@ public:
|
||||||
virtual void Pause() = 0;
|
virtual void Pause() = 0;
|
||||||
virtual void Unpause() = 0;
|
virtual void Unpause() = 0;
|
||||||
virtual const CInfo *BaseInfo() const = 0;
|
virtual const CInfo *BaseInfo() const = 0;
|
||||||
|
virtual char *GetDemoName() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IDemoRecorder : public IInterface
|
class IDemoRecorder : public IInterface
|
||||||
|
|
|
@ -516,6 +516,9 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// store the filename
|
||||||
|
str_copy(m_aFilename, pFilename, sizeof(m_aFilename));
|
||||||
|
|
||||||
// clear the playback info
|
// clear the playback info
|
||||||
mem_zero(&m_Info, sizeof(m_Info));
|
mem_zero(&m_Info, sizeof(m_Info));
|
||||||
m_Info.m_Info.m_FirstTick = -1;
|
m_Info.m_Info.m_FirstTick = -1;
|
||||||
|
@ -722,7 +725,19 @@ int CDemoPlayer::Stop()
|
||||||
m_File = 0;
|
m_File = 0;
|
||||||
mem_free(m_pKeyFrames);
|
mem_free(m_pKeyFrames);
|
||||||
m_pKeyFrames = 0;
|
m_pKeyFrames = 0;
|
||||||
|
str_copy(m_aFilename, "", sizeof(m_aFilename));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *CDemoPlayer::GetDemoName()
|
||||||
|
{
|
||||||
|
// get the name of the demo without its path
|
||||||
|
char *pDemoShortName = &m_aFilename[0];
|
||||||
|
for(int i = 0; i < str_length(m_aFilename)-1; i++)
|
||||||
|
{
|
||||||
|
if(m_aFilename[i] == '/' || m_aFilename[i] == '\\')
|
||||||
|
pDemoShortName = &m_aFilename[i+1];
|
||||||
|
}
|
||||||
|
return pDemoShortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ private:
|
||||||
|
|
||||||
class IConsole *m_pConsole;
|
class IConsole *m_pConsole;
|
||||||
IOHANDLE m_File;
|
IOHANDLE m_File;
|
||||||
|
char m_aFilename[256];
|
||||||
CKeyFrame *m_pKeyFrames;
|
CKeyFrame *m_pKeyFrames;
|
||||||
|
|
||||||
CPlaybackInfo m_Info;
|
CPlaybackInfo m_Info;
|
||||||
|
@ -109,6 +110,7 @@ public:
|
||||||
void SetSpeed(float Speed);
|
void SetSpeed(float Speed);
|
||||||
int SetPos(float Precent);
|
int SetPos(float Precent);
|
||||||
const CInfo *BaseInfo() const { return &m_Info.m_Info; }
|
const CInfo *BaseInfo() const { return &m_Info.m_Info; }
|
||||||
|
char *GetDemoName();
|
||||||
|
|
||||||
int Update();
|
int Update();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <engine/demo.h>
|
#include <engine/demo.h>
|
||||||
#include <engine/keys.h>
|
#include <engine/keys.h>
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
|
#include <engine/textrender.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
|
|
||||||
#include <game/client/render.h>
|
#include <game/client/render.h>
|
||||||
|
@ -42,11 +43,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
|
|
||||||
const float SeekBarHeight = 15.0f;
|
const float SeekBarHeight = 15.0f;
|
||||||
const float ButtonbarHeight = 20.0f;
|
const float ButtonbarHeight = 20.0f;
|
||||||
|
const float NameBarHeight = 20.0f;
|
||||||
const float Margins = 5.0f;
|
const float Margins = 5.0f;
|
||||||
float TotalHeight;
|
float TotalHeight;
|
||||||
|
|
||||||
if(m_MenuActive)
|
if(m_MenuActive)
|
||||||
TotalHeight = SeekBarHeight+ButtonbarHeight+Margins*3;
|
TotalHeight = SeekBarHeight+ButtonbarHeight+NameBarHeight+Margins*3;
|
||||||
else
|
else
|
||||||
TotalHeight = SeekBarHeight+Margins*2;
|
TotalHeight = SeekBarHeight+Margins*2;
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
|
|
||||||
MainView.Margin(5.0f, &MainView);
|
MainView.Margin(5.0f, &MainView);
|
||||||
|
|
||||||
CUIRect SeekBar, ButtonBar;
|
CUIRect SeekBar, ButtonBar, NameBar;
|
||||||
|
|
||||||
int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick;
|
int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick;
|
||||||
int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick;
|
int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick;
|
||||||
|
@ -67,6 +69,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
{
|
{
|
||||||
MainView.HSplitTop(SeekBarHeight, &SeekBar, &ButtonBar);
|
MainView.HSplitTop(SeekBarHeight, &SeekBar, &ButtonBar);
|
||||||
ButtonBar.HSplitTop(Margins, 0, &ButtonBar);
|
ButtonBar.HSplitTop(Margins, 0, &ButtonBar);
|
||||||
|
ButtonBar.HSplitBottom(NameBarHeight, &ButtonBar, &NameBar);
|
||||||
|
NameBar.HSplitTop(4.0f, 0, &NameBar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SeekBar = MainView;
|
SeekBar = MainView;
|
||||||
|
@ -198,6 +202,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
static int s_ExitButton = 0;
|
static int s_ExitButton = 0;
|
||||||
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button))
|
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button))
|
||||||
Client()->Disconnect();
|
Client()->Disconnect();
|
||||||
|
|
||||||
|
// demo name
|
||||||
|
char aBuf[128];
|
||||||
|
str_format(aBuf, sizeof(aBuf), "Demofile: %s", DemoPlayer()->GetDemoName());
|
||||||
|
CTextCursor Cursor;
|
||||||
|
TextRender()->SetCursor(&Cursor, NameBar.x, NameBar.y, Button.h*0.5f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||||
|
Cursor.m_LineWidth = MainView.w;
|
||||||
|
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <engine/demo.h>
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
#include <engine/textrender.h>
|
#include <engine/textrender.h>
|
||||||
#include <engine/serverbrowser.h>
|
#include <engine/serverbrowser.h>
|
||||||
|
@ -310,6 +311,29 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScoreboard::RenderRecordingNotification(float x)
|
||||||
|
{
|
||||||
|
if(!m_pClient->DemoRecorder()->IsRecording())
|
||||||
|
return;
|
||||||
|
|
||||||
|
//draw the box
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
Graphics()->TextureSet(-1);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.4f);
|
||||||
|
RenderTools()->DrawRoundRectExt(x, 0.0f, 120.0f, 50.0f, 15.0f, CUI::CORNER_B);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
//draw the red dot
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
RenderTools()->DrawRoundRect(x+20, 15.0f, 20.0f, 20.0f, 10.0f);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
//draw the text
|
||||||
|
TextRender()->Text(0, x+50.0f, 8.0f, 24.0f, "REC", -1);
|
||||||
|
}
|
||||||
|
|
||||||
void CScoreboard::OnRender()
|
void CScoreboard::OnRender()
|
||||||
{
|
{
|
||||||
bool DoScoreBoard = false;
|
bool DoScoreBoard = false;
|
||||||
|
@ -374,6 +398,7 @@ void CScoreboard::OnRender()
|
||||||
|
|
||||||
RenderGoals(Width/2-w/2, 150+750+25, w);
|
RenderGoals(Width/2-w/2, 150+750+25, w);
|
||||||
RenderSpectators(Width/2-w/2, 150+750+25+50+25, w);
|
RenderSpectators(Width/2-w/2, 150+750+25+50+25, w);
|
||||||
|
RenderRecordingNotification((Width/7)*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CScoreboard::Active()
|
bool CScoreboard::Active()
|
||||||
|
|
|
@ -7,6 +7,7 @@ class CScoreboard : public CComponent
|
||||||
void RenderGoals(float x, float y, float w);
|
void RenderGoals(float x, float y, float w);
|
||||||
void RenderSpectators(float x, float y, float w);
|
void RenderSpectators(float x, float y, float w);
|
||||||
void RenderScoreboard(float x, float y, float w, int Team, const char *pTitle);
|
void RenderScoreboard(float x, float y, float w, int Team, const char *pTitle);
|
||||||
|
void RenderRecordingNotification(float x);
|
||||||
|
|
||||||
static void ConKeyScoreboard(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
static void ConKeyScoreboard(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue