wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth src/cursor.cpp src/playturn.cpp images/...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth src/cursor.cpp src/playturn.cpp images/...
Date: Sat, 27 Aug 2005 14:27:04 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/08/27 18:27:04

Modified files:
        src            : cursor.cpp playturn.cpp 
Added files:
        images/cursors-bw: wait-16x16.png 

Log message:
        Fixed #14298 : Hourglass cursor being borked in OSX

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/images/cursors-bw/wait-16x16.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cursor.cpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.391&tr2=1.392&r1=text&r2=text

Patches:
Index: wesnoth/src/cursor.cpp
diff -u wesnoth/src/cursor.cpp:1.17 wesnoth/src/cursor.cpp:1.18
--- wesnoth/src/cursor.cpp:1.17 Wed Jul 20 08:22:37 2005
+++ wesnoth/src/cursor.cpp      Sat Aug 27 18:27:04 2005
@@ -1,4 +1,4 @@
-/* $Id: cursor.cpp,v 1.17 2005/07/20 08:22:37 ott Exp $ */
+/* $Id: cursor.cpp,v 1.18 2005/08/27 18:27:04 gruikya Exp $ */
 /*
    Copyright (C) 2003-5 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -42,11 +42,15 @@
        }
 
        //the width must be a multiple of 8 (SDL requirement)
+       
+#ifdef __APPLE__
+       size_t cursor_width = 16;
+#else
        size_t cursor_width = nsurf->w;
        if((cursor_width%8) != 0) {
                cursor_width += 8 - (cursor_width%8);
        }
-
+#endif
        std::vector<Uint8> data((cursor_width*nsurf->h)/8,0);
        std::vector<Uint8> mask(data.size(),0);
 
@@ -57,17 +61,24 @@
        for(size_t y = 0; y != nsurf->h; ++y) {
                for(size_t x = 0; x != nsurf->w; ++x) {
                        Uint8 r,g,b,a;
-                       SDL_GetRGBA(pixels[y*nsurf->w + 
x],nsurf->format,&r,&g,&b,&a);
-
+                       Uint8 trans = 0;
+                       Uint8 black = 0;
+                       
                        const size_t index = y*cursor_width + x;
+                       
+                       if (x < cursor_width) {
+                               SDL_GetRGBA(pixels[y*nsurf->w + 
x],nsurf->format,&r,&g,&b,&a);
+
+                               const size_t shift = 7 - (index%8);
+
+                               trans = (a < 128 ? 0 : 1) << shift;
+                               black = (trans == 0 || (r+g+b)/3 > 128 ? 0 : 1) 
<< shift;
+                               
+                               data[index/8] |= black;
+                               mask[index/8] |= trans;
+                       }
 
-                       const size_t shift = 7 - (index%8);
-
-                       const Uint8 trans = (a < 128 ? 0 : 1) << shift;
-                       const Uint8 black = (trans == 0 || (r+g+b)/3 > 128 ? 0 
: 1) << shift;
-
-                       data[index/8] |= black;
-                       mask[index/8] |= trans;
+                       
                }
        }
 
@@ -77,7 +88,11 @@
 SDL_Cursor* cache[cursor::NUM_CURSORS] = { NULL, NULL, NULL, NULL };
 
 //this array must have members corresponding to cursor::CURSOR_TYPE enum 
members
+#ifdef __APPLE__
+const std::string images[cursor::NUM_CURSORS] = { "normal.png", 
"wait-16x16.png", "move.png", "attack.png", "select.png" };
+#else
 const std::string images[cursor::NUM_CURSORS] = { "normal.png", "wait.png", 
"move.png", "attack.png", "select.png" };
+#endif
 
 cursor::CURSOR_TYPE current_cursor = cursor::NUM_CURSORS;
 
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.391 wesnoth/src/playturn.cpp:1.392
--- wesnoth/src/playturn.cpp:1.391      Thu Aug 25 12:39:00 2005
+++ wesnoth/src/playturn.cpp    Sat Aug 27 18:27:04 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.391 2005/08/25 12:39:00 ivanovic Exp $ */
+/* $Id: playturn.cpp,v 1.392 2005/08/27 18:27:04 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -164,6 +164,16 @@
 {
        events::pump();
        events::raise_process_event();
+
+       if (gui_.video().modeChanged()) {
+               if (textbox_.box != NULL) {
+                       const SDL_Rect& area = gui_.map_area();
+                       const SDL_Rect& label_area = 
font::get_floating_label_rect(textbox_.label);
+                       const int ypos = area.y+area.h-30 - (textbox_.check != 
NULL ? textbox_.check->height() + border_size : 0);
+                       textbox_.box->set_location(area.x + label_area.w + 
border_size*2,ypos);
+               }
+       }
+
        events::raise_draw_event();
 
        const theme::menu* const m = gui_.menu_pressed();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]