public abstract class GLInterface extends java.lang.Object implements IInterface
IInterface
for OpenGL in Minecraft.Modifier and Type | Field and Description |
---|---|
protected boolean |
clipX
Boolean indicating whether to clip in the horizontal direction.
|
Constructor and Description |
---|
GLInterface(boolean clipX)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
begin(boolean matrix)
Set OpenGL to the state used by the rendering methods.
|
void |
drawImage(java.awt.Rectangle r,
int rotation,
boolean parity,
int image,
java.awt.Color color)
Draw an image.
|
void |
drawLine(java.awt.Point a,
java.awt.Point b,
java.awt.Color c1,
java.awt.Color c2)
Draw a line on the screen.
|
void |
drawRect(java.awt.Rectangle r,
java.awt.Color c1,
java.awt.Color c2,
java.awt.Color c3,
java.awt.Color c4)
Draw the outline of an axis-aligned rectangle on the screen.
|
void |
drawString(java.awt.Point pos,
int height,
java.lang.String s,
java.awt.Color c)
Draw a string on the screen.
|
void |
end(boolean matrix)
Restore OpenGL to the state expected by Minecraft.
|
void |
fillRect(java.awt.Rectangle r,
java.awt.Color c1,
java.awt.Color c2,
java.awt.Color c3,
java.awt.Color c4)
Draw an axis-aligned rectangle on the screen.
|
void |
fillTriangle(java.awt.Point pos1,
java.awt.Point pos2,
java.awt.Point pos3,
java.awt.Color c1,
java.awt.Color c2,
java.awt.Color c3)
Draw a triangle on the screen.
|
int |
getFontWidth(int height,
java.lang.String s)
Get the font width of a string being rendered by
IInterface.drawString(Point, int, String, Color) |
boolean |
getModifier(int modifier)
Method to query a keyboard modifier.
|
protected abstract java.lang.String |
getResourcePrefix()
Get the Minecraft resource location string.
|
protected double |
getScreenHeight()
Get the current screen height.
|
protected double |
getScreenWidth()
Get the current screen width.
|
java.awt.Dimension |
getWindowSize()
Get size of display.
|
protected abstract float |
getZLevel()
Get the z-coordinate to render everything.
|
java.awt.Point |
guiToScreen(java.awt.Point p)
Utility function to convert PanelStudio GUI coordinates to screen pixel coordinates.
|
int |
loadImage(java.lang.String name)
Load an image into memory and return a number that may be used to draw that image.
|
void |
restore()
Restore the clipping to the previous state.
|
protected void |
scissor(java.awt.Rectangle r)
Utility function to set clipping rectangle.
|
java.awt.Point |
screenToGui(java.awt.Point p)
Utility function to convert screen pixel coordinates to PanelStudio GUI coordinates.
|
void |
window(java.awt.Rectangle r)
Clip all rendering on screen outside the intersection of the specified rectangle and the current clipping rectangle.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
drawImage, getButton, getMouse, getTime
protected boolean clipX
public GLInterface(boolean clipX)
clipX
- whether to clip in the horizontal directionpublic boolean getModifier(int modifier)
IInterface
getModifier
in interface IInterface
modifier
- the ID of the modifierIInterface.SHIFT
,
IInterface.CTRL
,
IInterface.ALT
,
IInterface.SUPER
public java.awt.Dimension getWindowSize()
IInterface
getWindowSize
in interface IInterface
public void drawString(java.awt.Point pos, int height, java.lang.String s, java.awt.Color c)
IInterface
drawString
in interface IInterface
pos
- the position of the string on the screenheight
- the height of the fonts
- the string to be displayedc
- the color of the string to be displayedpublic int getFontWidth(int height, java.lang.String s)
IInterface
IInterface.drawString(Point, int, String, Color)
getFontWidth
in interface IInterface
height
- the height of the strings
- the string to be consideredpublic void fillTriangle(java.awt.Point pos1, java.awt.Point pos2, java.awt.Point pos3, java.awt.Color c1, java.awt.Color c2, java.awt.Color c3)
IInterface
fillTriangle
in interface IInterface
pos1
- the first corner of the trianglepos2
- the second corner of the trianglepos3
- the third corner of the trianglec1
- the color at the first cornerc2
- the color at the second cornerc3
- the color at the third cornerpublic void drawLine(java.awt.Point a, java.awt.Point b, java.awt.Color c1, java.awt.Color c2)
IInterface
drawLine
in interface IInterface
a
- the start of the lineb
- the end of the linec1
- the color at the start of the linec2
- the color at the end of the linepublic void fillRect(java.awt.Rectangle r, java.awt.Color c1, java.awt.Color c2, java.awt.Color c3, java.awt.Color c4)
IInterface
fillRect
in interface IInterface
r
- the rectangle to be renderedc1
- the color at the top-left corner of the rectanglec2
- the color at the top-right corner of the rectanglec3
- the color at the bottom-right corner of the rectanglec4
- the color at the bottom-left corner of the rectanglepublic void drawRect(java.awt.Rectangle r, java.awt.Color c1, java.awt.Color c2, java.awt.Color c3, java.awt.Color c4)
IInterface
drawRect
in interface IInterface
r
- the rectangle to be renderedc1
- the color at the top-left corner of the rectanglec2
- the color at the top-right corner of the rectanglec3
- the color at the bottom-right corner of the rectanglec4
- the color at the bottom-left corner of the rectanglepublic int loadImage(java.lang.String name)
IInterface
loadImage
in interface IInterface
name
- a string indicating the location of the image to be loadedIInterface.drawImage(Rectangle, int, boolean, int)
,
IInterface.drawImage(Rectangle, int, boolean, int, Color)
public void drawImage(java.awt.Rectangle r, int rotation, boolean parity, int image, java.awt.Color color)
IInterface
drawImage
in interface IInterface
r
- the rectangle specifying the position of the imagerotation
- the rotation of the image in units of 90 degrees counter-clockwiseparity
- if true, will flip the image around the vertical axisimage
- the number identifying the imagecolor
- the color to modulate the image byIInterface.loadImage(String)
protected void scissor(java.awt.Rectangle r)
r
- the clipping rectanglepublic void window(java.awt.Rectangle r)
IInterface
IInterface.restore()
after rendering.window
in interface IInterface
r
- the clipping rectangleIInterface.restore()
public void restore()
IInterface
restore
in interface IInterface
IInterface.window(Rectangle)
public java.awt.Point screenToGui(java.awt.Point p)
p
- the screen coordinatespublic java.awt.Point guiToScreen(java.awt.Point p)
p
- the GUI coordinatesprotected double getScreenWidth()
protected double getScreenHeight()
public void begin(boolean matrix)
matrix
- whether to set up the modelview matrixpublic void end(boolean matrix)
matrix
- whether to restore the modelview matrixprotected abstract float getZLevel()
protected abstract java.lang.String getResourcePrefix()