diff options
| author | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-14 22:49:28 -0400 |
|---|---|---|
| committer | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-14 22:49:28 -0400 |
| commit | 7e9b495ca8c5aef1b4f3e4d5a29283df27348a84 (patch) | |
| tree | 44246a5ac35ab49e3d12543e2c08e9e581302c0f /lib | |
| parent | f4be6ead7080a62c18058b42e4b50b9a92c2ff3a (diff) | |
| download | gempy-7e9b495ca8c5aef1b4f3e4d5a29283df27348a84.tar.gz gempy-7e9b495ca8c5aef1b4f3e4d5a29283df27348a84.zip | |
Added graphics functions and a stub for the event handling call.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gem.c | 14 | ||||
| -rw-r--r-- | lib/py_aes.c | 74 | ||||
| -rw-r--r-- | lib/py_aes.h | 6 |
3 files changed, 89 insertions, 5 deletions
@@ -28,6 +28,10 @@ GemMethods[] = { {"form_do", py_form_do, METH_VARARGS, "Processes a dialog"}, {"form_center", py_form_center, METH_VARARGS, "Centers an object"}, + /* AES Graphics Library */ + {"graf_handle", py_graf_handle, METH_NOARGS, "Return a handle to the VDI"}, + {"graf_mouse", py_graf_mouse, METH_VARARGS, "Sets the mouse pointer"}, + /* AES Resource Library */ {"rsrc_load", py_rsrc_load, METH_VARARGS, "Load a resource into memory"}, {"rsrc_gaddr", py_rsrc_gaddr, METH_VARARGS, "Return an encapsulated memory address of a resource component"}, @@ -86,6 +90,10 @@ PROC LibFunc[] = { "py_form_do", "Internal\n", py_form_do, "py_form_center", "Internal\n", py_form_center, + /* AES Graphics Library */ + "py_graf_handle", "Internal\n", py_graf_handle, + "py_graf_mouse", "Internal\n", py_graf_mouse, + /* AES Resource Library */ "py_rsrc_load", "Internal\n", py_rsrc_load, "py_rsrc_gaddr", "Internal\n", py_rsrc_gaddr, @@ -97,11 +105,13 @@ PROC LibFunc[] = { "py_wind_delete", "Internal\n", py_wind_delete, "py_wind_close", "Internal\n", py_wind_close, "py_wind_update", "Internal\n", py_wind_update, - "py_wind_set", "Internal\n", py_wind_set + "py_wind_set", "Internal\n", py_wind_set, + + NULL,NULL,NULL }; LDGLIB LibLdg[] = { - 0x0001, 18, LibFunc, "GEM Extensions for Python", 0 + 0x0001, 20, LibFunc, "GEM Extensions for Python", 0 }; int main( void) diff --git a/lib/py_aes.c b/lib/py_aes.c index 09bf588..702f996 100644 --- a/lib/py_aes.c +++ b/lib/py_aes.c @@ -69,6 +69,7 @@ int ret; } static PyObject* __CDECL py_form_do(PyObject *self, PyObject *args) +{ PyObject *obj; int x; int ret; @@ -81,6 +82,7 @@ int ret; } static PyObject* __CDECL py_form_center(PyObject *self, PyObject *args) +{ PyObject *obj; int x,y,w,h; int ret; @@ -94,6 +96,37 @@ int ret; return Py_None; } +/* --- Graphics Library --- */ +static PyObject* __CDECL py_graf_handle(PyObject *self) +{ +int wchar,hchar,wcell,hcell; +int ret; + + ret = graf_handle(&wchar, &hchar, &wcell, &hcell); + return Py_BuildValue("i(iiii)",ret,wchar,hchar,wcell,hcell); +} + +static PyObject* __CDECL py_graf_mouse(PyObject self, PyObject *args) +{ +int mouse; + + if(!PyArg_ParseTuple(args,"i",&mouse)) + return NULL; + + if(mouse == USER_DEF) { + PyErr_SetString(GEMError,"User-defined mouse pointers not currently supported"); + return NULL; + } + + if(graf_mouse(mouse) == 0) { + PyErr_SetString(GEMError,"Mouse cursor setting failed"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + /* --- Resources Library --- */ static PyObject* __CDECL py_rsrc_load(PyObject *self, PyObject *args) { @@ -331,3 +364,44 @@ PyObject *tple; Py_INCREF(Py_None); return Py_None; } + + +/* --- Event Library --- */ +static PyObject* __CDECL py_evnt_multi(PyObject self, PyObject *args) +{ +/* Because this is possibly the ugliest call ever created in the C + * language, we'll use the same variable names as the docs use. + */ +int ev_mflags, ev_mbclicks, ev_mbmask, ev_mbstate, ev_mm1flags, ev_mm1x, ev_mm1y, ev_mm1width, ev_mm1height, ev_mm2flags; +int ev_mm2x, ev_mm2y, ev_mm2width, ev_mm2height, ev_mmgpbuff, ev_mtlocount, ev_mthicount, ev_mmox, ev_mmoy; +int ev_mmbutton, ev_mmokstate, ev_mkreturn, ev_mbreturn; + + /* More is still needed */ + + ret = evnt_multi(ev_mflags, + ev_mbclicks, + ev_mbmask, + ev_mbstate, + ev_mm1flags, + ev_mm1x, + ev_mm1y, + ev_mm1width, + ev_mm1height, + ev_mm2flags, + ev_mm2x, + ev_mm2y, + ev_mm2width, + ev_mm2height, + &ev_mmgpbuff, + ev_mtlocount, + ev_mthicount, + &ev_mmox, + &ev_mmoy, + &ev_mmbutton, + &ev_mmokstate, + &ev_mkreturn, + &ev_mbreturn); + + +} + diff --git a/lib/py_aes.h b/lib/py_aes.h index 3f2942f..60d0b78 100644 --- a/lib/py_aes.h +++ b/lib/py_aes.h @@ -4,9 +4,7 @@ #include "ldg_Python.h" static PyObject* __CDECL py_appl_init(PyObject *self, PyObject *args); - static PyObject* __CDECL py_appl_exit(PyObject *self, PyObject *args); - static PyObject* __CDECL py_appl_write(PyObject *self, PyObject *args) static PyObject* __CDECL py_form_alert(PyObject *self, PyObject *args); @@ -14,8 +12,10 @@ static PyObject* __CDECL py_form_dial(PyObject *self, PyObject *args); static PyObject* __CDECL py_form_do(PyObject *self, PyObject *args); static PyObject* __CDECL py_form_center(PyObject *self, PyObject *args); +static PyObject* __CDECL py_graf_handle(PyObject self, PyObject *args); +static PyObject* __CDECL py_graf_mouse(PyObject self, PyObject *args); -static void __CDECL py_rsrc_load(PyObject *self, PyObject *args); +static PyObject* __CDECL py_rsrc_load(PyObject *self, PyObject *args); static PyObject* __CDECL py_rsrc_gaddr(PyObject *self, PyObject *args); static PyObject* __CDECL py_wind_create(PyObject *self, PyObject *args) |
