Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-31 18:21:00 +0000
committerStijn Buys <ingar@osirion.org>2011-07-31 18:21:00 +0000
commit9652995287be63ecc34de9bf2174b3f22435861d (patch)
treee3aaba14024a789fc2b74b54352a9c2511548e4a
parent67ebc66aa1be7188f99e215e1353c27cf203308f (diff)
Expose global mouse pointer location,
set default mouse pointer at the start of the main widget draw loop, hide cursor above console.
-rw-r--r--src/ui/console.cc6
-rw-r--r--src/ui/ui.cc5
-rw-r--r--src/ui/ui.h5
3 files changed, 16 insertions, 0 deletions
diff --git a/src/ui/console.cc b/src/ui/console.cc
index 5c15bc5..00aa09f 100644
--- a/src/ui/console.cc
+++ b/src/ui/console.cc
@@ -17,6 +17,7 @@
#include "render/gl.h"
#include "ui/console.h"
#include "ui/paint.h"
+#include "ui/ui.h"
namespace ui
{
@@ -210,6 +211,11 @@ void Console::draw()
l[0] += width() - s.width() - 4;
l[1] += height() - s.height() - 4;
Paint::draw_text(l, font(), version);
+
+ // disable mouse cursor
+ if (has_mouse_focus()) {
+ ui::root()->set_pointer();
+ }
}
void Console::save_history()
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index 91eacd3..459a2a0 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -484,8 +484,13 @@ void UI::frame()
}
ui_mouse_focus = f;
+ // reset mouse pointer
+ ui::root()->set_pointer("pointer");
+
+ // draw the widget stack
event_draw();
+ // draw the mouse pointer
if (visible())
draw_pointer();
}
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 855d6ee..b3bb43b 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -92,6 +92,11 @@ public:
return ui_font_large;
}
+ inline const math::Vector2f & global_mouse_coords()
+ {
+ return mouse_cursor;
+ }
+
/* -- mouse pointer ---------------------------------------- */
/// set mouse pointer bitmap