Package HAL.Gui
Class OpenGL2DWindow
- java.lang.Object
-
- HAL.Gui.OpenGL2DWindow
-
-
Constructor Summary
Constructors Constructor Description OpenGL2DWindow(int xPix, int yPix, int xDim, int yDim)
the below constructors are variants of the above constructor with default values for some of the argumentsOpenGL2DWindow(int xPix, int yPix, int xDim, int yDim, boolean active)
OpenGL2DWindow(java.lang.String title, int xPix, int yPix, int xDim, int yDim)
OpenGL2DWindow(java.lang.String title, int xPix, int yPix, int xDim, int yDim, boolean active)
creates a new OpenGL2DWindow
-
Method Summary
Modifier and Type Method Description void
Circle(double x, double y, double rad, int color)
draws a circle centered around x,y, subsequent circles will be drawn over topvoid
Circle(double x, double y, double rad, ColorIntGenerator ColorGen)
draws a circle centered around x,y, subsequent circles will be drawn over top, the ColorGen function is used to generate the color of the circle and will not be called if the Gui is not activevoid
Clear(int clearColor)
usually called before any other draw commands, sets the screen to a color.void
Close()
closes the guivoid
FanShape(float centerX, float centerY, float scale, float[] points, int color)
draws a fan shape around the center x and y, using the array of points to define the edges of the fan.void
FanShape(float centerX, float centerY, float scale, float[] points, ColorIntGenerator ColorGen)
draws a fan shape around the center x and y, using the array of points to define the edges of the fan.boolean
IsActive()
returns whether the Gui is active (whether it exists)boolean
IsClosed()
returns true if the close button has been clicked in the Guiboolean
IsWrapX()
boolean
IsWrapY()
int
Length()
void
Line(double x1, double y1, double x2, double y2, int color)
draws a line between (x1,y1) and (x2,y2)void
LineStrip(double[] xs, double[] ys, int color)
draws a series of lines between all x,y pairsvoid
LineStrip(double[] coords, int color)
draws a series of lines between all x,y pairs, coords should store pairs as x,y,x,y...void
Rectangle(double x1, double y1, double x2, double y2, int color)
draws a rectangle between (x1,y1) and (x2,y2) coded by Jill Gallahervoid
RectangleAtPoint(double x, double y, double width, double height, int color)
draws a rectangle centered at position x,yvoid
SetPix(int i, int color)
duplicates UIGrid functionality, draws a rectangle large enough to fill one lattice positionvoid
SetPix(int x, int y, int color)
duplicates UIGrid functionality, draws a rectangle large enough to fill one lattice positionvoid
Square(double x, double y, double rad, int color)
void
TickPause(int millis)
call this once per step of your model, and the function will ensure that your model runs at the rate provided in millis.void
ToGIF(java.lang.String path)
saves the current state image to a GIF image, call Update firstvoid
ToJPG(java.lang.String path)
saves the current state image to a JPG, call Update firstvoid
ToPNG(java.lang.String path)
saves the current state image to a PNG, call Update firstvoid
Update()
renders all draw commands to the windowint
Xdim()
int
Ydim()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface HAL.Interfaces.Grid2D
AlongLineIs, ApplyHood, ApplyHood, ApplyHoodMapped, ApplyRectangle, BoundaryIs, ContainsValidI, ContainsValidI, DispX, DispY, Dist, DistSquared, GetHoodI, I, I, In, In, InWrap, ItoX, ItoY, MapHood, MapHood, MapHood, MapHood, MapI, MapXpt, MapXsq, MapYpt, MapYsq, RandomHoodI, WrapI
-
-
-
-
Constructor Detail
-
OpenGL2DWindow
public OpenGL2DWindow(java.lang.String title, int xPix, int yPix, int xDim, int yDim, boolean active)
creates a new OpenGL2DWindow- Parameters:
title
- the title that will appear at the top of the window (default "")xPix
- the length of the window in screen pixelsyPix
- the height of the window in screen pixelsxDim
- the length that the window will represent for drawing, should match the xDim of the modelyDim
- the height that the window will represent for drawing, should match the yDim of the modelactive
- if set to false, the OpenGL2DWindow will not actually render and its methods will be skipped (default true)
-
OpenGL2DWindow
public OpenGL2DWindow(int xPix, int yPix, int xDim, int yDim)
the below constructors are variants of the above constructor with default values for some of the arguments
-
OpenGL2DWindow
public OpenGL2DWindow(int xPix, int yPix, int xDim, int yDim, boolean active)
-
OpenGL2DWindow
public OpenGL2DWindow(java.lang.String title, int xPix, int yPix, int xDim, int yDim)
-
-
Method Detail
-
TickPause
public void TickPause(int millis)
call this once per step of your model, and the function will ensure that your model runs at the rate provided in millis. the function will take the amount time between calls into account to ensure a consistent tick rate.
-
Clear
public void Clear(int clearColor)
usually called before any other draw commands, sets the screen to a color.
-
Update
public void Update()
renders all draw commands to the window
-
IsClosed
public boolean IsClosed()
returns true if the close button has been clicked in the Gui
-
Close
public void Close()
closes the gui
-
IsActive
public boolean IsActive()
returns whether the Gui is active (whether it exists)
-
SetPix
public void SetPix(int i, int color)
duplicates UIGrid functionality, draws a rectangle large enough to fill one lattice position
-
SetPix
public void SetPix(int x, int y, int color)
duplicates UIGrid functionality, draws a rectangle large enough to fill one lattice position
-
Rectangle
public void Rectangle(double x1, double y1, double x2, double y2, int color)
draws a rectangle between (x1,y1) and (x2,y2) coded by Jill Gallaher
-
RectangleAtPoint
public void RectangleAtPoint(double x, double y, double width, double height, int color)
draws a rectangle centered at position x,y
-
Square
public void Square(double x, double y, double rad, int color)
-
Circle
public void Circle(double x, double y, double rad, int color)
draws a circle centered around x,y, subsequent circles will be drawn over top
-
Circle
public void Circle(double x, double y, double rad, ColorIntGenerator ColorGen)
draws a circle centered around x,y, subsequent circles will be drawn over top, the ColorGen function is used to generate the color of the circle and will not be called if the Gui is not active
-
FanShape
public void FanShape(float centerX, float centerY, float scale, float[] points, ColorIntGenerator ColorGen)
draws a fan shape around the center x and y, using the array of points to define the edges of the fan. used as part of the circle function
-
FanShape
public void FanShape(float centerX, float centerY, float scale, float[] points, int color)
draws a fan shape around the center x and y, using the array of points to define the edges of the fan. used as part of the circle function
-
Line
public void Line(double x1, double y1, double x2, double y2, int color)
draws a line between (x1,y1) and (x2,y2)
-
LineStrip
public void LineStrip(double[] xs, double[] ys, int color)
draws a series of lines between all x,y pairs
-
LineStrip
public void LineStrip(double[] coords, int color)
draws a series of lines between all x,y pairs, coords should store pairs as x,y,x,y...
-
ToPNG
public void ToPNG(java.lang.String path)
saves the current state image to a PNG, call Update first
-
ToJPG
public void ToJPG(java.lang.String path)
saves the current state image to a JPG, call Update first
-
ToGIF
public void ToGIF(java.lang.String path)
saves the current state image to a GIF image, call Update first
-
-