public class ScriptableRenderer
extends java.lang.Object
Constructor and Description |
---|
ScriptableRenderer(cubex2.cs2core.Mod mod) |
Modifier and Type | Method and Description |
---|---|
void |
drawColoredRect(int x,
int y,
int width,
int height,
long color)
Draws a colored rectangle on the screen.
|
void |
drawString(java.lang.String text,
int x,
int y,
int color)
Draws a string on the screen.
|
void |
drawTexturedRect(int x,
int y,
int u,
int v,
int width,
int height)
Draws a rectangle from the texture set with setTexture to the screen.
|
int |
getStringWidth(java.lang.String text)
Gets the width of a string in pixels.
|
void |
setTexture(java.lang.String texture)
Sets the texture file that is used by drawTexturedRect.
|
public void setTexture(java.lang.String texture)
texture
- The path of the texture file. If it starts with a '/', the path is relative to the minecraft.jar and thus to any minecraft
mod's .zip or .jar file. If it doesn't start with a '/', the path is relative to the mod's textures/guis directory. The
texture file has to be a 256x256 .png file (or 512x512 for 32x32 texture packs).public void drawTexturedRect(int x, int y, int u, int v, int width, int height)
x
- The x-coordinate on the screen.y
- The y-coordinate on the screen.u
- The x-coordinate on the texture file. This is always between 0 and 255 (including both) no matter whether the texture file
is 256x256 or 512x512.v
- The y-coordinate on the texture file. This is always between 0 and 255 (including both) no matter whether the texture file
is 256x256 or 512x512.width
- The width of the rectangle.height
- The height of the rectangle.public void drawColoredRect(int x, int y, int width, int height, long color)
x
- The x-coordinate on the screen.y
- The y-coordinate on the screen.width
- The width of the rectangle.height
- The height of the rectangle.color
- The color of the rectangle in the form of 0xaarrggbb.public void drawString(java.lang.String text, int x, int y, int color)
text
- The text to draw.x
- The x-coordinate on the screen.y
- The y-coordinate on the screen.color
- The color of the string in the form of 0xrrggbb.public int getStringWidth(java.lang.String text)
text
- The text to measure.