chat highlighting, and more features related to chat

This commit is contained in:
Titus Tscharntke
2011-01-01 20:31:25 +00:00
parent 42fa56d464
commit 13c6fb49b3
11 changed files with 82 additions and 54 deletions

View File

@@ -836,7 +836,7 @@ void Renderer::renderTextureQuad(int x, int y, int w, int h, const Texture2D *te
}
void Renderer::renderConsoleLine(int lineIndex, int xPosition, int yPosition, int lineHeight,
const Font2D* font, const ConsoleLineInfo *lineInfo) {
const Font2D* font, string stringToHightlight, const ConsoleLineInfo *lineInfo) {
Vec4f fontColor;
const Metrics &metrics= Metrics::getInstance();
const FontMetrics *fontMetrics= font->getMetrics();
@@ -909,6 +909,9 @@ void Renderer::renderConsoleLine(int lineIndex, int xPosition, int yPosition, in
fontColor = defaultFontColor;
}
if(lineInfo->text.find(stringToHightlight)!=string::npos){
fontColor=Vec4f(1.f, 0.5f, 0.5f, 0.0f);
}
renderTextShadow(
lineInfo->text,
font,
@@ -928,21 +931,21 @@ void Renderer::renderConsole(const Console *console,const bool showFullConsole,c
for(int i = 0; i < console->getStoredLineCount(); ++i) {
const ConsoleLineInfo &lineInfo = console->getStoredLineItem(i);
renderConsoleLine(i, console->getXPos(), console->getYPos(),
console->getLineHeight(), console->getFont(), &lineInfo);
console->getLineHeight(), console->getFont(), console->getStringToHighlight(), &lineInfo);
}
}
else if(showMenuConsole) {
for(int i = 0; i < console->getStoredLineCount() && i < maxConsoleLines; ++i) {
const ConsoleLineInfo &lineInfo = console->getStoredLineItem(i);
renderConsoleLine(i, console->getXPos(), console->getYPos(),
console->getLineHeight(), console->getFont(), &lineInfo);
console->getLineHeight(), console->getFont(), console->getStringToHighlight(), &lineInfo);
}
}
else {
for(int i = 0; i < console->getLineCount(); ++i) {
const ConsoleLineInfo &lineInfo = console->getLineItem(i);
renderConsoleLine(i, console->getXPos(), console->getYPos(),
console->getLineHeight(), console->getFont(), &lineInfo);
console->getLineHeight(), console->getFont(), console->getStringToHighlight(), &lineInfo);
}
}
glPopAttrib();
@@ -955,7 +958,10 @@ void Renderer::renderChatManager(const ChatManager *chatManager) {
if(chatManager->getEditEnabled()) {
string text="";
if(chatManager->getTeamMode()) {
if(chatManager->getInMenu()){
text += lang.get("Chat");
}
else if(chatManager->getTeamMode()) {
text += lang.get("Team");
}
else {
@@ -981,6 +987,15 @@ void Renderer::renderChatManager(const ChatManager *chatManager) {
//textRenderer->render(text, 300, 150);
//textRenderer->end();
}
else
{
if (chatManager->getInMenu()) {
string text = ">> "+lang.get("PressEnterToChat")+" <<";
fontColor = Vec4f(0.5f, 0.5f, 0.5f, 0.5f);
renderTextShadow(text, chatManager->getFont(), fontColor,
chatManager->getXPos(), chatManager->getYPos());
}
}
}
void Renderer::renderResourceStatus(){