Posted by asd Wed 7th Mar 2007 20:51 - Syntax is Java 5 - 33 views
Download | New Post | Modify | Hide line numbers
Description:



  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 {
  9.     int id, orientation, x, y;
  10.     Hexagon left, right;
  11.     int hex_x[] = { 31, 00,31 ,63, 63 };
  12.     int hex_y[] = { 0 ,19, 55,73,55,19 };
  13.     Polygon thisHex = new Polygon();
  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.         x=x;
  22.         y=y;
  23.         thisHex.addPoint(31,0);
  24.         thisHex.addPoint(0,19);
  25.         thisHex.addPoint(0,55);
  26.         thisHex.addPoint(31,73);
  27.         thisHex.addPoint(63,55);
  28.         thisHex.addPoint(63,19);
  29.     }
  30.     /*protected void paint(Graphics g) {
  31.         Graphics2D g2 = (Graphics2D) g;
  32.         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
  33.                    RenderingHints.VALUE_ANTIALIAS_ON);
  34.     //    g.translate(x, y);
  35.         g.setColor(Color.black);
  36.         g.fillPolygon(thisHex);
  37.     }*/
  38.     Hexagon(int id, int x, int y) {
  39.        
  40.     }
  41.  
  42.     /*public void update(Graphics g) {
  43.         paint(g);
  44.     }*/
  45.     public Polygon ret_Poly() {
  46.         return thisHex;
  47.     }
  48. }
  49.  

PermaLink to this entry https://pastebin.co.uk/11535
Posted by asd Wed 7th Mar 2007 20:51 - Syntax is Java 5 - 33 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0