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



package ftw;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.*;

public class Hexagon {
    int id, orientation, x, y;
    Hexagon left, right;
    int hex_x[] = { 31, 00,31 ,63, 63 };
    int hex_y[] = { 0 ,19, 55,73,55,19 };
    Polygon thisHex = new Polygon();
   
    //x,y top left corner
    //each hex should be x+1,y+1 from right edge
   
    Hexagon(int id, int orientation, int x, int y) {
        id = id;
        orientation = orientation;
        x=x;
        y=y;
        thisHex.addPoint(31,0);
        thisHex.addPoint(0,19);
        thisHex.addPoint(0,55);
        thisHex.addPoint(31,73);
        thisHex.addPoint(63,55);
        thisHex.addPoint(63,19);
    }
    /*protected void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                   RenderingHints.VALUE_ANTIALIAS_ON);
    //    g.translate(x, y);
        g.setColor(Color.black);
        g.fillPolygon(thisHex);
    }*/

    Hexagon(int id, int x, int y) {
       
    }

    /*public void update(Graphics g) {
        paint(g);
    }*/

    public Polygon ret_Poly() {
        return thisHex;
    }
}
 

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

 

Comments: 0