[Bf-python] game engine callbacks for Blender.Draw gui's
Thomas Dyar
tdyar at MIT.EDU
Tue Sep 9 15:17:24 CEST 2003
Hi,
I am following up on an earlier post in which I suggested that Draw GUI
scripts be made aware of game engine status, such as when it runs and
stops. Now I am looking into implementation and I have some questions.
It would be cool if the game engine start and stop could trigger an event
that could be picked up by the registered Draw event callback. Can someone
give me a rough sketch of the callback process re. the python? Rather than
go through the usual event queue, which would rely on GHOST and be too
low-level, is there a way to "shortcut" to the
BPY_spacetext_do_pywin_event() function? Registering the callbacks would be
all the same, but a new event type could be game engine start (0), and end
(1). Very simple idea, but is there any way to trigger an event from the
space.c draw function that starts the game whe PKEY is pressed?
Another way would be to add a global flag GAME_RUNNING to the Global struct
in bke_global.h. GAME_RUNNING could be transferred to a python-accessible
variable in the Draw module. During the registered draw callback a python
script could compare it to its previous value. Not an event, but a state.
Thanks for any comments,
Tom
More information about the Bf-python
mailing list