Welcome to the Parin cheatsheet. If you notice anything missing or would like to contribute, feel free to create an issue!
// [App]
int screenWidth();
int screenHeight();
();
Vec2 screenSizeint windowWidth();
int windowHeight();
();
Vec2 windowSizeint resolutionWidth();
int resolutionHeight();
();
Vec2 resolution();
EngineViewportInfo engineViewportInfo
int fps();
double elapsedTime();
long elapsedTickCount();
float deltaTime();
bool isWindowResized();
void setBackgroundColor(Color value);
void setBorderColor(Color value);
void setWindowMinSize(int width, int height);
void setWindowMaxSize(int width, int height);
(IStr path);
Fault setWindowIconFromFiles
bool isPixelSnapped();
void setIsPixelSnapped(bool value);
void toggleIsPixelSnapped();
bool isPixelPerfect();
void setIsPixelPerfect(bool value);
void toggleIsPixelPerfect();
bool isCursorVisible();
void setIsCursorVisible(bool value);
void toggleIsCursorVisible();
bool isFullscreen();
void setIsFullscreen(bool value);
void toggleIsFullscreen();
[] envArgs();
IStr();
IStr assetsPath(IStr path);
IStr toAssetsPathbool canUseAssetsPath();
void setCanUseAssetsPath(bool value);
[] droppedFilePaths();
IStrvoid openUrl(IStr url = "https://github.com/Kapendev/parin");
void freeResources();
// [Input]
bool isDown(char key);
bool isDown(Keyboard key);
bool isDown(Mouse key);
bool isDown(Gamepad key, int id = 0);
bool isPressed(char key);
bool isPressed(Keyboard key);
bool isPressed(Mouse key);
bool isPressed(Gamepad key, int id = 0);
bool isReleased(char key);
bool isReleased(Keyboard key);
bool isReleased(Mouse key);
bool isReleased(Gamepad key, int id = 0);
();
Keyboard dequeuePressedKeydchar dequeuePressedRune();
();
Vec2 wasd();
Vec2 wasdPressed();
Vec2 wasdReleased
();
Vec2 mouse();
Vec2 deltaMousefloat deltaWheel();
// [Drawing]
void drawRect(Rect area, Color color = white);
void drawHollowRect(Rect area, float thickness, Color color = white);
void drawCirc(Circ area, Color color = white);
void drawHollowCirc(Circ area, float thickness, Color color = white);
void drawVec2(Vec2 point, float size, Color color = white);
void drawLine(Line area, float size, Color color = white);
void drawTexture(Texture texture, Vec2 position, DrawOptions options = DrawOptions());
void drawTextureArea(Texture texture, Rect area, Vec2 position, DrawOptions options = DrawOptions());
void drawTexturePatch(Texture texture, Rect area, Rect target, bool isTiled, DrawOptions options = DrawOptions());
void drawViewport(Viewport viewport, Vec2 position, DrawOptions options = DrawOptions());
void drawViewportArea(Viewport viewport, Rect area, Vec2 position, DrawOptions options = DrawOptions());
void drawRune(Font font, dchar rune, Vec2 position, DrawOptions options = DrawOptions());
void drawText(Font font, IStr text, Vec2 position, DrawOptions options = DrawOptions());
void drawDebugText(IStr text, Vec2 position, DrawOptions options = DrawOptions());
// [Sound]
void playSound(Sound sound);
void stopSound(Sound sound);
void pauseSound(Sound sound);
void resumeSound(Sound sound);
void updateSound(Sound sound);
// [Loading/Saving]
(IStr path);
TextureId loadTexture(IStr path, int size, int runeSpacing, int lineSpacing, IStr32 runes = "");
FontId loadFont(IStr path, int tileWidth, int tileHeight);
FontId loadFontFromTexture(IStr path, float volume, float pitch);
SoundId loadSound
!Texture loadRawTexture(IStr path);
Result!Font loadRawFont(IStr path, int size, int runeSpacing, int lineSpacing, IStr32 runes = "");
Result!Font loadRawFontFromTexture(IStr path, int tileWidth, int tileHeight);
Result!Sound loadRawSound(IStr path, float volume, float pitch);
Result
(IStr path, ref LStr buffer);
Fault loadRawTextIntoBuffer!LStr loadRawText(IStr path);
Result!IStr loadTempText(IStr path);
Result(IStr path, IStr text);
Fault saveText
// [Random]
int randi();
float randf();
void randomize(int seed);
void randomize();
// [Enums]
enum Flip : ubyte {
,
none,
x,
y,
xy}
enum Alignment : ubyte {
,
left,
center,
right}
enum Filter : ubyte {
,
nearest,
linear}
enum Wrap : ubyte {
,
clamp,
repeat}
enum Blend : ubyte {
,
alpha,
additive,
multiplied,
add,
sub}
enum Keyboard : ushort {
,
none,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
n0,
n1,
n2,
n3,
n4,
n5,
n6,
n7,
n8,
n9,
nn0,
nn1,
nn2,
nn3,
nn4,
nn5,
nn6,
nn7,
nn8,
nn9,
f1,
f2,
f3,
f4,
f5,
f6,
f7,
f8,
f9,
f10,
f11,
f12,
left,
right,
up,
down,
esc,
enter,
tab,
space,
backspace,
shift,
ctrl,
alt,
win,
insert,
del,
home,
end,
pageUp,
pageDown}
enum Mouse : ushort {
,
none,
left,
right,
middle}
enum Gamepad : ushort {
,
none,
left,
right,
up,
down,
y,
x,
a,
b,
lt,
lb,
lsb,
rt,
rb,
rsb,
back,
start,
middle}
// [Structs]
struct DrawOptions {
= Vec2(0.0f);
Vec2 origin = Vec2(1.0f);
Vec2 scale float rotation = 0.0f;
= white;
Color color = Hook.topLeft;
Hook hook = Flip.none;
Flip flip = Alignment.left;
Alignment alignment int alignmentWidth = 0;
float visibilityRatio = 1.0f;
bool isRightToLeft = false;
}
struct TextureId {
int width();
int height();
();
Vec2 sizevoid setFilter(Filter value);
void setWrap(Wrap value);
bool isValid();
void free();
}
struct FontId {
int runeSpacing();
int lineSpacing();
int size();
void setFilter(Filter value);
void setWrap(Wrap value);
bool isValid();
void free();
}
struct SoundId {
bool isPaused();
bool isPlaying();
float time();
float duration();
float progress();
void setVolume(float value);
void setPitch(float value);
void setPan(float value);
bool isValid();
void free();
}