Skip to content

Ridhvl2 Cheatsheet

Calvin Weaver edited this page Feb 24, 2019 · 5 revisions

0. Introduction

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.

Polygon


hvlQuad(float x, float y, float xl, float yl)

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));
}
...


hvlQuadc(float x, float y, float xl, float yl)

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));
}
...


Painter


hvlColor(float rArg, float gArg, float bArg)


hvlColor(float rArg, float gArg, float bArg, float aArg)


hvlColor(float vArg, float aArg)


hvlDraw(HvlPolygon polygonArg, Color colorArg)


hvlDraw(HvlPolygon polygonArg, Texture textureArg)


hvlTranslate(float xArg, float yArg, HvlAction.A0 actionArg)


hvlRotate(float xArg, float yArg, float degreesArg, HvlAction.A0 actionArg)


Loader


hvlLoad(String pathArg)


hvlTexture(int indexArg)