widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00429
[Merge] lp:~nomeata/widelands/clickcursor into lp:widelands
Joachim Breitner has proposed merging lp:~nomeata/widelands/clickcursor into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #886387 in widelands: "Make hand-cursor visually react on mouse presses"
https://bugs.launchpad.net/widelands/+bug/886387
For more details, see:
https://code.launchpad.net/~nomeata/widelands/clickcursor/+merge/81343
Click cursor. Was really simple to implement.
--
https://code.launchpad.net/~nomeata/widelands/clickcursor/+merge/81343
Your team Widelands Developers is requested to review the proposed merge of lp:~nomeata/widelands/clickcursor into lp:widelands.
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2011-03-09 07:14:49 +0000
+++ src/ui_basic/panel.cc 2011-11-04 22:56:26 +0000
@@ -41,7 +41,7 @@
// for scripts that want to show off functionality without the user interfering.
bool Panel::_g_allow_user_input = true;
PictureID Panel::s_default_cursor = g_gr->get_no_picture();
-
+PictureID Panel::s_default_cursor_click = g_gr->get_no_picture();
/**
* Initialize a panel, link it into the parent's queue.
@@ -138,6 +138,7 @@
forefather = p;
s_default_cursor = g_gr->get_picture(PicMod_UI, "pics/cursor.png");
+ s_default_cursor_click = g_gr->get_picture(PicMod_UI, "pics/cursor_click.png");
// Loop
_running = true;
@@ -177,7 +178,11 @@
forefather->do_draw(rt);
- rt.blit(app->get_mouse_position() - Point(3, 7), s_default_cursor);
+ rt.blit
+ (app->get_mouse_position() - Point(3, 7),
+ WLApplication::get()->is_mouse_pressed() ?
+ s_default_cursor_click :
+ s_default_cursor);
if (Panel * lowest = _mousein) {
while (Panel * const mousein = lowest->_mousein)
=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h 2011-02-19 20:54:47 +0000
+++ src/ui_basic/panel.h 2011-11-04 22:56:26 +0000
@@ -302,6 +302,7 @@
static Panel * _g_mousein;
static bool _g_allow_user_input;
static PictureID s_default_cursor;
+ static PictureID s_default_cursor_click;
};
inline void Panel::set_snap_windows_only_when_overlapping(const bool on) {
=== modified file 'src/wlapplication.h'
--- src/wlapplication.h 2011-02-21 03:47:13 +0000
+++ src/wlapplication.h 2011-11-04 22:56:26 +0000
@@ -167,6 +167,9 @@
/// The mouse's current coordinates
Point get_mouse_position() const throw () {return m_mouse_position;}
+ //
+ /// Find out whether the mouse is currently pressed
+ bool is_mouse_pressed() const {return SDL_GetMouseState(NULL, NULL); }
/// Swap left and right mouse key?
void set_mouse_swap(const bool swap) {m_mouse_swapped = swap;}
Follow ups