Changeset 500 for trunk/processing

Show
Ignore:
Timestamp:
02/18/08 21:29:48 (7 months ago)
Author:
tom
Message:

fixing the image-less processing sketch for posting

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/processing/sketches/modest_maps_interactive/Button.pde

    r495 r500  
    3535    super.draw(); 
    3636    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); 
    3838    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); 
    4040    } 
    4141  } 
     
    5757    switch(dir) { 
    5858      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); 
    6262        break; 
    6363      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); 
    6767        break; 
    6868      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); 
    7272        break; 
    7373      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); 
    7777        break; 
    7878    } 
  • trunk/processing/sketches/modest_maps_interactive/modest_maps_interactive.pde

    r499 r500  
    2020Button[] buttons = { in, out, up, down, left, right }; 
    2121 
     22PFont font; 
     23 
    2224void setup() { 
    2325  size(600, 400); 
     
    3335 
    3436  // set a default font for labels 
    35   PFont font = createFont("Helvetica", 12); 
    36   textFont(font, 12); 
     37  font = createFont("Helvetica", 12); 
    3738 
    3839  // enable the mouse wheel, for zooming 
     
    9697    } 
    9798  } 
     99 
     100  textFont(font, 12); 
    98101 
    99102  // grab the lat/lon location under the mouse point: 
  • trunk/processing/sketches/modest_maps_interactive_test/modest_maps_interactive_test.pde

    r499 r500  
    1414float a = 0.0; 
    1515 
     16PFont f; 
     17 
    1618void setup() { 
    17   size(screen.width/2, screen.height/2, P3D); 
     19  size(500, 300); 
    1820 
    1921  tx = -128; 
    2022  ty = -128; 
    2123   
    22   PFont f = createFont("Helvetica",16); 
    23   textFont(f,16); 
    24   textAlign(LEFT, TOP); 
     24  f = createFont("Helvetica",16); 
    2525} 
    2626 
     
    3232  scale(sc,sc); 
    3333  rotate(radians(a)); 
    34   translate(-width/2, -height/2); 
    3534  translate(tx,ty); 
    3635 
     
    4039  float maxY = screenY(256,256); 
    4140 
    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)); 
    4342   
    4443  // do the diagonal because we might rotate 
     
    5251  int cols = (int)pow(2,zoom); 
    5352  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)); 
    5655 
    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); 
    5958 
    6059  // find the biggest box the screen would fit in, aligned with the map: 
     
    6362  float screenMaxX = width; 
    6463  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)); 
    6665  // TODO align this box! 
    6766   
     
    7170  int minRow = (int)floor(rows * (screenMinY-minY) / (maxY-minY)); 
    7271  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); 
    7473 
    7574  pushMatrix(); 
     
    8281      fill(255); 
    8382      noStroke(); 
     83      textFont(f,16); 
    8484      textAlign(LEFT, TOP); 
    8585      text("c:"+col+" "+"r:"+row+" "+"z:"+zoom, col*256, row*256); 
     
    119119  } 
    120120 
    121   println(); 
     121//  println(); 
    122122   
    123123}