Friday, August 31, 2007


Beta1 is out for feedback. Here's a link for some instructions:

Thursday, August 30, 2007

Material problems

Previous screenshots shows 'stats' overlay graphics a bit garbled, and I couldn't figure out why.  The graphics were present, and loading according to the log.  They sometimes were showing up looking like other material.  Then I noticed that the size of the loaded graphics were different from the actual pixel size of the .png file.  For example:

22:51:43: Texture: GUI_JP_DIST.png: Loading 1 faces(PF_R8G8B8A8,128x32x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x32x1.

But, the .png file is actually 96x24 pixels.  By resizing the .png to 128x32, it works fine now.



Thursday, August 23, 2007


Playback is working nicely.  The text color for buttons are now more clear.
I was using:
mButton->setProperty("NormalTextColour", PropertyHelper::colourRectToString( ColourRect( colour(0.8,0.8,0.8) ) ) );
And what works is:
mButton->setProperty("NormalTextColour", PropertyHelper::colourToString( CEGUI::colour(1,1,1) ) );

Monday, August 20, 2007


An update with StuntPlayground - most of the game play is now working.  Got a bit of a crash on closing, but that should be easy to figure out.  New screenshot of after a jump:

Friday, August 17, 2007


I've been porting StuntPlaygound to MacOSX.  It uses the Ogre3D engine.  The source was kindly provided at  The main challenges have been getting to run on the latest version of Ogre ("Eihort", 1.4.x), which uses CEGUI v0.5 for UI elements and OIS for keyboard and mouse input.
So far, I have the arena spinning around and the logo comes up:
More updates as I progress.

Wednesday, August 15, 2007

Using NetWorkSpaces with Python

In order to try out NetWorkSpaces for Python, I tackled a problem I've had for some time.  Due to IT reasons, its easier to have my Outlook client run on a PC nearby, and view that PC through VNC.  But, sometimes I miss meeting notices if I'm not around to hear the reminder sound through the PC's speakers.

First I needed create Macros for Outlook to run each time I received an email or a reminder.  There are subroutines called 'Application_NewMail' and 'Application_Reminder' that are called, so I grabbed some information from the subject in each of those routines, entitled each with either 'Email' or 'Reminder', and sent the info to a Python script:

Public Function SendText1(title, txt)
Dim prog As String
Dim t As String
Dim WSHShell

Set WSHShell = CreateObject("wscript.Shell")
t = " " & Trim(txt)
prog = "c:\Python25\Python.exe c:\Python25\ " & title & " """ & t & """"
WSHShell.Run prog, 1, 1
Set WSHShell = Nothing
End Function

Private Sub Application_NewMail()
Dim oFolder
Dim oNewItem
Dim s
Dim n

Set oFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set oNewItem = oFolder.Items.GetLast
Rem For Each oNewItem In oFolder.Items.Restrict("[Unread] = 0")
s = oNewItem.SenderName & ": "
s = s & Trim(oNewItem.Subject)
n = "Email"
Call SendText1(n, s)
Rem Next
End Sub

Private Sub Application_Reminder(ByVal Item As Object)
Dim s As String
Dim sBody As String
Dim n

s = Item.Subject & "(" & Item.Location & ") " & FormatDateTime(Item.Start, vbShortTime)
n = "Reminder"
Call SendText1(n, s)
End Sub

Notice in 'SendText1' I run a Python script called '' with two parameters, coming in as args[1] and args[2]:

from nws.client import NetWorkSpace
import sys

def main(args):
ws = NetWorkSpace('kh_outlook', serverHost='bvt-dc00133', useUse=True)'notify', (args[1],args[2]))

if __name__=="__main__":

The script grabs the NetWorkSpace 'kh_outlook', stores to the name 'notify' a tuple for the two arguments, and then exits.

On my Mac, I run a 'server' that hangs around, watching the NetWorkSpace of 'kh_outlook', fetching 'notify', and passing the two strings from the tuple to Growl, using growlnotify:

import os
from nws.client import NetWorkSpace

print "Starting server..."
ws = NetWorkSpace('kh_outlook', serverHost='bvt-dc00133', persistent=True)
while 1:
message = ws.fetch('notify')
cl = "growlnotify -s -a -m \"" + message[1] + "\" -t " + message[0]
except KeyboardInterrupt:
print 'shutting down gracefully.'

print 'Exiting.'

I get Growl messages for each email or reminder, titled ('-t' option) with either 'Email' or 'Reminder' respectively, and I set those messages sticky with the '-s' option so I won't miss them if I'm away from my Mac.

Monday, August 13, 2007

Python Intro

Gave a short talk at the Portland Cocoaheads meeting last Wednesday, Aug. 8th. I basically wanted to highlight the bits of Python that I wish I had known before I dove in. Here's the code I used to copy and paste into an interactive Python session:


# indentation
a = 1
if (a == 1):
print a
print "a != 1"

# if statement
a = 3
if a > 0:
print 'greater'
elif a == 0:
print 'equal'
print 'less'

# while loops
a = 3
while a > 0:
print "a = %d"%a
a -= 1

def hello(who):
print "Hello, " + who


# strings
def hello(who):
return "Hello, " + who
s = hello("world")
print "s = %s"%s
print s[0:5]
print len(s[0:5])
print s.upper()

# lists
l = [ 'a', 'b', 'c', 1, 2, 3 ]
print l
# third element
print l[2]
# third, fourth, and fifth elements
print l[2:4]
# last element
print l[-1]
# append
print l

# for loops
for i in l:
print i

# dictionary
d = {'alpha': 1, 'beta':2, 'gamma':3}
d['delta'] = 4
print d
print d['gamma']
del d['gamma']
if d.has_key('gamma'):
print 'has gamma'
print 'does not have gamma'
for k,v in d.iteritems():
print "k = ",k
print "v = ",v

# sets
s1 = set()
for x in 'aabbbccccdddddefffffff':
print 'set s1 = ',s1

# dir() function
# dir(s)

# help function
import platform

# using pyobjc
from Foundation import *
d1 = NSMutableDictionary.dictionary()
print isinstance(d, dict)
print type(d)
print isinstance(d1, dict)
print type(d1)
print isinstance(d1, NSMutableDictionary)
d1.setObject_forKey_(42, 'key2')
d1['key1'] = 'hello'
print d
print d1

# addressbook example
import AddressBook
book = AddressBook.ABAddressBook.sharedAddressBook()
b = book.people()
print "Number of people in addressboo is ",len(b)
print b[1].valueForProperty_(AddressBook.kABLastNameProperty)
print type(b)