from spw.gui import GUI, Context
text = GUI.input("textbox", (70,10,100,30))
if GUI.toggle("show", (290,10,10,10)):
if GUI.button("quit", "Quit", (190,30,100,100)):
options = "new", "open", "save"
action = GUI.menu("file", "FILE", (10,10,50,30), options)
if action is not None: print action
context = Context(pygame.display.set_mode((320,240)))
window = Window()
e = pygame.event.wait()
if e.type == pygame.QUIT: break
with context as canvas:
GUI.draw(window, canvas, e)
Wednesday, August 26, 2009
SPW does stupid easy GUI screens.
I would like an easy way to write GUI screens for my games... one function to draw the GUI, handle GUI state, and respond to GUI events. No widget graphs, no parent child relationships, no callbacks. It can be done. The code below uses a new GUI module in the SPW library. Many more widgets are required, as at the moment there are only input boxes, buttons, toggles and menu widgets.
I've just seen and used a brilliant ssh option. The command: sudo ssh -D localport user@externalhost will set up a local SOCKS proxy l...
So, you've created a car prefab using WheelCollider components, and now you can apply a motorTorque to make the whole thing move along. ...
import csv open("output.tsv", "w").write("\n".join("\t".join(e.strip() for e in i) for i in csv.rea...
When you start working with threads in your Unity3D project, you will discover that many things need to be done in the main loop. For exampl...
Working with multiple threads is often a necessary evil. This is how I do it safely inside a Unity3D component. There are only certain time...
Thank to Adrian Boeing I was inspired this morning to hack together a ripple shader for Unity3D. Thanks for the math Adrian. You can see t...
Just 514 lines of code. Uses sockets only, no other dependencies. https://github.com/simonwittber/uniwebserver Example Component: [Req...
Possibly slightly more correct lighting. The rim light is now only applied in the direction of the sun, rather than being purely based on v...
Often, when building a game, you need to test if objects are colliding. The objects could be spaceships, rocks, mouse pointers, laser beams....
My friend Jack Nutting has released his first iPhone game. I have to say, this is the first iPhone game I've not regretted paying mone...