misc stuff
This commit is contained in:
parent
04a9cbcb88
commit
05730797d8
9
Makefile
9
Makefile
@ -14,12 +14,13 @@ WIN32_TARG := powder-sse.exe powder-sse2.exe
|
||||
PYCOMMAND := python2 getheader.py
|
||||
|
||||
powder: $(SOURCES)
|
||||
export PATH="/usr/lib/ccache/bin/:$PATH"
|
||||
$(PYCOMMAND)
|
||||
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
|
||||
mv $@ build
|
||||
powder-debug-64: $(SOURCES)
|
||||
$(PYCOMMAND) --64bit
|
||||
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/
|
||||
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 -DPYEXT $(SOURCES) -Iincludes/
|
||||
mv $@ build
|
||||
powder-debug: $(SOURCES)
|
||||
$(PYCOMMAND)
|
||||
@ -42,17 +43,17 @@ powder-sse: $(SOURCES)
|
||||
mv $@ build
|
||||
powder-64-sse3-opengl: $(SOURCES)
|
||||
$(PYCOMMAND) --64bit
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -DPYEXT -lGL -lGLU -DOpenGL
|
||||
strip $@
|
||||
mv $@ build
|
||||
powder-64-sse3: $(SOURCES)
|
||||
$(PYCOMMAND) --64bit
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -DPYEXT
|
||||
strip $@
|
||||
mv $@ build
|
||||
powder-64-sse2: $(SOURCES)
|
||||
$(PYCOMMAND) --64bit
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64
|
||||
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 -DPYEXT
|
||||
strip $@
|
||||
mv $@ build
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
64
src/main.c
64
src/main.c
@ -1975,6 +1975,62 @@ emb_disable_python(PyObject *self, PyObject *args)
|
||||
return Py_BuildValue("i",1);
|
||||
}
|
||||
|
||||
int bsx = 2, bsy = 2, sl=1, sr=0;
|
||||
static PyObject*
|
||||
emb_get_tool(PyObject *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args, ":get_tool"))
|
||||
return NULL;
|
||||
return Py_BuildValue("((ii)(ii)i)",bsx,bsy,sl,sr,CURRENT_BRUSH);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
emb_set_tool(PyObject *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args, "((ii)(ii)i):set_tool",&bsx,&bsy,&sl,&sr,&CURRENT_BRUSH))
|
||||
return NULL;
|
||||
return Py_BuildValue("i",1);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
emb_press_mouse(PyObject *self, PyObject *args)
|
||||
{
|
||||
int x,y,b;
|
||||
SDL_Event* ev;
|
||||
b=0;
|
||||
if(!PyArg_ParseTuple(args, "ii|i:handle_tool",&x,&y,&b))
|
||||
return NULL;
|
||||
ev.type=SDL_MOUSEBUTTONDOWN;
|
||||
if(b==2)
|
||||
ev.button.button=SDL_BUTTON_RIGHT;
|
||||
else
|
||||
ev.button.button=SDL_BUTTON_LEFT;
|
||||
ev.button.state=SDL_PRESSED;
|
||||
ev.button.x=x;
|
||||
ev.button.y=y;
|
||||
return Py_BuildValue("i",SDL_PushEvent(ev));
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
emb_release_mouse(PyObject *self, PyObject *args)
|
||||
{
|
||||
int x,y,b;
|
||||
SDL_MouseButtonEvent ev;
|
||||
b=0;
|
||||
if(!PyArg_ParseTuple(args, "ii|i:handle_tool",&x,&y,&b))
|
||||
return NULL;
|
||||
ev.type=SDL_MOUSEBUTTONUP;
|
||||
if(b==2)
|
||||
ev.button.button=SDL_BUTTON_RIGHT;
|
||||
else
|
||||
ev.button.button=SDL_BUTTON_LEFT;
|
||||
ev.button.state=SDL_RELEASED;
|
||||
ev.button.x=x;
|
||||
ev.button.y=y;
|
||||
return Py_BuildValue("i",SDL_PushEvent(ev));
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
|
||||
{"create", (PyCFunction)emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
|
||||
{"log", (PyCFunction)emb_log, METH_VARARGS, "logs an error string to the console."},
|
||||
@ -2015,6 +2071,8 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
|
||||
{"set_pressure", (PyCFunction)emb_set_pressure, METH_VARARGS, "set pressure"},
|
||||
{"set_velocity", (PyCFunction)emb_set_velocity, METH_VARARGS, "set velocity"},
|
||||
{"disable_python", (PyCFunction)emb_disable_python, METH_VARARGS, "switch back to the old console."},
|
||||
{"get_tool", (PyCFunction)emb_get_tool, METH_VARARGS, "get tool size/type and selected particles"},
|
||||
{"set_tool", (PyCFunction)emb_set_tool, METH_VARARGS, "set tool size/type and selected particles"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
@ -2042,8 +2100,8 @@ int main(int argc, char *argv[])
|
||||
#ifdef INTERNAL
|
||||
int vs = 0;
|
||||
#endif
|
||||
int x, y, b = 0, sl=1, sr=0, su=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty;
|
||||
int da = 0, db = 0, it = 2047, mx, my, bsx = 2, bsy = 2;
|
||||
int x, y, b = 0, su=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty;
|
||||
int da = 0, db = 0, it = 2047, mx, my;
|
||||
float nfvx, nfvy;
|
||||
int load_mode=0, load_w=0, load_h=0, load_x=0, load_y=0, load_size=0;
|
||||
void *load_data=NULL;
|
||||
@ -3297,7 +3355,7 @@ int main(int argc, char *argv[])
|
||||
lb = 0;
|
||||
}
|
||||
}
|
||||
else if (y<YRES)
|
||||
else if (y<YRES)//mouse handling
|
||||
{
|
||||
int signi;
|
||||
|
||||
|
@ -12,7 +12,10 @@ class logger:
|
||||
def write(self,txt):
|
||||
txt=txt.strip().split("\n")[-1]
|
||||
repr(txt)
|
||||
try:
|
||||
tpt.log(txt)
|
||||
except:#yeah, this happens.
|
||||
pass
|
||||
if(DEBUG==False):
|
||||
sys.stdout=logger()
|
||||
sys.stderr=logger()
|
||||
|
Reference in New Issue
Block a user