Author: alink
Date: Thu Apr 5 04:11:46 2007
New Revision: 16594
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16594&view=rev
Log:
Add a function to use b&w cursor when the display is too busy to draw colour
ones (b&w it's better than invisible or
freeze cursor). Must be call before doing heavy stuff, but already works for
the starting screen.
Modified:
trunk/src/cursor.cpp
trunk/src/cursor.hpp
Modified: trunk/src/cursor.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cursor.cpp?rev=16594&r1=16593&r2=16594&view=diff
==============================================================================
--- trunk/src/cursor.cpp (original)
+++ trunk/src/cursor.cpp Thu Apr 5 04:11:46 2007
@@ -103,6 +103,7 @@
surface cursor_buf = NULL;
bool have_focus = true;
bool hide_bw = false;
+bool colour_ready = false;
SDL_Cursor* get_cursor(cursor::CURSOR_TYPE type)
{
@@ -156,6 +157,12 @@
}
}
+void temporary_use_bw()
+{
+ colour_ready = false;
+ set(current_cursor);
+}
+
void set(CURSOR_TYPE type)
{
current_cursor = type;
@@ -163,7 +170,7 @@
if(type == NUM_CURSORS) {
return;
}
- SDL_Cursor* cursor = get_cursor(hide_bw ? cursor::NO_CURSOR : type);
+ SDL_Cursor* cursor = get_cursor(hide_bw && colour_ready ?
cursor::NO_CURSOR : type);
if (cursor != NULL) {
SDL_SetCursor(cursor);
}
@@ -208,6 +215,14 @@
{
if(use_colour_cursors() == false) {
return;
+ }
+
+ if (!colour_ready) {
+ // display start to draw cursor
+ // so it can now display colour cursor
+ colour_ready = true;
+ // just reset the cursor will hide the b&w
+ set(current_cursor);
}
if(current_cursor == NUM_CURSORS) {
Modified: trunk/src/cursor.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cursor.hpp?rev=16594&r1=16593&r2=16594&view=diff
==============================================================================
--- trunk/src/cursor.hpp (original)
+++ trunk/src/cursor.hpp Thu Apr 5 04:11:46 2007
@@ -29,6 +29,9 @@
enum CURSOR_TYPE { NORMAL, WAIT, MOVE, ATTACK, HYPERLINK, MOVE_DRAG,
ATTACK_DRAG, NO_CURSOR, NUM_CURSORS };
void use_colour(bool value);
+// This function use temporary the b&w cursors while the display is busy
+// If used, the colours ones will be reused when display is ready again
+void temporary_use_bw();
void set(CURSOR_TYPE type);
void set_dragging(bool drag);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits