diff options
| author | Lieuwe <lieuwemo@gmail.com> | 2011-03-05 19:08:41 (GMT) |
|---|---|---|
| committer | Lieuwe <lieuwemo@gmail.com> | 2011-03-05 19:08:41 (GMT) |
| commit | d6d661c4343b135cff5153dc2e63d8d16fea2dcf (patch) | |
| tree | 5d772cd1e93a305fdbf80dae4a52d13be8cb5abc /src/python/tpt_console.py | |
| parent | 20b6a64228061a0b4689fcad439871e38ec88038 (diff) | |
| download | powder-d6d661c4343b135cff5153dc2e63d8d16fea2dcf.zip powder-d6d661c4343b135cff5153dc2e63d8d16fea2dcf.tar.gz | |
keyboard/mouse handling
Diffstat (limited to 'src/python/tpt_console.py')
| -rw-r--r-- | src/python/tpt_console.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/python/tpt_console.py b/src/python/tpt_console.py index eb70363..7adfeb8 100644 --- a/src/python/tpt_console.py +++ b/src/python/tpt_console.py @@ -75,7 +75,17 @@ def _handle(txt): except Exception as ex: error(ex) +#optional key handler: +"""def keypress(key): + try: + _key(key) + except Exception as ex: + error(ex)""" +def _key(key): + print "key %s"%key #optional step handler: + +""" def step(): try: a=handle.glob @@ -84,7 +94,7 @@ def step(): try: _step() except Exception as ex: - error(ex) + error(ex)""" def _step(): try: @@ -94,9 +104,20 @@ def _step(): 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.string_get_width(step.txt)+16 - tpt.draw_fillrect(xx-8,92,w,32,0,0,0,128) + 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 |
