summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLieuwe <lieuwemo@gmail.com>2011-03-05 16:09:37 (GMT)
committer Lieuwe <lieuwemo@gmail.com>2011-03-05 16:09:37 (GMT)
commit5cb538f08105d110a6dca6a7add9e10add20f978 (patch)
treeeac226423b6657ea02c62ea8291ab3c1c8a17a87 /src
parent5a697b500ff5e960e7fea30a0859f9edabeceeb2 (diff)
downloadpowder-5cb538f08105d110a6dca6a7add9e10add20f978.zip
powder-5cb538f08105d110a6dca6a7add9e10add20f978.tar.gz
got draw_pixel and draw_text to work
Diffstat (limited to 'src')
-rw-r--r--src/main.c28
-rw-r--r--src/python/tpt_console.py7
2 files changed, 32 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index f23f1ab..eaa8674 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1760,7 +1760,30 @@ emb_draw_pixel(PyObject *self, PyObject *args)
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);
+
+ if(vid_buf!=NULL)
+ {
+ drawpixel(vid_buf,x,y,r,g,b,a);
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
+
+}
+
+//drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
+emb_draw_text(PyObject *self, PyObject *args)
+{
+ int x,y,r,g,b,a;
+ char *txt;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIsIII|I:drawpixel",&x,&y,&txt,&r,&g,&b,&a))
+ return NULL;
+ if(vid_buf!=NULL)
+ {
+ drawtext(vid_buf,x,y,txt,r,g,b,a);
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
}
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
@@ -1789,6 +1812,7 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
{"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."},
+ {"draw_text", emb_draw_text, METH_VARARGS, "draw some text."},
{NULL, NULL, 0, NULL}
};
@@ -1808,7 +1832,7 @@ int main(int argc, char *argv[])
int past = 0;
void *http_ver_check;
void *http_session_check = NULL;
- pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
+ 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 99dbc69..dfe34b7 100644
--- a/src/python/tpt_console.py
+++ b/src/python/tpt_console.py
@@ -87,5 +87,10 @@ def step():
error(ex)
def _step():
+ try:
+ a=step.i
+ except:
+ step.i=0
#toggle_pause()
- tpt.draw_pixel(200,200,254,254,254)
+ tpt.draw_text(step.i%100+100,100,"FUCK YEAH!",255,255,255)
+ step.i+=1