|
From: <sch...@us...> - 2008-12-22 23:23:44
|
Revision: 62
http://deraciel.svn.sourceforge.net/deraciel/?rev=62&view=rev
Author: schnippi001
Date: 2008-12-22 23:23:35 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
Text window clears after keypress
Modified Paths:
--------------
trunk/GUI.h
trunk/NCursesGUI.cpp
trunk/NCursesGUI.h
trunk/NCursesTextWindow.cpp
trunk/main.cpp
Modified: trunk/GUI.h
===================================================================
--- trunk/GUI.h 2008-12-22 22:09:46 UTC (rev 61)
+++ trunk/GUI.h 2008-12-22 23:23:35 UTC (rev 62)
@@ -16,6 +16,7 @@
public:
virtual void initialize() = 0;
virtual void finalize() = 0;
+ virtual void update() = 0;
virtual TextWindow *getTextWindow() = 0;
virtual MapWindow *getMapWindow() = 0;
virtual StatusWindow *getStatusWindow() = 0;
Modified: trunk/NCursesGUI.cpp
===================================================================
--- trunk/NCursesGUI.cpp 2008-12-22 22:09:46 UTC (rev 61)
+++ trunk/NCursesGUI.cpp 2008-12-22 23:23:35 UTC (rev 62)
@@ -35,6 +35,10 @@
endwin();
}
+void NCursesGUI::update() {
+ doupdate();
+}
+
TextWindow *NCursesGUI::getTextWindow() {
return textWindow;
}
Modified: trunk/NCursesGUI.h
===================================================================
--- trunk/NCursesGUI.h 2008-12-22 22:09:46 UTC (rev 61)
+++ trunk/NCursesGUI.h 2008-12-22 23:23:35 UTC (rev 62)
@@ -14,6 +14,7 @@
public:
void initialize();
void finalize();
+ void update();
TextWindow *getTextWindow();
MapWindow *getMapWindow();
StatusWindow *getStatusWindow();
Modified: trunk/NCursesTextWindow.cpp
===================================================================
--- trunk/NCursesTextWindow.cpp 2008-12-22 22:09:46 UTC (rev 61)
+++ trunk/NCursesTextWindow.cpp 2008-12-22 23:23:35 UTC (rev 62)
@@ -44,6 +44,9 @@
/* Redraw border with new dimensions */
drawBorder();
}
+
+ wnoutrefresh(borderWindow);
+ wnoutrefresh(textWindow);
}
void NCursesTextWindow::displayString(const string string) {
Modified: trunk/main.cpp
===================================================================
--- trunk/main.cpp 2008-12-22 22:09:46 UTC (rev 61)
+++ trunk/main.cpp 2008-12-22 23:23:35 UTC (rev 62)
@@ -20,7 +20,8 @@
gui = new NCursesGUI();
gui->initialize();
- //gui->getStatusWindow->displayStatus();
+ gui->getStatusWindow()->displayStatus();
+ gui->update();
/* Assign key handler callback */
KeyboardReader::setKeyboardHandler(keyhandler);
@@ -37,6 +38,9 @@
}
static void keyhandler(const int key) {
+ gui->getTextWindow()->clear();
+ gui->getStatusWindow()->displayStatus();
+
if (key == KEY_ESCAPE) {
// Stop keyboard handler loop
KeyboardReader::stop();
@@ -51,23 +55,9 @@
refresh();
}
- if (key == KEY_UP) {
- cout << "KEY_UP" << endl;
- }
-
- if (key == KEY_DOWN) {
- cout << "KEY_DOWN" << endl;
- }
-
- if (key == KEY_LEFT) {
- cout << "KEY_LEFT" << endl;
- }
-
- if (key == KEY_RIGHT) {
- cout << "KEY_RIGHT" << endl;
- }
-
if (key == 'm') {
- //gui->getTextWindow->displayString("Message displayed");
+ gui->getTextWindow()->displayString("Message displayed");
}
+
+ gui->update();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|