Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mouse grab
11-16-2008, 06:43 PM,
#7
 
alex25 Wrote:actually this code should go in main if implemented in this form.

something like this:

Code:
--- main.cpp    (revision 2219)
+++ main.cpp    (working copy)
@@ -1,5 +1,7 @@
#include "game.h"

+#include <fenv>
+
#include <list>
using std::list;

@@ -12,9 +14,26 @@

#include "logging.h"
#include "pathmanager.h"
+#include <signal>

+void release_mouse(int a)
+{
+//  eventsystem.SetMouseCursorVisibility(true);
+  std::cout << "should be releasing the mouse" << endl;
+  SDL_WM_GrabInput(SDL_GRAB_OFF);
+}
+
+
int main (int argc, char * argv[])
{
+// catch fpe exceptions.
+//      feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);
+//     feenableexcept(FE_ALL_EXCEPT);
+// release the mouse when we abort
+        struct sigaction act;
+        act.sa_handler = release_mouse;
+        sigaction(SIGABRT,&act, NULL);
+
        list <string> args(argv, argv + argc);

        //find the path of the log file

ignore the part about fpe exceptions, i guess (and the debug statement).

--alex--
Reply


Messages In This Thread
mouse grab - by alex25 - 11-14-2008, 02:24 AM
[No subject] - by thelusiv - 11-14-2008, 03:37 PM
[No subject] - by alex25 - 11-14-2008, 05:21 PM
[No subject] - by joevenzon_phpbb2_import3 - 11-16-2008, 05:23 PM
Re: mouse grab - by joevenzon_phpbb2_import3 - 11-16-2008, 05:39 PM
[No subject] - by alex25 - 11-16-2008, 06:37 PM
[No subject] - by alex25 - 11-16-2008, 06:43 PM
[No subject] - by joevenzon_phpbb2_import3 - 11-16-2008, 08:49 PM
[No subject] - by alex25 - 11-16-2008, 08:54 PM
[No subject] - by joevenzon_phpbb2_import3 - 11-16-2008, 09:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)