From b5914dd492fa4716737bbe43f4abcad5258b6396 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 4 May 2012 17:59:13 +0100 Subject: working with image maps --- tomorrowthegroundGUI/tomorrowthegroundGUI.pde | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tomorrowthegroundGUI/tomorrowthegroundGUI.pde') 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; + } +} + -- cgit v1.2.3