Copyright (c) Nikolaj Baer
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. ...
If you think the Android project android-jplay listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.nikolajbaer.awtrender;
/*fromwww.java2s.com*/import com.nikolajbaer.render.RenderObject;
import com.nikolajbaer.render.Renderable;
import java.awt.*;
import java.awt.geom.*;
publicclass PolygonRenderObject extends AWTRenderObject {
protectedint[] x_pts;
protectedint[] y_pts;
protected Color m_color;
// TODO make this create from a key
public PolygonRenderObject(){
x_pts=newint[]{0,20,20,0};
y_pts=newint[]{0,0,20,20};
m_color=Color.gray;
}
publicvoid renderFromWorld(float x,float y,float a){
m_graphics.setColor(m_color);
m_graphics.translate(x*m_pixelsPerMeter,y*m_pixelsPerMeter);
m_graphics.rotate(a);
m_graphics.fillPolygon(x_pts,y_pts,x_pts.length);
}
}