summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLieuwe <lieuwemo@gmail.com>2011-03-05 14:54:47 (GMT)
committer Lieuwe <lieuwemo@gmail.com>2011-03-05 14:54:47 (GMT)
commit6596155c8a6d6e430fb11e98b5efbce4aae863e2 (patch)
treef576e13dd1b3af9e9de98d932e1a5297b7de4989 /src
parent85a2ba9a6e64b738337a500c3eb0c69a9ad6ecfe (diff)
downloadpowder-6596155c8a6d6e430fb11e98b5efbce4aae863e2.zip
powder-6596155c8a6d6e430fb11e98b5efbce4aae863e2.tar.gz
trying to get a putpixel command working but it segfaults atm
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
-rw-r--r--src/python/tpt_console.py6
2 files changed, 16 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 019befa..f23f1ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,8 @@
#include <air.h>
#include <icon.h>
+pixel *vid_buf;
+
#define NUM_SOUNDS 2
struct sample {
Uint8 *data;
@@ -1752,6 +1754,15 @@ emb_get_prop(PyObject *self, PyObject *args)
return Py_BuildValue("i",-1);
}
+emb_draw_pixel(PyObject *self, PyObject *args)
+{
+ int x,y,r,g,b,a;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIIII|I:drawpixel",&x,&y,&r,&g,&b,&a))
+ return NULL;
+ drawpixel(vid_buf,x,y,r,g,b,a);
+}
+
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
{"create", emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
{"log", emb_log, METH_VARARGS, "logs an error string to the console."},
@@ -1777,6 +1788,7 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
{"console_less", emb_console_less, METH_VARARGS, "turns the more indicator off."},
{"get_pmap", emb_get_pmap, METH_VARARGS, "get the pmap value."},
{"get_prop", emb_get_prop, METH_VARARGS, "get some properties."},
+ {"draw_pixel", emb_draw_pixel, METH_VARARGS, "draw a pixel."},
{NULL, NULL, 0, NULL}
};
@@ -1794,9 +1806,9 @@ int main(int argc, char *argv[])
int FPS = 0;
int pastFPS = 0;
int past = 0;
- pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
void *http_ver_check;
void *http_session_check = NULL;
+ pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
char *ver_data=NULL, *check_data=NULL, *tmp;
//char console_error[255] = "";
int i, j, bq, fire_fc=0, do_check=0, do_s_check=0, old_version=0, http_ret=0,http_s_ret=0, major, minor, old_ver_len;
diff --git a/src/python/tpt_console.py b/src/python/tpt_console.py
index a854756..99dbc69 100644
--- a/src/python/tpt_console.py
+++ b/src/python/tpt_console.py
@@ -75,6 +75,7 @@ def _handle(txt):
except Exception as ex:
error(ex)
+#optional step handler:
def step():
try:
a=handle.glob
@@ -86,6 +87,5 @@ def step():
error(ex)
def _step():
- #print "handling '%s'"%txt
- #print "step"
- toggle_pause()
+ #toggle_pause()
+ tpt.draw_pixel(200,200,254,254,254)