got draw_pixel and draw_text to work

This commit is contained in:
Lieuwe 2011-03-05 17:09:37 +01:00
parent 5a697b500f
commit 5cb538f081
3 changed files with 33 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -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;

View File

@ -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