openspades/Sources/Client/ChatWindow.h
Chameleonhider 83b061fedf Makes local kills on killfeed black
Turns icons of local kills (both for kill and death) black. Black colour
stands out the most. Useful after having disabled center messages.
2016-02-10 20:02:43 +02:00

86 lines
2.3 KiB
C++

/*
Copyright (c) 2013 yvt
This file is part of OpenSpades.
OpenSpades is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSpades is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <string>
#include <list>
#include <Core/Math.h>
namespace spades {
namespace client {
class IRenderer;
class IFont;
class IImage;
class Client;
static const char MsgColorTeam1 = 1;
static const char MsgColorTeam2 = 2;
static const char MsgColorTeam3 = 3;
static const char MsgColorRed = 4;
static const char MsgColorFriendlyFire = MsgColorRed;
static const char MsgColorGreen = 5;
static const char MsgColorSysInfo = MsgColorGreen;
static const char MsgColorRestore = 6;
static const char MsgImage = 7;
static const char MsgColorBlack = 8;
static const char MsgColorMax = 9;
class ChatWindow {
Client *client;
IRenderer *renderer;
IFont *font;
struct ChatEntry {
std::string msg;
float height;
float fade; // usual fade opacity
float timeFade; // timeout fade opacity
ChatEntry( const std::string& Msg, float Height, float Fade, float TimeFade )
: msg(Msg), height(Height), fade(Fade), timeFade(TimeFade) {;}
};
std::list<ChatEntry> entries;
float firstY;
bool killfeed;
float GetWidth();
float GetHeight();
float GetLineHeight();
Vector4 GetColor(char);
std::vector<IImage*> mKillImages;
IImage* imageForIndex( char index );
public:
ChatWindow(Client *, IRenderer* rend, IFont *font, bool killfeed);
~ChatWindow();
void AddMessage(const std::string&);
static std::string ColoredMessage(const std::string&, char);
static std::string TeamColorMessage(const std::string&, int);
static std::string killImage( int killType, int weapon );
void Update(float dt);
void Draw();
};
}
}