From: Alberto G. <al...@ti...> - 2002-01-03 00:04:58
|
Hello. I'm glad to see you are so interested to PyAllegro. To answer to the question about wrapping global variables, I must say: it depends on the variable :) As regards mouse_x, for example, there is a function called 'get_mouse_pos' which returns a 4-tuple of ints: mouse_z, mouse_y, mouse_z, mouse_b. For globals which value change only after the invocation of some functions (for example screen), the solution was to update the value inside that function, for example: def set_gfx_mode(card, w, h, v_w, v_h): ..... global screen screen = _alpy.get_screen() .... and so on. Other solutions are possible, especially using __getattr__/__setattr__ (have a look at 'counters' object in alpy.py for example) There are situations, anyway, where the get/set pair of functions seems difficult to avoid: I've used it for example to provide access to the 'line' member of BITMAP structs. I hope the answer is enough: if not, ask it again :-) Alberto Griggio |