This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 81cfb3c3c3d08268a25747d38e05274c8b335300 (commit) via 57342d11f3b297b3094b1a7ad23c037d369563b3 (commit) via 7c0b661b5432f428fa62f362a45d70ee3081a8d3 (commit) via 8de99349842bc33fb809ed145ac767739bdecec2 (commit) from 2b990abb940a194551bed5dc1404fc7b6652fefc (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/81cfb3c3c3d08268a25747d38e05274c8b335...
commit 81cfb3c3c3d08268a25747d38e05274c8b335300 Author: Cyril Hrubis metan@ucw.cz Date: Tue Mar 19 23:21:40 2013 +0100
demos: py_simple: showimage.py: Add input event hanlding.
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py index 768d640..b952078 100755 --- a/demos/py_simple/showimage.py +++ b/demos/py_simple/showimage.py @@ -5,6 +5,7 @@ import sys import gfxprim.core as core import gfxprim.loaders as loaders import gfxprim.backends as backends +import gfxprim.input as input
def main(): if len(sys.argv) != 2: @@ -19,9 +20,17 @@ def main(): img.Blit(0, 0, bk.context, 0, 0, img.w, img.h) bk.Flip()
- # TODO: Input events while True: - bk.Poll() + bk.Wait() + ev = bk.GetEvent() + + input.EventDump(ev) + + if (ev.type == input.EV_KEY): + sys.exit(0) + elif (ev.type == input.EV_SYS): + if (ev.code == input.EV_SYS_QUIT): + sys.exit(0)
if __name__ == '__main__': main()
http://repo.or.cz/w/gfxprim.git/commit/57342d11f3b297b3094b1a7ad23c037d36956...
commit 57342d11f3b297b3094b1a7ad23c037d369563b3 Author: Cyril Hrubis metan@ucw.cz Date: Tue Mar 19 23:20:14 2013 +0100
pywrap: backends: Hacked support for input events.
diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py index ae351d7..97975a7 100644 --- a/pylib/gfxprim/backends/_extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -1,5 +1,6 @@ from ..utils import extend, add_swig_getmethod, add_swig_setmethod from . import c_backends +from ..input import c_input
def extend_backend(_backend): """ @@ -29,6 +30,11 @@ def extend_backend(_backend): return c_backends.GP_BackendPoll(self)
@extend(_backend) + def Wait(self): + "Waits for backend event" + return c_backends.GP_BackendWait(self) + + @extend(_backend) def SetCaption(self, caption): "Set backend window caption (if possible)" return c_backends.GP_BackendSetCaption(self, caption) @@ -37,3 +43,13 @@ def extend_backend(_backend): def Resize(self, w, h): "Resize backend window (if possible)" return c_backends.GP_BackendResize(self, w, h) + + @extend(_backend) + def GetEvent(self): + "Removes and returns event from the top of the event queue" + if c_backends.GP_BackendEventsQueued(self) == 0: + return None + ev = c_input.GP_Event(); + if c_backends.GP_BackendGetEvent(self, ev) != 0: + return ev + return None
http://repo.or.cz/w/gfxprim.git/commit/7c0b661b5432f428fa62f362a45d70ee3081a...
commit 7c0b661b5432f428fa62f362a45d70ee3081a8d3 Author: Cyril Hrubis metan@ucw.cz Date: Tue Mar 19 23:14:42 2013 +0100
pywrap: input: Fix & constructor for GP_Event.
* Fixes the input module wrapping
* Adds constructor and destructor for GP_Event
diff --git a/pylib/gfxprim/input/C.py b/pylib/gfxprim/input/C.py deleted file mode 100644 index c8f987f..0000000 --- a/pylib/gfxprim/input/C.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -Submodule for constants -""" diff --git a/pylib/gfxprim/input/__init__.py b/pylib/gfxprim/input/__init__.py index 31c371f..4a77b23 100644 --- a/pylib/gfxprim/input/__init__.py +++ b/pylib/gfxprim/input/__init__.py @@ -2,10 +2,7 @@ Module wrapping GfxPrim Input. """
-from . import input_c - -# Constants module -from . import C +from . import c_input
def _init(module): # Import some members from the SWIG module @@ -14,13 +11,9 @@ def _init(module): def strip_GP(s): return re.sub('^GP_', '', s)
- # Constants - const_regexes = ['^GP_[A-Z0-9_]*$'] - import_members(input_c, C, include=const_regexes, sub=strip_GP) - # Functions - import_members(input_c, module, sub=strip_GP, - exclude=const_regexes + [ + import_members(c_input, module, sub=strip_GP, + exclude=[ '^gfxprim$', '^w+_swigregister$', '^_w+$']) diff --git a/pylib/gfxprim/input/input.i b/pylib/gfxprim/input/input.i index a9899a3..43b5a4a 100644 --- a/pylib/gfxprim/input/input.i +++ b/pylib/gfxprim/input/input.i @@ -1,8 +1,20 @@ %include "../common.i" -%module(package="gfxprim.input") input_c +%module(package="gfxprim.input") c_input
%{ +#include "core/GP_Debug.h" #include "input/GP_Input.h" %}
+%extend GP_Event { + ~GP_Event() { + GP_DEBUG(2, "[wrapper] GP_Event free()"); + free($self); + } + GP_Event() { + GP_DEBUG(2, "[wrapper] GP_Event malloc()"); + return malloc(sizeof(GP_Event)); + } +}; + %include "GP_Event.h"
http://repo.or.cz/w/gfxprim.git/commit/8de99349842bc33fb809ed145ac767739bdec...
commit 8de99349842bc33fb809ed145ac767739bdecec2 Author: Cyril Hrubis metan@ucw.cz Date: Tue Mar 19 22:39:37 2013 +0100
demos: py_simple: New demo showimage.py.
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py new file mode 100755 index 0000000..768d640 --- /dev/null +++ b/demos/py_simple/showimage.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import sys + +import gfxprim.core as core +import gfxprim.loaders as loaders +import gfxprim.backends as backends + +def main(): + if len(sys.argv) != 2: + print("Takes an image as an argument") + sys.exit(1) + + # Load Image + img = loaders.Load(sys.argv[1]) + + bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0) + assert(bk) + img.Blit(0, 0, bk.context, 0, 0, img.w, img.h) + bk.Flip() + + # TODO: Input events + while True: + bk.Poll() + +if __name__ == '__main__': + main()
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/showimage.py | 36 +++++++++++++++++++++++++++++ pylib/gfxprim/backends/_extend_backend.py | 16 +++++++++++++ pylib/gfxprim/input/C.py | 3 -- pylib/gfxprim/input/__init__.py | 13 ++-------- pylib/gfxprim/input/input.i | 14 ++++++++++- 5 files changed, 68 insertions(+), 14 deletions(-) create mode 100755 demos/py_simple/showimage.py delete mode 100644 pylib/gfxprim/input/C.py
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.