mail[Wesnoth-commits] r40138 - /branches/fendrin_gui_stuff/src/controller_base.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by fabianmueller5 on December 06, 2009 - 10:58:
Author: fendrin
Date: Sun Dec  6 10:58:23 2009
New Revision: 40138

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40138&view=rev
Log:
Quick hack to test the keyboard move of the highlighted hex.

Modified:
    branches/fendrin_gui_stuff/src/controller_base.cpp

Modified: branches/fendrin_gui_stuff/src/controller_base.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/controller_base.cpp?rev=40138&r1=40137&r2=40138&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/controller_base.cpp (original)
+++ branches/fendrin_gui_stuff/src/controller_base.cpp Sun Dec  6 10:58:23 
2009
@@ -17,6 +17,9 @@
 #include "dialogs.hpp"
 #include "mouse_handler_base.hpp"
 #include "foreach.hpp"
+//new inlcude TODO
+//#include "display.hpp"
+
 
 controller_base::controller_base(
                int ticks, const config& game_config, CVideo& /*video*/) :
@@ -128,6 +131,9 @@
 
 bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int 
mouse_flags)
 {
+//     get_display().highlight_hex()
+
+
        bool mouse_in_window = (SDL_GetAppState() & SDL_APPMOUSEFOCUS) != 0
                || 
utils::string_bool(preferences::get("scroll_when_mouse_outside"), true);
        bool keyboard_focus = have_keyboard_focus();
@@ -175,7 +181,36 @@
                        dy += round_double(ydisp * speed);
                }
        }
-       return get_display().scroll(dx, dy);
+//     return get_display().scroll(dx, dy);
+
+       map_location loc = get_display().hex_clicked_on(mousex, mousey);
+
+       if ((key[SDLK_UP] && keyboard_focus) ||
+           (mousey < scroll_threshold && mouse_in_window))
+       {
+               loc.y -= 1;
+//             lox.y
+       }
+       if ((key[SDLK_DOWN] && keyboard_focus) ||
+           (mousey > get_display().h() - scroll_threshold && 
mouse_in_window))
+       {
+               loc.y += 1;
+//             dy += scroll_speed;
+       }
+       if ((key[SDLK_LEFT] && keyboard_focus) ||
+           (mousex < scroll_threshold && mouse_in_window))
+       {
+               dx -= scroll_speed;
+       }
+       if ((key[SDLK_RIGHT] && keyboard_focus) ||
+           (mousex > get_display().w() - scroll_threshold && 
mouse_in_window))
+       {
+               dx += scroll_speed;
+       }
+
+//     get_display().scroll_to_tile(loc);
+       get_display().highlight_hex(loc);
+       return false;
 }
 
 void controller_base::play_slice(bool is_delay_enabled)




Related Messages


Powered by MHonArc, Updated Sun Dec 06 11:20:09 2009