summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLieuwe <lieuwemo@gmail.com>2011-03-05 20:41:11 (GMT)
committer Lieuwe <lieuwemo@gmail.com>2011-03-05 20:41:11 (GMT)
commit11a7be5c680efff83c7cd6023bbf219702f5d05a (patch)
treeed169b5407461cd4586d0ac80c4c135667384aea /src
parentd6d661c4343b135cff5153dc2e63d8d16fea2dcf (diff)
downloadpowder-11a7be5c680efff83c7cd6023bbf219702f5d05a.zip
powder-11a7be5c680efff83c7cd6023bbf219702f5d05a.tar.gz
added irc client extension, it only listens for now.
Diffstat (limited to 'src')
-rw-r--r--src/main.c8
-rw-r--r--src/python/tpt_console.py52
2 files changed, 16 insertions, 44 deletions
diff --git a/src/main.c b/src/main.c
index decb44c..0187aa2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1855,10 +1855,10 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
{"set_vy", emb_set_vy, METH_VARARGS|METH_KEYWORDS, "sets vy of a specified particle."},
{"pause", emb_pause, METH_VARARGS, "pause the game."},
{"unpause", emb_unpause, METH_VARARGS, "unpause the game."},
- {"toggle_pause", emb_toggle_pause, METH_VARARGS, "toggle game pause."},
- {"open_console", emb_open_console, METH_VARARGS, "open the game console."},
- {"close_console", emb_close_console, METH_VARARGS, "close the game console."},
- {"toggle_console", emb_toggle_console, METH_VARARGS, "toggle the game console."},
+ {"pause_toggle", emb_toggle_pause, METH_VARARGS, "toggle game pause."},
+ {"console_open", emb_open_console, METH_VARARGS, "open the game console."},
+ {"console_close", emb_close_console, METH_VARARGS, "close the game console."},
+ {"console_toggle", emb_toggle_console, METH_VARARGS, "toggle the game console."},
{"console_more", emb_console_more, METH_VARARGS, "turns the more indicator on."},
{"console_less", emb_console_less, METH_VARARGS, "turns the more indicator off."},
{"get_pmap", emb_get_pmap, METH_VARARGS, "get the pmap value."},
diff --git a/src/python/tpt_console.py b/src/python/tpt_console.py
index 7adfeb8..620307b 100644
--- a/src/python/tpt_console.py
+++ b/src/python/tpt_console.py
@@ -75,49 +75,21 @@ def _handle(txt):
except Exception as ex:
error(ex)
-#optional key handler:
-"""def keypress(key):
+
+_extensions=[]
+def loadext(fname):
+ _extensions.append(__import__(fname))
+
+def keypress(key):
try:
- _key(key)
+ for item in _extensions:
+ item.key(key)
except Exception as ex:
- error(ex)"""
-def _key(key):
- print "key %s"%key
-#optional step handler:
+ error(ex)
-"""
def step():
try:
- a=handle.glob
- except:
- clean()
- try:
- _step()
+ for item in _extensions:
+ item.step()
except Exception as ex:
- error(ex)"""
-
-def _step():
- try:
- a=step.i
- a=step.txt
- except:
- step.i=0
- step.txt="!FUCK YEAH!"
- #toggle_pause()
- mouse=tpt.get_mouse()
- step.txt=repr(mouse)
- xx=50+abs(25-(step.i%50))
- w=tpt.get_width(step.txt)+16
- r=0
- g=0
- b=0
- if(mouse[0]>xx-8 and mouse[0]<xx+w-8 and mouse[1]>92 and mouse[1]<92+32):
- r=255
- if(mouse[2][0]):
- g=255
- if(mouse[2][2]):
- b=255
- tpt.draw_fillrect(xx-8,92,w,32,r,g,b,128)
- tpt.draw_rect(xx-8,92,w,32,255,255,255)
- tpt.draw_text(xx,100,step.txt,255,255,255)
- step.i+=1
+ error(ex)