openspades/Sources/Client/ChatWindow.h

65 lines
1.3 KiB
C
Raw Normal View History

2013-08-18 16:18:06 +09:00
//
// ChatWindow.h
// OpenSpades
//
// Created by yvt on 7/18/13.
// Copyright (c) 2013 yvt.jp. All rights reserved.
//
#pragma once
#include <string>
#include <list>
#include "../Core/Math.h"
namespace spades {
namespace client {
class IRenderer;
class IFont;
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 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
};
std::list<ChatEntry> entries;
float firstY;
float GetWidth();
float GetHeight();
float GetLineHeight();
Vector4 GetColor(char);
public:
ChatWindow(Client *, IFont *font);
~ChatWindow();
void AddMessage(const std::string&);
static std::string ColoredMessage(const std::string&, char);
static std::string TeamColorMessage(const std::string&, int);
void Update(float dt);
void Draw();
};
}
}