-
Notifications
You must be signed in to change notification settings - Fork 0
Ridhvl2 Cheatsheet
An explanation of all methods available in HvlStatics. This page is designed to serve as a reference so users can get the most out of Ridhvl2. Learn how to configure static imports on this page.
Fetches an instance of HvlPolygon
that corresponds to a right-angled quadrilateral (rectangle). In this case, the origin of the quad is centered in the upper-left corner (specified by arguments x
and y
). The arguments xl
and yl
represent the x-axis and y-axis lengths of the quad.
NOTE: This method returns a reference to an unstable instance. It is designed to be used directly inside hvlDraw
calls, and should not be used elsewhere.
Example Code
...
@Override
public void update(float delta) {
// draws a magenta quad with upper-left vertex @ (10, 10) and bottom-right vertex at (266, 266)
hvlDraw(hvlQuad(10, 10, 256, 256), hvlColor(1f, 0f, 1f));
// draws a textured quad with upper-left vertex @ (0, 0) and bottom-right vertex at (1920, 1080)
// (this is a common way to handle drawing backgrounds)
hvlDraw(hvlQuad(0, 0, 1920, 1080), hvlTexture(1));
}
...
Fetches an instance of HvlPolygon
that corresponds to a right-angled quadrilateral (rectangle). In this case, the origin of the quad is centered in the middle of the quad (specified by arguments x
and y
). The arguments xl
and yl
represent the x-axis and y-axis lengths of the quad.
NOTE: This method returns a reference to an unstable instance. It is designed to be used directly inside hvlDraw
calls, and should not be used elsewhere.
Example Code
...
@Override
public void update(float delta) {
// draws a green quad with upper-left vertex @ (72, 72) and bottom-right vertex at (328, 328)
hvlDraw(hvlQuadc(200, 200, 256, 256), hvlColor(0f, 1f, 0f));
// draws a textured quad with upper-left vertex @ (myPlayer.x-32, myPlayer.y-32) and bottom-right vertex at (myPlayer.x+32, myPlayer.y+32)
// (assuming myPlayer is a HvlCoord)
hvlDraw(hvlQuadc(myPlayer.x, myPlayer.y, 64, 64), hvlTexture(2));
}
...