Author: alink
Date: Sun Apr  8 03:13:07 2007
New Revision: 16684

URL: http://svn.gna.org/viewcvs/wesnoth?rev=16684&view=rev
Log:
After a user scrolling (arrows and screen border) the new hex under 
the mouse is now highlighted without need to move the mouse. The update 
is done at the end of the scrolling because a continuous one "dances" 
between hex, specially if the scrolling is horizontal.

Modified:
    trunk/src/play_controller.cpp
    trunk/src/play_controller.hpp

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=16684&r1=16683&r2=16684&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Sun Apr  8 03:13:07 2007
@@ -690,30 +690,35 @@
        tooltips::process(mousex, mousey);
 
        const int scroll_threshold = (preferences::mouse_scroll_enabled()) ? 5 
: 0;
-       bool scrolling = false;
+       bool was_scrolling = scrolling_;
+       scrolling_ = false;
 
        if((key[SDLK_UP] && !menu_handler_.get_textbox().active()) || mousey < 
scroll_threshold) {
                gui_->scroll(0,-preferences::scroll_speed());
-               scrolling = true;
+               scrolling_ = true;
        }
 
        if((key[SDLK_DOWN] && !menu_handler_.get_textbox().active()) || mousey 
> gui_->y()-scroll_threshold) {
                gui_->scroll(0,preferences::scroll_speed());
-               scrolling = true;
+               scrolling_ = true;
        }
 
        if((key[SDLK_LEFT] && !menu_handler_.get_textbox().active()) || mousex 
< scroll_threshold) {
                gui_->scroll(-preferences::scroll_speed(),0);
-               scrolling = true;
+               scrolling_ = true;
        }
 
        if((key[SDLK_RIGHT] && !menu_handler_.get_textbox().active()) || mousex 
> gui_->x()-scroll_threshold) {
                gui_->scroll(preferences::scroll_speed(),0);
-               scrolling = true;
+               scrolling_ = true;
        }
 
        gui_->draw();
-       if(! scrolling) {
+       if (!scrolling_) {
+               if (was_scrolling) {
+                       // scrolling ended, update the cursor and the 
brightened hex
+                       mouse_handler_.mouse_update(browse_);   
+               }
                gui_->delay(20);
        }
 

Modified: trunk/src/play_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.hpp?rev=16684&r1=16683&r2=16684&view=diff
==============================================================================
--- trunk/src/play_controller.hpp (original)
+++ trunk/src/play_controller.hpp Sun Apr  8 03:13:07 2007
@@ -144,6 +144,7 @@
        unsigned int start_turn_;
        bool skip_replay_;
        bool browse_;
+       bool scrolling_;
        bool first_turn_;
 
 private:


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to