Heres the code call from the host let the script initialize the restg pydict
280 6. INTEGRATION: USING EXISTING SCRIPTING SYSTEMS
// Initialize Python
InitPython ();// Load your script and get a pointer to its dictionary g_pName = PyString_FromString ( "script" );
g_pModule = PyImport_Import ( g_pName );
if ( ! g_pModule )
W_ExitOnError ( "Could not open script.\n" );
g_pDict = PyModule_GetDict ( g_pModule );
Team-Fly®
// Start the main loop
MainLoop
{
// Start the current loop iteration
HandleLoop
{
// Let Python handle the frame
PyObject_CallObject ( g_pFunc, NULL );
// Check for the Escape key and exit if it's down if ( W_GetKeyState
( W_KEY_ESC ) )
W_Exit ();
}
}
ALIEN_COUNT = 12 # Number of aliens onscreen MIN_VEL = 2 # Minimum
velocity
MAX_VEL = 8 # Maximum velocity