PyOIS build against Python 2.4 available?

Jamison

05-07-2006 06:53:49

Hello All...

I'm looking around for a decent input system for a game I'm building the engine for and I'm kind of stuck at the moment. I'm using PyOGRE for the graphics (obviously since I'm posting here) and DirectPython for my sound and music. Each of these libraries contains input modules, but from reading on these boards, the PyOGRE input should be avoided in anything more than demos. The DirectPython input does not play well with being passed a hWnd so that will not help any as I'm letting PyOGRE create the window.

The other option I have tried is using PyHook to get global Keyboard and Mouse input statements, but I'd like to do something a little less hacky with it. Catching all global events and trimming out the ones I like seems a little incorrect.

PyOIS looks like it could be what I'm looking for, but I have absolutely no knowledge of building it from the source code. Does anyone happen to have a distribution of this library compiled to Python 2.4? Either way, does anyone know whether it requires its own window creation or if it does well with watching input to a passed window argument.

Thanks in advance,
Jamison

Istari

05-07-2006 11:32:29

PyOIS requires you to pass a window handle to it, it has no methods for creating it's own windows.

PyOIS hasn't been updated since 0.5 or 0.6 but there is a readme file with the source that explains the build process pretty well.
I'm going to Sweden for a week, on vacation, and I plan to work on PyOgre and PyOIS while I'm there.
If I can get to an Internet connection I'll try to put something up on my home server. If I can't, I'll try to have something ready by next wednesday (12. July '06)

Jamison

05-07-2006 16:36:15

Sounds good... I'll anxiously await the binary considering I've never built any libraries from C source before and don't even have a compiler. Thanks for the help... it seems OIS is just what I'm looking for.

-Jamison

Srekel

08-07-2006 15:04:26

PyOIS requires you to pass a window handle to it, it has no methods for creating it's own windows.

PyOIS hasn't been updated since 0.5 or 0.6 but there is a readme file with the source that explains the build process pretty well.
I'm going to Sweden for a week, on vacation, and I plan to work on PyOgre and PyOIS while I'm there.
If I can get to an Internet connection I'll try to put something up on my home server. If I can't, I'll try to have something ready by next wednesday (12. July '06)


Hey, good choice for a vacation. :) Where are you staying?

A good input library is something we are looking for as well, so hope you get a lot of free time on your vacation to work on PyOIS. :)

Istari

12-07-2006 18:28:05

My laptop died on me last friday so I haven't been able to do any of the work I intended to do. :(
I will do my best to have, at the least, a preliminary build of PyOIS by this weekend.

@Srekel: I was staying in Kallinge, or Ronneby. I love all the trees, when I got back home it was like "hey. I can see the horizon again." :)

Istari

15-07-2006 12:38:09

Here it is, it is compiled against the CVS version of OIS. Please let me know if you find any bugs.
If you are interested in the source, you can find it in the ois CVS repo.

http://ares.hlekkir.com/pyogre/pyois-win32-py24.zip

pjcast

15-07-2006 19:18:16

Thanks for updating pyOIS :)

I plan on adding a build of pyOIS when I release 0.7.2 OIS, as I plan to have an SDK installer for win32. Just to be sure, all I need to distribute for it would be pyOIS.lib, _ois.pyd, ois.py (and of course a small readme and your license file)?

Also, I made a small change in your wx demo code:
character (%s) to character (%c) in your keyPressed hander, as before it was printing out just a number instead of a char. Seems to work here. I didn't commit anything to cvs, not sure what your going for there ;)

Istari

15-07-2006 22:46:16

I don't think that you really need the lib file, I think that VS creates it just because it is for a dll file. I don't move it out of the build directory and I never have any problems.
ois.py and _ois.pyd are vital however.

Good point about wxTest.py it makes a lot more sense, I have committed it to CVS. :)

dermont

15-07-2006 23:17:57

Nice job Istari. I'm also a bit confused regarding the keyPressed char/int and arg.text. In pyCegui (1) works, (2) doesn't. If it weren't for pjcast's post I would have never thought of doing it that way.


def keyPressed(self, arg):
print "Type is",type(arg.text)
>> Type is <type 'int'>
1) keyChar = "%c" % (arg.text)
2) keyChar = arg.text
cegui.System.getSingleton().system.injectKeyDown(arg.key)
cegui.System.getSingleton().system.injectChar(keyChar)

Istari

15-07-2006 23:49:48

PyOIS should probably do some translation based on the result of ois.Keyboard.getTextTranslation i.e. convert the result of arg.text to Unicode, ASCII or just an int.

I'll have to look into that.

pjcast

16-07-2006 00:02:42

hmm, OIS really doesn't yet return Unicode, at least under Windows, but does return local character translations. However, CEGUI injectChar last I looked took an int parameter, so, casting is to a char type or leaving it as an int should function the same (it is after just a number).

Though, I don't know python beyond what I've seen in the pyOIS demos ;) And, I don't really know what kindof casting rules it does.

dermont

16-07-2006 00:24:21

From cegui0.4.1 apis:
bool injectChar(utf32 code_point);

For pyogre/pycegui we had to change it to accept a python string (instead of utf32) and convert that inside the C++ function. I've updated pycegui similarly with a new injectOISChar which takes an int and appears to work ok. From the name arg.text I wouldn't have guessed it was an int.

dermont

16-07-2006 00:49:48

Ok submitted patch and test case for pycegui using same injectChar method.

Game_Ender

16-07-2006 18:35:18

Check out the release of version 7.2.0. It includes a new version of PyOIS.

pjcast

16-07-2006 22:28:35

Check out the release of version 7.2.0. It includes a new version of PyOIS.

Thanks for spreading the news :)

Yuppers, OIS SDK has been released, and included in the extras folder is the latest build of PyOIS and the two demo files, the wxPython works well here, and I imagine the PyOgre demo works well, but I don't have PyPgre, so can't comment.

dermont

21-07-2006 16:18:47

@Istari:

Typo in OISObject.i, linux is unable to find header:
//#include "OISJoystick.h"
#include "OISJoyStick.h"

ois.i should include preprocessor to handle linux/mingw builds:
#ifdef __WIN32__
# define _MSC_VER
#else
# define __GNUC__
#endif

Istari

21-07-2006 21:20:56

Thank you. I have committed the changes to CVS