* ----------------------- * | top | * ----------------------- * | | | | * |left| center |right| * | | | | * ----------------------- * | bottom | * ----------------------- *
* this method is called when JavaFX application is started and it is running on JavaFX thread. this method must at * least create {@link Scene} and finish customizing {@link Stage}. these two objects must be on JavaFX thread when * created. *
* {@link Stage} represents the frame of your application, such as minimize, maximize and close buttons. * {@link Scene} represents the holder of all your JavaFX {@link Node}s. * {@link Node} is the super class of every javaFX class. *
* Sprite represents what to be drawn during the canvas drawing stage. this class holds information such as * {@link Sprite#fill}, {@link Sprite#stroke} and {@link Sprite#strokeWidth}. this class is abstract, meaning * it must be inherited and draw method overridden. * fill and stroke values in this class are of type {@link Paint}. this allows the user to set any color to the sprite * or using the {@link ImagePattern} class choose an image asset and set it as filling. *
sprite = new Sprite(){ { setFill( new ImagePattern( new Image( "file:assets/concrete/dsc_1621.png"))); } public void draw( GraphicsContext gc){ gc.setLineWidth( getWidth()); if( getStroke() != null){ gc.setStroke( getStroke()); gc.strokePolygon( points[0], points[1], pointCount); } if( getFill() != null){ gc.setFill( getFill()); gc.fillPolygon( points[0], points[1], pointCount); } } }; *
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here