Changeset 500 for trunk/processing/sketches
- Timestamp:
- 02/18/08 21:29:48 (9 months ago)
- Files:
-
- trunk/processing/sketches/modest_maps_interactive/Button.pde (modified) (2 diffs)
- trunk/processing/sketches/modest_maps_interactive/modest_maps_interactive.pde (modified) (3 diffs)
- trunk/processing/sketches/modest_maps_interactive_test/code (deleted)
- trunk/processing/sketches/modest_maps_interactive_test/modest_maps_interactive_test.pde (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/processing/sketches/modest_maps_interactive/Button.pde
r495 r500 35 35 super.draw(); 36 36 stroke(0); 37 line(x+ 2,y+h/2,x+w-2,y+h/2);37 line(x+3,y+h/2,x+w-3,y+h/2); 38 38 if (in) { 39 line(x+w/2,y+ 2,x+w/2,y+h-2);39 line(x+w/2,y+3,x+w/2,y+h-3); 40 40 } 41 41 } … … 57 57 switch(dir) { 58 58 case UP: 59 line(x+w/2,y+ 2,x+w/2,y+h-2);60 line(x- 2+w/2,y+4,x+w/2,y+2);61 line(x+ 2+w/2,y+4,x+w/2,y+2);59 line(x+w/2,y+3,x+w/2,y+h-3); 60 line(x-3+w/2,y+6,x+w/2,y+3); 61 line(x+3+w/2,y+6,x+w/2,y+3); 62 62 break; 63 63 case DOWN: 64 line(x+w/2,y+ 2,x+w/2,y+h-2);65 line(x- 2+w/2,y+h-4,x+w/2,y+h-2);66 line(x+ 2+w/2,y+h-4,x+w/2,y+h-2);64 line(x+w/2,y+3,x+w/2,y+h-3); 65 line(x-3+w/2,y+h-6,x+w/2,y+h-3); 66 line(x+3+w/2,y+h-6,x+w/2,y+h-3); 67 67 break; 68 68 case LEFT: 69 line(x+ 2,y+h/2,x+w-2,y+h/2);70 line(x+ 2,y+h/2,x+4,y-2+h/2);71 line(x+ 2,y+h/2,x+4,y+2+h/2);69 line(x+3,y+h/2,x+w-3,y+h/2); 70 line(x+3,y+h/2,x+6,y-3+h/2); 71 line(x+3,y+h/2,x+6,y+3+h/2); 72 72 break; 73 73 case RIGHT: 74 line(x+ 2,y+h/2,x+w-2,y+h/2);75 line(x+w- 2,y+h/2,x+w-4,y-2+h/2);76 line(x+w- 2,y+h/2,x+w-4,y+2+h/2);74 line(x+3,y+h/2,x+w-3,y+h/2); 75 line(x+w-3,y+h/2,x+w-6,y-3+h/2); 76 line(x+w-3,y+h/2,x+w-6,y+3+h/2); 77 77 break; 78 78 } trunk/processing/sketches/modest_maps_interactive/modest_maps_interactive.pde
r499 r500 20 20 Button[] buttons = { in, out, up, down, left, right }; 21 21 22 PFont font; 23 22 24 void setup() { 23 25 size(600, 400); … … 33 35 34 36 // set a default font for labels 35 PFont font = createFont("Helvetica", 12); 36 textFont(font, 12); 37 font = createFont("Helvetica", 12); 37 38 38 39 // enable the mouse wheel, for zooming … … 96 97 } 97 98 } 99 100 textFont(font, 12); 98 101 99 102 // grab the lat/lon location under the mouse point: trunk/processing/sketches/modest_maps_interactive_test/modest_maps_interactive_test.pde
r499 r500 14 14 float a = 0.0; 15 15 16 PFont f; 17 16 18 void setup() { 17 size( screen.width/2, screen.height/2, P3D);19 size(500, 300); 18 20 19 21 tx = -128; 20 22 ty = -128; 21 23 22 PFont f = createFont("Helvetica",16); 23 textFont(f,16); 24 textAlign(LEFT, TOP); 24 f = createFont("Helvetica",16); 25 25 } 26 26 … … 32 32 scale(sc,sc); 33 33 rotate(radians(a)); 34 translate(-width/2, -height/2);35 34 translate(tx,ty); 36 35 … … 40 39 float maxY = screenY(256,256); 41 40 42 println("map: " + nf(minX,1,3) + " " + nf(minY,1,3) + " : " + nf(maxX,1,3) + " " + nf(maxY,1,3));41 // println("map: " + nf(minX,1,3) + " " + nf(minY,1,3) + " : " + nf(maxX,1,3) + " " + nf(maxY,1,3)); 43 42 44 43 // do the diagonal because we might rotate … … 52 51 int cols = (int)pow(2,zoom); 53 52 int rows = (int)pow(2,zoom); 54 println("rows/cols: " + rows + "/" + cols);55 println("tileCount: " + (rows * cols));53 // println("rows/cols: " + rows + "/" + cols); 54 // println("tileCount: " + (rows * cols)); 56 55 57 int screenCols = (int)ceil(cols * dist(0,0,width,height) / sideLength);58 println("screenCols: " + screenCols);56 // int screenCols = (int)ceil(cols * dist(0,0,width,height) / sideLength); 57 // println("screenCols: " + screenCols); 59 58 60 59 // find the biggest box the screen would fit in, aligned with the map: … … 63 62 float screenMaxX = width; 64 63 float screenMaxY = height; 65 println("screen: " + nf(screenMinX,1,3) + " " + nf(screenMinY,1,3) + " : " + nf(screenMaxX,1,3) + " " + nf(screenMaxY,1,3));64 // println("screen: " + nf(screenMinX,1,3) + " " + nf(screenMinY,1,3) + " : " + nf(screenMaxX,1,3) + " " + nf(screenMaxY,1,3)); 66 65 // TODO align this box! 67 66 … … 71 70 int minRow = (int)floor(rows * (screenMinY-minY) / (maxY-minY)); 72 71 int maxRow = (int)ceil(rows * (screenMaxY-minY) / (maxY-minY)); 73 println("row/col: " + minCol + ", " + minRow + " : " + maxCol + ", " + maxRow);72 // println("row/col: " + minCol + ", " + minRow + " : " + maxCol + ", " + maxRow); 74 73 75 74 pushMatrix(); … … 82 81 fill(255); 83 82 noStroke(); 83 textFont(f,16); 84 84 textAlign(LEFT, TOP); 85 85 text("c:"+col+" "+"r:"+row+" "+"z:"+zoom, col*256, row*256); … … 119 119 } 120 120 121 println();121 // println(); 122 122 123 123 }
