summaryrefslogtreecommitdiff
path: root/src/graphic/graphic.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-15 23:45:39 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-15 23:45:39 +0000
commit7b81d4151ef4fe04a5aabcc4fe258ee40115ef0b (patch)
tree711ad9a5597de3014921b9fb36206f21595cdf05 /src/graphic/graphic.cpp
parent13f82f10d92816d0239db56b7936fd2403f50897 (diff)
downloadmana-client-7b81d4151ef4fe04a5aabcc4fe258ee40115ef0b.tar.gz
mana-client-7b81d4151ef4fe04a5aabcc4fe258ee40115ef0b.tar.bz2
mana-client-7b81d4151ef4fe04a5aabcc4fe258ee40115ef0b.tar.xz
mana-client-7b81d4151ef4fe04a5aabcc4fe258ee40115ef0b.zip
Fixed screenshot taking and changed chat box in Guichan widget.
Diffstat (limited to 'src/graphic/graphic.cpp')
-rw-r--r--src/graphic/graphic.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 8383526a..b5dce7a2 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -27,20 +27,21 @@
#include "../gui/status.h"
#include "../main.h"
-BITMAP *buffer, *chat_background;
+BITMAP *buffer;
char itemCurrenyQ[10] = "0";
int map_x, map_y, camera_x, camera_y;
char npc_text[1000] = "";
char statsString2[255] = "n/a";
char skill_points[10] = "";
-Chat chatlog("./docs/chatlog.txt", 20);
bool show_skill_dialog = false;
bool show_skill_list_dialog = false;
char npc_button[10] = "Close";
gcn::TextField *chatInput;
+gcn::Label *debugInfo;
+ChatBox *chatBox;
StatusWindow *statusWindow;
BuyDialog *buyDialog;
SellDialog *sellDialog;
@@ -57,7 +58,7 @@ void ChatListener::action(const std::string& eventId)
std::string message = chatInput->getText();
if (message.length() > 0) {
- chatlog.chat_send(char_info[0].name, message.c_str());
+ chatBox->chat_send(char_info[0].name, message.c_str());
chatInput->setText("");
}
}
@@ -168,8 +169,6 @@ void Graphics::updateScreen()
Engine::Engine()
{
// Initializes GUI
- chat_background = create_bitmap(592, 100);
- clear_to_color(chat_background, makecol(0, 0, 0));
chatInput = new TextField();
chatInput->setPosition(chatInput->getBorderSize(),
SCREEN_H - chatInput->getHeight() - chatInput->getBorderSize() -1);
@@ -179,8 +178,17 @@ Engine::Engine()
chatInput->setEventId("chatinput");
chatInput->addActionListener(chatListener);
+ debugInfo = new gcn::Label();
+
+ chatBox = new ChatBox("./docs/chatlog.txt", 20);
+ chatBox->setSize(592, 100);
+ chatBox->setPosition(0, chatInput->getY() - 1 - chatBox->getHeight());
+
+ guiTop->add(chatBox);
+ guiTop->add(debugInfo);
guiTop->add(chatInput);
+
// Create dialogs
statusWindow = new StatusWindow();
@@ -235,6 +243,7 @@ Engine::Engine()
Engine::~Engine()
{
+ delete chatBox;
delete statusWindow;
delete buyDialog;
delete sellDialog;
@@ -480,11 +489,6 @@ void Engine::draw()
beingIterator++;
}
- set_trans_blender(0, 0, 0, 110);
- draw_trans_sprite(buffer, chat_background, 0, SCREEN_H - 125);
-
- chatlog.chat_draw(buffer, 8, font);
-
if (statsWindow->isVisible()) {
statsWindow->update();
}
@@ -492,10 +496,11 @@ void Engine::draw()
statusWindow->update();
}
- gui->logic();
gui->draw();
- textprintf_ex(buffer, font, 0, 0, makecol(255, 255, 255), -1,
- "[%i fps] %i,%i", fps,
- mouse_x / 32 + camera_x, mouse_y / 32 + camera_y);
+ std::stringstream debugStream;
+ debugStream << "[" << fps << " fps] " <<
+ (mouse_x / 32 + camera_x) << ", " << (mouse_y / 32 + camera_y);
+ debugInfo->setCaption(debugStream.str());
+ debugInfo->adjustSize();
}