I can’t document everything from scratch since I don’t have a machine that’s “virgin” enough for me to document that. This machine has been touched by Fink, MacPorts, Rudix, and several hand-build packages; I’m not sure if MacFUSE installs the necessary stuff for pkg-config.
But, let’s presume you:
a) installed macfuse,
b) fetched pkg-config source code from freedesktop.org (I took 0.25)
c) built it and installed it (
sudo make install)
d) switched to pristine Python 2.6 that Apple ships with Snow Leopard.
I’m also obviously using Snow Leopard, so no guarantees about other OS X versions.
Ok, and now come the tips…
Continue reading →
Know about this?
x = [i * 2 for i in [1, 2, 3, 4]]
Be careful. The scope of “i” is not limited to the expression it is used in.
If you just do:
# Of course: cegui.wm=cegui.WindowManager.getSingleton()
then, despite “line” being UTF8, some piece of code will attempt to convert it into something “appropriate.” We don’t want that. We want our UTF8 string to be displayed with correct encoding, without guesses about what to convert it into — because the guess is incorrect! (It looks like it converts it into ascii or some Western European codepage).
So let’s force the wrapper to do the right thing:
Or you may prefer a utility function which does that:
This was necessary on PythonOgre SVN revision 996, wrapping Ogre 1.6.1 and CEGUI 0.6.2b for Python 2.5, on Mac.
Image courtesy of Bart Simpson Chalkboard Generator from addletters.com
/Users/ivucica/Developer/ogre/Mac/Ogre/../../OgreMain/include/OgreAxisAlignedBox.h:246: failed assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"'
In Cateia, we were getting this bug on one particular place in the game, related to a particle system in Ogre3D.
We use PythonOgre and we normally quite liberally throw around try..except blocks to catch issues. Most exceptions are caught properly on the Python level because PythonOgre wraps most Ogre3D exceptions. However, this is not an exception, this is an assertion.
Basically, particle systems in Ogre are interesting in that they automatically update their own AAB (axis aligned boundary [box]) for initial 10 seconds (after which they are presumed to reach their maximum size). You can change the length during which update will happen, if at all.
We have a particle system of water which falls to the ground. This means that at one point AAB becomes very, very small (or perhaps even inverses itself?) Since our game is a 2.5D adventure (2D backgrounds, 3D characters), we really don’t need AABs that much because only objects that are on scene are relevant.
So the solution is:
We expand to infinite boundary box, and tell the particle system not to update itself. C++ code is the same.