diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-05-04 17:59:13 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-05-04 17:59:13 +0100 |
| commit | b5914dd492fa4716737bbe43f4abcad5258b6396 (patch) | |
| tree | d1d8ac3dac05fb7e99c6d7e08c955f105ab587a2 /tomorrowthegroundGUI/tomorrowthegroundGUI.pde | |
| parent | 3209f698306ab0cf22ef0fe31a722bad22214691 (diff) | |
working with image maps
Diffstat (limited to 'tomorrowthegroundGUI/tomorrowthegroundGUI.pde')
| -rw-r--r-- | tomorrowthegroundGUI/tomorrowthegroundGUI.pde | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tomorrowthegroundGUI/tomorrowthegroundGUI.pde b/tomorrowthegroundGUI/tomorrowthegroundGUI.pde index 0fe919e..b359409 100644 --- a/tomorrowthegroundGUI/tomorrowthegroundGUI.pde +++ b/tomorrowthegroundGUI/tomorrowthegroundGUI.pde @@ -1,15 +1,19 @@ import hypermedia.net.*; -PImage bgmap; +PImage[] bgmaps; +int usemap; UDP udp; int x,y; float lat1,lng1,lat2,lng2,fw,fh; void setup() { - bgmap = loadImage("gentmap.png"); + bgmaps=new PImage[2]; + bgmaps[0] = loadImage("gentmap.png"); + bgmaps[1] = loadImage("indexmapV1.gif"); + usemap=0; size(bgmap.width,bgmap.height); - frameRate(30); + frameRate(15); udp = new UDP(this); x=width/2; y=height/2; @@ -23,7 +27,7 @@ void setup() void draw() { - background(bgmap); + background(bgmaps[usemap]); fill(255); stroke(255,0,0); ellipse(x,y,5,5); @@ -39,3 +43,15 @@ void mouseDragged() udp.send(((fy*fh)+lat2)+","+((fx*fw)+lng1)+"\n","127.0.0.1",5400); } } + +void keyPressed() { + switch(key) { + case '0': + usemap=0; + break; + case '1': + usemap=1; + break; + } +} + |
