Posted by Hexagon class Wed 7th Mar 2007 22:57 - Syntax is None/text - 24 views
Download | New Post | Modify | Hide line numbers
  1. package ftw;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.RenderingHints;
  6. import java.awt.*;
  7.  
  8. public class Hexagon extends Polygon {
  9.     private int id, orientation;
  10.     Hexagon left, right;
  11.     private int hex_x[] = { 31, 0,  0,31 ,63, 63 };
  12.     private int hex_y[] = { 0 ,19, 55,73,55,19 };
  13.     private Point hexPoint;
  14.    
  15.     //x,y top left corner
  16.     //each hex should be x+1,y+1 from right edge
  17.    
  18.     Hexagon(int id, int orientation, int x, int y) {
  19.         id = id;
  20.         orientation = orientation;
  21.     //    hexPoint.x = x;
  22.     //    hexPoint.y = y;
  23.         hexPoint = new Point(x,y);
  24.         this.translate(-31, -37);
  25.         this.addPoint(31,0);
  26.         this.addPoint(0,19);
  27.         this.addPoint(0,55);
  28.         this.addPoint(31,73);
  29.         this.addPoint(63,55);
  30.         this.addPoint(63,19);
  31.        
  32.     }
  33.  
  34.     Hexagon(int id, int x, int y) {
  35.        
  36.     }
  37.  
  38.     /*public void update(Graphics g) {
  39.         paint(g);
  40.     }*/
  41.     public void move(int x, int y) {
  42.         this.translate((x)-31, (y)-37);
  43.         this.
  44.     }
  45.     public Point get_hexPoint() {
  46.         return hexPoint;
  47.     }
  48. }
  49.  

PermaLink to this entry https://pastebin.co.uk/11540
Posted by Hexagon class Wed 7th Mar 2007 22:57 - Syntax is None/text - 24 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0