requires "nim >= 2.0.4"
requires "naylib"
requires "classes"πͺ Window Setup
Function | Description |
---|---|
initWindow(width, height, title) |
Initialize a new window with the specified width, height, and title. |
closeWindow() |
Close the current window. |
isWindowReady() |
Check if the window has been initialized successfully. |
Function | Description |
---|---|
beginDrawing() |
Start drawing to the current window. |
clearBackground(color) |
Clear the background of the current window with the specified color. |
loadTexture(fileName) |
Load a new texture from the specified file. |
updateTexture(texture, pixels) |
Update the content of a texture using pixel data. |
drawTexture(texture, x, y, tint) |
Draw a texture at the specified position with the given tint color. |
drawRectangle(x, y, width, height, color) |
Draw a rectangle at the specified position with the given size and color. |
drawCircle(x, y, radius, color) |
Draw a circle at the specified position with the given radius and color. |
drawText(text, x, y, fontSize, color) |
Draw text at the specified position with the given font size and color. |
endDrawing() |
Finish drawing to the current window and present the frame. |
Function | Description |
---|---|
getFrameTime() |
Get the time in seconds for the last frame drawn. |
Feature | Description |
---|---|
class |
Adds class support to Nim, including inheritance, constructors, and more. |
var |
Class variables with default values can be defined within the class. |
method |
Methods can be defined within the class, including abstract methods and static methods. |
super |
The `super` keyword allows you to call methods on the parent class. |
init() |
An optional constructor method that is called when creating a new instance of the class. |
deinit() |
An optional destructor method that is called when an instance of the class is destroyed. |
mixin |
Allows you to copy variables and methods from one class to another. |
singleton |
Defines a class that can only have one instance, accessed via the `.shared()` method. |
Class | Description |
---|---|
object |
The base type for all classes in Nim. Defines the structure of the object and its methods. |
ref object |
A reference type object, which is allocated on the heap and can be shared between multiple variables. |
tuple |
A lightweight object-like structure that can hold multiple values of different types. |
Syntax | Description |
---|---|
=> |
The arrow operator, used for creating anonymous functions and object field access. |
@[] |
The slice operator, used for creating slices of arrays, sequences, and strings. |
?. |
The safe navigation operator, used to safely access object fields and methods without raising exceptions. |
Syntax | Description |
---|---|
for i in 0..10: |
A for loop that iterates over a range of numbers. |
while condition: |
A while loop that executes as long as the condition is true. |
for item in myArray: |
A for loop that iterates over each element in an array or sequence. |
Syntax | Description |
---|---|
if condition: |
An if statement that executes the block if the condition is true. |
elif condition: |
An elif statement that executes the block if the previous if/elif conditions were false. |
else: |
An else statement that executes the block if all previous conditions were false. |
Data Structure | Description |
---|---|
seq[T] Nim's dynamic array type, |
Initialization: Append: Delete: |
Table[K, V] Nim's hash table |
Initialization: Insert: Delete: |
BinaryTree[T] Nim's binary tree data structure, supporting common tree operations. |
Initialization: Insert: Delete: |
Function | Description |
---|---|
Image {.importc, header: "raylib.h", completeStruct, bycopy.} = object
data*: pointer ## Image raw data
width*: int32 ## Image base width
height*: int32 ## Image base height
mipmaps*: int32 ## Mipmap levels, 1 by default
format*: PixelFormat ## Data format (PixelFormat type)
|
Image, pixel data stored in CPU memory (RAM) |
GlyphInfo {.importc, header: "raylib.h", completeStruct, bycopy.} = object
value*: int32 ## Character value (Unicode)
offsetX*: int32 ## Character offset X when drawing
offsetY*: int32 ## Character offset Y when drawing
advanceX*: int32 ## Character advance position X
image*: Image ## Character image data
|
GlyphInfo, font characters glyphs info |
proc setWindowIcon(image: Image) {.importc: "SetWindowIcon", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Set icon for window (single image, RGBA 32bit) |
proc getClipboardImage(): Image {.importc: "GetClipboardImage", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get clipboard image content |
proc loadImageFromScreen(): Image {.importc: "LoadImageFromScreen", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Load image from screen buffer and (screenshot) |
func isImageValid(image: Image): bool {.importc: "IsImageValid",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if an image is valid (data and parameters) |
func genImageColor(width: int32; height: int32; color: Color): Image {.
importc: "GenImageColor", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: plain color |
func genImageGradientLinear(width: int32; height: int32; direction: int32;
start: Color; end: Color): Image {.
importc: "GenImageGradientLinear", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: linear gradient, direction in degrees 0..360, 0=Vertical gradient |
func genImageGradientRadial(width: int32; height: int32; density: float32;
inner: Color; outer: Color): Image {.
importc: "GenImageGradientRadial", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: radial gradient |
func genImageGradientSquare(width: int32; height: int32; density: float32;
inner: Color; outer: Color): Image {.
importc: "GenImageGradientSquare", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: square gradient |
func genImageChecked(width: int32; height: int32; checksX: int32;
checksY: int32; col1: Color; col2: Color): Image {.
importc: "GenImageChecked", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: checked |
func genImageWhiteNoise(width: int32; height: int32; factor: float32): Image {.
importc: "GenImageWhiteNoise", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: white noise |
func genImagePerlinNoise(width: int32; height: int32; offsetX: int32;
offsetY: int32; scale: float32): Image {.
importc: "GenImagePerlinNoise", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: perlin noise |
func genImageCellular(width: int32; height: int32; tileSize: int32): Image {.
importc: "GenImageCellular", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: cellular algorithm, bigger tileSize means bigger cells |
func imageCopy(image: Image): Image {.importc: "ImageCopy", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Create an image duplicate (useful for transformations) |
func imageFromImage(image: Image; rec: Rectangle): Image {.
importc: "ImageFromImage", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Create an image from another image piece |
func imageFromChannel(image: Image; selectedChannel: int32): Image {.
importc: "ImageFromChannel", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Create an image from a selected channel of another image (GRAYSCALE) |
func imageFormat(image: var Image; newFormat: PixelFormat) {.
importc: "ImageFormat", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Convert image data to desired format |
func imageToPOT(image: var Image; fill: Color) {.importc: "ImageToPOT",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Convert image to POT (power-of-two) |
func imageCrop(image: var Image; crop: Rectangle) {.importc: "ImageCrop",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Crop an image to a defined rectangle |
func imageAlphaCrop(image: var Image; threshold: float32) {.
importc: "ImageAlphaCrop", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Crop image depending on alpha value |
func imageAlphaClear(image: var Image; color: Color; threshold: float32) {.
importc: "ImageAlphaClear", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Clear alpha channel to desired color |
func imageAlphaMask(image: var Image; alphaMask: Image) {.
importc: "ImageAlphaMask", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Apply alpha mask to image |
func imageAlphaPremultiply(image: var Image) {.importc: "ImageAlphaPremultiply",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Premultiply alpha channel |
func imageBlurGaussian(image: var Image; blurSize: int32) {.
importc: "ImageBlurGaussian", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Apply Gaussian blur using a box blur approximation |
func imageResize(image: var Image; newWidth: int32; newHeight: int32) {.
importc: "ImageResize", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resize image (Bicubic scaling algorithm) |
func imageResizeNN(image: var Image; newWidth: int32; newHeight: int32) {.
importc: "ImageResizeNN", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resize image (Nearest-Neighbor scaling algorithm) |
func imageResizeCanvas(image: var Image; newWidth: int32; newHeight: int32;
offsetX: int32; offsetY: int32; fill: Color) {.
importc: "ImageResizeCanvas", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resize canvas and fill with color |
func imageMipmaps(image: var Image) {.importc: "ImageMipmaps",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Compute all mipmap levels for a provided image |
func imageDither(image: var Image; rBpp: int32; gBpp: int32; bBpp: int32;
aBpp: int32) {.importc: "ImageDither", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Dither image data to 16bpp or lower (Floyd-Steinberg dithering) |
func imageFlipVertical(image: var Image) {.importc: "ImageFlipVertical",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Flip image vertically |
func imageFlipHorizontal(image: var Image) {.importc: "ImageFlipHorizontal",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Flip image horizontally |
func imageRotate(image: var Image; degrees: int32) {.importc: "ImageRotate",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Rotate image by input angle in degrees (-359 to 359) |
func imageRotateCW(image: var Image) {.importc: "ImageRotateCW",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Rotate image clockwise 90deg |
func imageRotateCCW(image: var Image) {.importc: "ImageRotateCCW",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Rotate image counter-clockwise 90deg |
func imageColorTint(image: var Image; color: Color) {.importc: "ImageColorTint",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: tint |
func imageColorInvert(image: var Image) {.importc: "ImageColorInvert",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: invert |
func imageColorGrayscale(image: var Image) {.importc: "ImageColorGrayscale",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: grayscale |
func imageColorContrast(image: var Image; contrast: float32) {.
importc: "ImageColorContrast", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: contrast (-100 to 100) |
func imageColorBrightness(image: var Image; brightness: int32) {.
importc: "ImageColorBrightness", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: brightness (-255 to 255) |
func imageColorReplace(image: var Image; color: Color; replace: Color) {.
importc: "ImageColorReplace", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: replace color |
func getImageAlphaBorder(image: Image; threshold: float32): Rectangle {.
importc: "GetImageAlphaBorder", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get image alpha border rectangle |
func getImageColor(image: Image; x: int32; y: int32): Color {.
importc: "GetImageColor", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get image pixel color at (x, y) position |
func imageClearBackground(dst: var Image; color: Color) {.
importc: "ImageClearBackground", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Clear image background with given color |
func imageDrawPixel(dst: var Image; posX: int32; posY: int32; color: Color) {.
importc: "ImageDrawPixel", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image |
func imageDrawPixel(dst: var Image; position: Vector2; color: Color) {.
importc: "ImageDrawPixelV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image (Vector version) |
func imageDrawLine(dst: var Image; startPosX: int32; startPosY: int32;
endPosX: int32; endPosY: int32; color: Color) {.
importc: "ImageDrawLine", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; color: Color) {.
importc: "ImageDrawLineV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image (Vector version) |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; thick: int32;
color: Color) {.importc: "ImageDrawLineEx",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line defining thickness within an image |
func imageDrawCircle(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.importc: "ImageDrawCircle",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a filled circle within an image |
func imageDrawCircle(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleV",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a filled circle within an image (Vector version) |
func imageDrawCircleLines(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.
importc: "ImageDrawCircleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw circle outline within an image |
func imageDrawCircleLines(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleLinesV",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw circle outline within an image (Vector version) |
func imageDrawRectangle(dst: var Image; posX: int32; posY: int32; width: int32;
height: int32; color: Color) {.
importc: "ImageDrawRectangle", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangle(dst: var Image; position: Vector2; size: Vector2;
color: Color) {.importc: "ImageDrawRectangleV",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle within an image (Vector version) |
func imageDrawRectangle(dst: var Image; rec: Rectangle; color: Color) {.
importc: "ImageDrawRectangleRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangleLines(dst: var Image; rec: Rectangle; thick: int32;
color: Color) {.importc: "ImageDrawRectangleLines",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle lines within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
color: Color) {.importc: "ImageDrawTriangle",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
c1: Color; c2: Color; c3: Color) {.
importc: "ImageDrawTriangleEx", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle with interpolated colors within an image |
func imageDrawTriangleLines(dst: var Image; v1: Vector2; v2: Vector2;
v3: Vector2; color: Color) {.
importc: "ImageDrawTriangleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle outline within an image |
func imageDraw(dst: var Image; src: Image; srcRec: Rectangle; dstRec: Rectangle;
tint: Color) {.importc: "ImageDraw", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a source image within a destination image (tint applied to source) |
proc genMeshHeightmap(heightmap: Image; size: Vector3): Mesh {.
importc: "GenMeshHeightmap", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate heightmap mesh from image data |
proc genMeshCubicmap(cubicmap: Image; cubeSize: Vector3): Mesh {.
importc: "GenMeshCubicmap", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate cubes-based map mesh from image data |
proc setWindowIcons(images: openArray[Image]) {.raises: [], tags: [],
forbids: [].} |
Set icon for window (multiple images, RGBA 32bit) |
proc exportImage(image: Image; fileName: string): bool {.raises: [], tags: [],
forbids: [].} |
Export image data to file, returns true on success |
proc exportImageAsCode(image: Image; fileName: string): bool {.raises: [],
tags: [], forbids: [].} |
Export image as code file defining an array of bytes, returns true on success |
proc genImageText(width: int32; height: int32; text: string): Image {.
raises: [], tags: [], forbids: [].} |
Generate image: grayscale image from text data |
proc imageText(text: string; fontSize: int32; color: Color): Image {.raises: [],
tags: [], forbids: [].} |
Create an image from text (default font) |
proc imageText(font: Font; text: string; fontSize: float32; spacing: float32;
tint: Color): Image {.raises: [], tags: [], forbids: [].} |
Create an image from text (custom sprite font) |
proc imageKernelConvolution(image: var Image; kernel: openArray[float32]) {.
raises: [], tags: [], forbids: [].} |
Apply custom square convolution kernel to image |
proc imageDrawTriangleFan(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle fan defined by points within an image (first vertex is the center) |
proc imageDrawTriangleStrip(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle strip defined by points within an image |
proc imageDrawText(dst: var Image; text: string; posX: int32; posY: int32;
fontSize: int32; color: Color) {.raises: [], tags: [],
forbids: [].} |
Draw text (using default font) within an image (destination) |
proc imageDrawText(dst: var Image; font: Font; text: string; position: Vector2;
fontSize: float32; spacing: float32; tint: Color) {.
raises: [], tags: [], forbids: [].} |
Draw text (custom sprite font) within an image (destination) |
proc loadImageColors(image: Image): RArray[Color] {.raises: [], tags: [],
forbids: [].} |
Load color data from image as a Color array (RGBA - 32bit) |
proc loadImagePalette(image: Image; maxPaletteSize: int32): RArray[Color] {.
raises: [], tags: [], forbids: [].} |
Load colors palette from image as a Color array (RGBA - 32bit) |
proc loadImage(fileName: string): Image {.raises: [RaylibError], tags: [],
forbids: [].} |
Load image from file into CPU memory (RAM) |
proc loadImageRaw(fileName: string; width, height: int32; format: PixelFormat;
headerSize: int32): Image {.raises: [RaylibError], tags: [],
forbids: [].} |
Load image sequence from file (frames appended to image.data) |
proc loadImageAnim(fileName: string; frames: out int32): Image {.
raises: [RaylibError], tags: [], forbids: [].} |
Load image sequence from file (frames appended to image.data) |
proc loadImageAnimFromMemory(fileType: string; fileData: openArray[uint8];
frames: openArray[int32]): Image {.
raises: [RaylibError], tags: [], forbids: [].} |
Load image sequence from memory buffer |
proc loadImageFromMemory(fileType: string; fileData: openArray[uint8]): Image {.
raises: [RaylibError], tags: [], forbids: [].} |
Load image from memory buffer, fileType refers to extension: i.e. '.png' |
proc loadImageFromTexture(texture: Texture2D): Image {.raises: [RaylibError],
tags: [], forbids: [].} |
Load image from GPU texture data |
proc exportImageToMemory(image: Image; fileType: string): RArray[uint8] {.
raises: [], tags: [], forbids: [].} |
Export image to memory buffer |
proc loadTextureFromImage(image: Image): Texture2D {.raises: [RaylibError],
tags: [], forbids: [].} |
Load texture from image data |
proc loadTextureCubemap(image: Image; layout: CubemapLayout): TextureCubemap {.
raises: [RaylibError], tags: [], forbids: [].} |
Load cubemap from image, multiple image cubemap layouts supported |
proc loadFontFromImage(image: Image; key: Color; firstChar: int32): Font {.
raises: [RaylibError], tags: [], forbids: [].} |
Load font from Image (XNA style) |
proc genImageFontAtlas(chars: openArray[GlyphInfo]; recs: out RArray[Rectangle];
fontSize: int32; padding: int32; packMethod: int32): Image {.
raises: [], tags: [], forbids: [].} |
Generate image font atlas using chars info |
Function | Description |
---|---|
proc beginDrawing() {.importc: "BeginDrawing", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Setup canvas (framebuffer) to start drawing |
proc endDrawing() {.importc: "EndDrawing", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
End canvas drawing and swap buffers (double buffering) |
proc drawPixel(posX: int32; posY: int32; color: Color) {.importc: "DrawPixel",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a pixel using geometry Can be slow, use with care |
proc drawPixel(position: Vector2; color: Color) {.importc: "DrawPixelV",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a pixel using geometry (Vector version) Can be slow, use with care |
proc drawLine(startPosX: int32; startPosY: int32; endPosX: int32;
endPosY: int32; color: Color) {.importc: "DrawLine", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a line |
proc drawLine(startPos: Vector2; endPos: Vector2; color: Color) {.
importc: "DrawLineV", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line (using gl lines) |
proc drawLine(startPos: Vector2; endPos: Vector2; thick: float32; color: Color) {.
importc: "DrawLineEx", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line (using triangles/quads) |
proc drawLineBezier(startPos: Vector2; endPos: Vector2; thick: float32;
color: Color) {.importc: "DrawLineBezier", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line segment cubic-bezier in-out interpolation |
proc drawCircle(centerX: int32; centerY: int32; radius: float32; color: Color) {.
importc: "DrawCircle", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled circle |
proc drawCircleSector(center: Vector2; radius: float32; startAngle: float32;
endAngle: float32; segments: int32; color: Color) {.
importc: "DrawCircleSector", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a piece of a circle |
proc drawCircleSectorLines(center: Vector2; radius: float32;
startAngle: float32; endAngle: float32;
segments: int32; color: Color) {.
importc: "DrawCircleSectorLines", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw circle sector outline |
proc drawCircleGradient(centerX: int32; centerY: int32; radius: float32;
inner: Color; outer: Color) {.
importc: "DrawCircleGradient", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a gradient-filled circle |
proc drawCircle(center: Vector2; radius: float32; color: Color) {.
importc: "DrawCircleV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled circle (Vector version) |
proc drawCircleLines(centerX: int32; centerY: int32; radius: float32;
color: Color) {.importc: "DrawCircleLines", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw circle outline |
proc drawCircleLines(center: Vector2; radius: float32; color: Color) {.
importc: "DrawCircleLinesV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw circle outline (Vector version) |
proc drawEllipse(centerX: int32; centerY: int32; radiusH: float32;
radiusV: float32; color: Color) {.importc: "DrawEllipse",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw ellipse |
proc drawEllipseLines(centerX: int32; centerY: int32; radiusH: float32;
radiusV: float32; color: Color) {.
importc: "DrawEllipseLines", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw ellipse outline |
proc drawRing(center: Vector2; innerRadius: float32; outerRadius: float32;
startAngle: float32; endAngle: float32; segments: int32;
color: Color) {.importc: "DrawRing", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw ring |
proc drawRingLines(center: Vector2; innerRadius: float32; outerRadius: float32;
startAngle: float32; endAngle: float32; segments: int32;
color: Color) {.importc: "DrawRingLines", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw ring outline |
proc drawRectangle(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangle", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(position: Vector2; size: Vector2; color: Color) {.
importc: "DrawRectangleV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled rectangle (Vector version) |
proc drawRectangle(rec: Rectangle; color: Color) {.importc: "DrawRectangleRec",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(rec: Rectangle; origin: Vector2; rotation: float32;
color: Color) {.importc: "DrawRectanglePro", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle with pro parameters |
proc drawRectangleGradientV(posX: int32; posY: int32; width: int32;
height: int32; top: Color; bottom: Color) {.
importc: "DrawRectangleGradientV", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a vertical-gradient-filled rectangle |
proc drawRectangleGradientH(posX: int32; posY: int32; width: int32;
height: int32; left: Color; right: Color) {.
importc: "DrawRectangleGradientH", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a horizontal-gradient-filled rectangle |
proc drawRectangleGradient(rec: Rectangle; topLeft: Color; bottomLeft: Color;
topRight: Color; bottomRight: Color) {.
importc: "DrawRectangleGradientEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a gradient-filled rectangle with custom vertex colors |
proc drawRectangleLines(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangleLines",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle outline |
proc drawRectangleLines(rec: Rectangle; lineThick: float32; color: Color) {.
importc: "DrawRectangleLinesEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle outline with extended parameters |
proc drawRectangleRounded(rec: Rectangle; roundness: float32; segments: int32;
color: Color) {.importc: "DrawRectangleRounded",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; color: Color) {.
importc: "DrawRectangleRoundedLines", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle lines with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; lineThick: float32; color: Color) {.
importc: "DrawRectangleRoundedLinesEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges outline |
proc drawTriangle(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.
importc: "DrawTriangle", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled triangle (vertex in counter-clockwise order!) |
proc drawTriangleLines(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.
importc: "DrawTriangleLines", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw triangle outline (vertex in counter-clockwise order!) |
proc drawPoly(center: Vector2; sides: int32; radius: float32; rotation: float32;
color: Color) {.importc: "DrawPoly", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a regular polygon (Vector version) |
proc drawPolyLines(center: Vector2; sides: int32; radius: float32;
rotation: float32; color: Color) {.importc: "DrawPolyLines",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a polygon outline of n sides |
proc drawPolyLines(center: Vector2; sides: int32; radius: float32;
rotation: float32; lineThick: float32; color: Color) {.
importc: "DrawPolyLinesEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a polygon outline of n sides with extended parameters |
proc drawSplineSegmentLinear(p1: Vector2; p2: Vector2; thick: float32;
color: Color) {.importc: "DrawSplineSegmentLinear",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw spline segment: Linear, 2 points |
proc drawSplineSegmentBasis(p1: Vector2; p2: Vector2; p3: Vector2; p4: Vector2;
thick: float32; color: Color) {.
importc: "DrawSplineSegmentBasis", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: B-Spline, 4 points |
proc drawSplineSegmentCatmullRom(p1: Vector2; p2: Vector2; p3: Vector2;
p4: Vector2; thick: float32; color: Color) {.
importc: "DrawSplineSegmentCatmullRom", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Catmull-Rom, 4 points |
proc drawSplineSegmentBezierQuadratic(p1: Vector2; c2: Vector2; p3: Vector2;
thick: float32; color: Color) {.
importc: "DrawSplineSegmentBezierQuadratic", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Quadratic Bezier, 2 points, 1 control point |
proc drawSplineSegmentBezierCubic(p1: Vector2; c2: Vector2; c3: Vector2;
p4: Vector2; thick: float32; color: Color) {.
importc: "DrawSplineSegmentBezierCubic", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Cubic Bezier, 2 points, 2 control points |
func imageDrawPixel(dst: var Image; posX: int32; posY: int32; color: Color) {.
importc: "ImageDrawPixel", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image |
func imageDrawPixel(dst: var Image; position: Vector2; color: Color) {.
importc: "ImageDrawPixelV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image (Vector version) |
func imageDrawLine(dst: var Image; startPosX: int32; startPosY: int32;
endPosX: int32; endPosY: int32; color: Color) {.
importc: "ImageDrawLine", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; color: Color) {.
importc: "ImageDrawLineV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image (Vector version) |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; thick: int32;
color: Color) {.importc: "ImageDrawLineEx",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line defining thickness within an image |
func imageDrawCircle(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.importc: "ImageDrawCircle",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a filled circle within an image |
func imageDrawCircle(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleV",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a filled circle within an image (Vector version) |
func imageDrawCircleLines(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.
importc: "ImageDrawCircleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw circle outline within an image |
func imageDrawCircleLines(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleLinesV",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw circle outline within an image (Vector version) |
func imageDrawRectangle(dst: var Image; posX: int32; posY: int32; width: int32;
height: int32; color: Color) {.
importc: "ImageDrawRectangle", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangle(dst: var Image; position: Vector2; size: Vector2;
color: Color) {.importc: "ImageDrawRectangleV",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle within an image (Vector version) |
func imageDrawRectangle(dst: var Image; rec: Rectangle; color: Color) {.
importc: "ImageDrawRectangleRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangleLines(dst: var Image; rec: Rectangle; thick: int32;
color: Color) {.importc: "ImageDrawRectangleLines",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle lines within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
color: Color) {.importc: "ImageDrawTriangle",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
c1: Color; c2: Color; c3: Color) {.
importc: "ImageDrawTriangleEx", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle with interpolated colors within an image |
func imageDrawTriangleLines(dst: var Image; v1: Vector2; v2: Vector2;
v3: Vector2; color: Color) {.
importc: "ImageDrawTriangleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle outline within an image |
func imageDraw(dst: var Image; src: Image; srcRec: Rectangle; dstRec: Rectangle;
tint: Color) {.importc: "ImageDraw", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a source image within a destination image (tint applied to source) |
proc drawTexture(texture: Texture2D; posX: int32; posY: int32; tint: Color) {.
importc: "DrawTexture", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D |
proc drawTexture(texture: Texture2D; position: Vector2; tint: Color) {.
importc: "DrawTextureV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D with position defined as Vector2 |
proc drawTexture(texture: Texture2D; position: Vector2; rotation: float32;
scale: float32; tint: Color) {.importc: "DrawTextureEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a Texture2D with extended parameters |
proc drawTexture(texture: Texture2D; source: Rectangle; position: Vector2;
tint: Color) {.importc: "DrawTextureRec", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a part of a texture defined by a rectangle |
proc drawTexture(texture: Texture2D; source: Rectangle; dest: Rectangle;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawTexturePro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a part of a texture defined by a rectangle with 'pro' parameters |
proc drawTextureNPatch(texture: Texture2D; nPatchInfo: NPatchInfo;
dest: Rectangle; origin: Vector2; rotation: float32;
tint: Color) {.importc: "DrawTextureNPatch", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draws a texture (or part of it) that stretches or shrinks nicely |
proc drawFPS(posX: int32; posY: int32) {.importc: "DrawFPS", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw current FPS |
proc drawTextCodepoint(font: Font; codepoint: Rune; position: Vector2;
fontSize: float32; tint: Color) {.
importc: "DrawTextCodepoint", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw one character (codepoint) |
proc drawLine3D(startPos: Vector3; endPos: Vector3; color: Color) {.
importc: "DrawLine3D", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line in 3D world space |
proc drawPoint3D(position: Vector3; color: Color) {.importc: "DrawPoint3D",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a point in 3D space, actually a small line |
proc drawCircle3D(center: Vector3; radius: float32; rotationAxis: Vector3;
rotationAngle: float32; color: Color) {.
importc: "DrawCircle3D", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a circle in 3D world space |
proc drawTriangle3D(v1: Vector3; v2: Vector3; v3: Vector3; color: Color) {.
importc: "DrawTriangle3D", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled triangle (vertex in counter-clockwise order!) |
proc drawCube(position: Vector3; width: float32; height: float32;
length: float32; color: Color) {.importc: "DrawCube", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw cube |
proc drawCube(position: Vector3; size: Vector3; color: Color) {.
importc: "DrawCubeV", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw cube (Vector version) |
proc drawCubeWires(position: Vector3; width: float32; height: float32;
length: float32; color: Color) {.importc: "DrawCubeWires",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw cube wires |
proc drawCubeWires(position: Vector3; size: Vector3; color: Color) {.
importc: "DrawCubeWiresV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw cube wires (Vector version) |
proc drawSphere(centerPos: Vector3; radius: float32; color: Color) {.
importc: "DrawSphere", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw sphere |
proc drawSphere(centerPos: Vector3; radius: float32; rings: int32;
slices: int32; color: Color) {.importc: "DrawSphereEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw sphere with extended parameters |
proc drawSphereWires(centerPos: Vector3; radius: float32; rings: int32;
slices: int32; color: Color) {.importc: "DrawSphereWires",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw sphere wires |
proc drawCylinder(position: Vector3; radiusTop: float32; radiusBottom: float32;
height: float32; slices: int32; color: Color) {.
importc: "DrawCylinder", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder/cone |
proc drawCylinder(startPos: Vector3; endPos: Vector3; startRadius: float32;
endRadius: float32; sides: int32; color: Color) {.
importc: "DrawCylinderEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder with base at startPos and top at endPos |
proc drawCylinderWires(position: Vector3; radiusTop: float32;
radiusBottom: float32; height: float32; slices: int32;
color: Color) {.importc: "DrawCylinderWires", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a cylinder/cone wires |
proc drawCylinderWires(startPos: Vector3; endPos: Vector3; startRadius: float32;
endRadius: float32; sides: int32; color: Color) {.
importc: "DrawCylinderWiresEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder wires with base at startPos and top at endPos |
proc drawCapsule(startPos: Vector3; endPos: Vector3; radius: float32;
slices: int32; rings: int32; color: Color) {.
importc: "DrawCapsule", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a capsule with the center of its sphere caps at startPos and endPos |
proc drawCapsuleWires(startPos: Vector3; endPos: Vector3; radius: float32;
slices: int32; rings: int32; color: Color) {.
importc: "DrawCapsuleWires", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw capsule wireframe with the center of its sphere caps at startPos and endPos |
proc drawPlane(centerPos: Vector3; size: Vector2; color: Color) {.
importc: "DrawPlane", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a plane XZ |
proc drawRay(ray: Ray; color: Color) {.importc: "DrawRay", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a ray line |
proc drawGrid(slices: int32; spacing: float32) {.importc: "DrawGrid",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a grid (centered at (0, 0, 0)) |
proc drawModel(model: Model; position: Vector3; scale: float32; tint: Color) {.
importc: "DrawModel", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a model (with texture if set) |
proc drawModel(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model with extended parameters |
proc drawModelWires(model: Model; position: Vector3; scale: float32; tint: Color) {.
importc: "DrawModelWires", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model wires (with texture if set) |
proc drawModelWires(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelWiresEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model wires (with texture if set) with extended parameters |
proc drawModelPoints(model: Model; position: Vector3; scale: float32;
tint: Color) {.importc: "DrawModelPoints", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a model as points |
proc drawModelPoints(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelPointsEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model as points with extended parameters |
proc drawBoundingBox(box: BoundingBox; color: Color) {.
importc: "DrawBoundingBox", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw bounding box (wires) |
proc drawBillboard(camera: Camera; texture: Texture2D; position: Vector3;
scale: float32; tint: Color) {.importc: "DrawBillboard",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a billboard texture |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; size: Vector2; tint: Color) {.
importc: "DrawBillboardRec", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; up: Vector3; size: Vector2;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawBillboardPro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source and rotation |
proc drawMesh(mesh: Mesh; material: Material; transform: Matrix) {.
importc: "DrawMesh", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a 3d mesh with material and transform |
proc imageDrawTriangleFan(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle fan defined by points within an image (first vertex is the center) |
proc imageDrawTriangleStrip(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle strip defined by points within an image |
proc imageDrawText(dst: var Image; text: string; posX: int32; posY: int32;
fontSize: int32; color: Color) {.raises: [], tags: [],
forbids: [].} |
Draw text (using default font) within an image (destination) |
proc imageDrawText(dst: var Image; font: Font; text: string; position: Vector2;
fontSize: float32; spacing: float32; tint: Color) {.
raises: [], tags: [], forbids: [].} |
Draw text (custom sprite font) within an image (destination) |
Function | Description |
---|---|
TextureFilter {.size: 4.} = enum
Point, ## No filter, just pixel approximation
Bilinear, ## Linear filtering
Trilinear, ## Trilinear filtering (linear with mipmaps)
Anisotropic4x, ## Anisotropic filtering 4x
Anisotropic8x, ## Anisotropic filtering 8x
Anisotropic16x ## Anisotropic filtering 16x |
Texture parameters: filter mode |
TextureWrap {.size: 4.} = enum
Repeat, ## Repeats texture in tiled mode
Clamp, ## Clamps texture to edge pixel in tiled mode
MirrorRepeat, ## Mirrors and repeats the texture in tiled mode
MirrorClamp ## Mirrors and clamps to border the texture in tiled mode |
Texture parameters: wrap mode |
Texture {.importc, header: "raylib.h", completeStruct, bycopy.} = object
id*: uint32 ## OpenGL texture id
width*: int32 ## Texture base width
height*: int32 ## Texture base height
mipmaps*: int32 ## Mipmap levels, 1 by default
format*: PixelFormat ## Data format (PixelFormat type)
|
Texture, tex data stored in GPU memory (VRAM) |
RenderTexture {.importc, header: "raylib.h", completeStruct, bycopy.} = object
id*: uint32 ## OpenGL framebuffer object id
texture*: Texture ## Color buffer attachment texture
depth*: Texture ## Depth buffer attachment texture
|
RenderTexture, fbo for texture rendering |
NPatchInfo {.importc, header: "raylib.h", completeStruct, bycopy.} = object
source*: Rectangle ## Texture source rectangle
left*: int32 ## Left border offset
top*: int32 ## Top border offset
right*: int32 ## Right border offset
bottom*: int32 ## Bottom border offset
layout*: NPatchLayout ## Layout of the n-patch: 3x3, 1x3 or 3x1
|
NPatchInfo, n-patch layout info |
Font {.importc, header: "raylib.h", completeStruct, bycopy.} = object
baseSize*: int32 ## Base size (default chars height)
## Number of glyph characters
glyphPadding*: int32 ## Padding around the glyph characters
texture*: Texture2D ## Texture atlas containing the glyphs
## Rectangles in texture for the glyphs
## Glyphs info data
|
Font, font texture and GlyphInfo array data |
Texture2D = Texture |
Texture2D, same as Texture |
TextureCubemap = Texture |
TextureCubemap, same as Texture |
RenderTexture2D = RenderTexture |
RenderTexture2D, same as RenderTexture |
proc beginTextureMode(target: RenderTexture2D) {.importc: "BeginTextureMode",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Begin drawing to render texture |
proc endTextureMode() {.importc: "EndTextureMode", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Ends drawing to render texture |
proc setShaderValueTexture(shader: Shader; locIndex: ShaderLocation;
texture: Texture2D) {.
importc: "SetShaderValueTexture", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set shader uniform value for texture (sampler2d) |
proc setShapesTexture(texture: Texture2D; source: Rectangle) {.
importc: "SetShapesTexture", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set texture and rectangle to be used on shapes drawing |
proc getShapesTexture(): Texture2D {.importc: "GetShapesTexture", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get texture that is used for shapes drawing |
proc getShapesTextureRectangle(): Rectangle {.
importc: "GetShapesTextureRectangle", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get texture source rectangle that is used for shapes drawing |
func isTextureValid(texture: Texture2D): bool {.importc: "IsTextureValid",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a texture is valid (loaded in GPU) |
func isRenderTextureValid(target: RenderTexture2D): bool {.
importc: "IsRenderTextureValid", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if a render texture is valid (loaded in GPU) |
proc genTextureMipmaps(texture: var Texture2D) {.importc: "GenTextureMipmaps",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Generate GPU mipmaps for a texture |
proc setTextureFilter(texture: Texture2D; filter: TextureFilter) {.
importc: "SetTextureFilter", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set texture scaling filter mode |
proc setTextureWrap(texture: Texture2D; wrap: TextureWrap) {.
importc: "SetTextureWrap", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set texture wrapping mode |
proc drawTexture(texture: Texture2D; posX: int32; posY: int32; tint: Color) {.
importc: "DrawTexture", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D |
proc drawTexture(texture: Texture2D; position: Vector2; tint: Color) {.
importc: "DrawTextureV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D with position defined as Vector2 |
proc drawTexture(texture: Texture2D; position: Vector2; rotation: float32;
scale: float32; tint: Color) {.importc: "DrawTextureEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a Texture2D with extended parameters |
proc drawTexture(texture: Texture2D; source: Rectangle; position: Vector2;
tint: Color) {.importc: "DrawTextureRec", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a part of a texture defined by a rectangle |
proc drawTexture(texture: Texture2D; source: Rectangle; dest: Rectangle;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawTexturePro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a part of a texture defined by a rectangle with 'pro' parameters |
proc drawTextureNPatch(texture: Texture2D; nPatchInfo: NPatchInfo;
dest: Rectangle; origin: Vector2; rotation: float32;
tint: Color) {.importc: "DrawTextureNPatch", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draws a texture (or part of it) that stretches or shrinks nicely |
proc drawBillboard(camera: Camera; texture: Texture2D; position: Vector3;
scale: float32; tint: Color) {.importc: "DrawBillboard",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a billboard texture |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; size: Vector2; tint: Color) {.
importc: "DrawBillboardRec", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; up: Vector3; size: Vector2;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawBillboardPro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source and rotation |
proc texture=(x: var MaterialMap; val: Texture) {.nodestroy, inline, raises: [],
tags: [], forbids: [].} |
Set texture for a material map type (Diffuse, Specular...) NOTE: Previous texture should be manually unloaded |
proc loadImageFromTexture(texture: Texture2D): Image {.raises: [RaylibError],
tags: [], forbids: [].} |
Load image from GPU texture data |
proc loadTextureFromData[T: Pixel](pixels: openArray[T]; width: int32;
height: int32): Texture |
Load texture using pixels |
proc loadTexture(fileName: string): Texture2D {.raises: [RaylibError], tags: [],
forbids: [].} |
Load texture from file into GPU memory (VRAM) |
proc loadTextureFromImage(image: Image): Texture2D {.raises: [RaylibError],
tags: [], forbids: [].} |
Load texture from image data |
proc loadTextureCubemap(image: Image; layout: CubemapLayout): TextureCubemap {.
raises: [RaylibError], tags: [], forbids: [].} |
Load cubemap from image, multiple image cubemap layouts supported |
proc loadRenderTexture(width: int32; height: int32): RenderTexture2D {.
raises: [RaylibError], tags: [], forbids: [].} |
Load texture for rendering (framebuffer) |
proc updateTexture[T: Pixel](texture: Texture2D; pixels: openArray[T]) |
Update GPU texture with new data |
proc updateTexture[T: Pixel](texture: Texture2D; rec: Rectangle;
pixels: openArray[T]) |
Update GPU texture rectangle with new data |
template textureMode(target: RenderTexture2D; body: untyped) |
Drawing to render texture |
Function | Description |
---|---|
ShaderLocationIndex {.size: 4.} = enum
VertexPosition, ## Shader location: vertex attribute: position
VertexTexcoord01, ## Shader location: vertex attribute: texcoord01
VertexTexcoord02, ## Shader location: vertex attribute: texcoord02
VertexNormal, ## Shader location: vertex attribute: normal
VertexTangent, ## Shader location: vertex attribute: tangent
VertexColor, ## Shader location: vertex attribute: color
MatrixMvp, ## Shader location: matrix uniform: model-view-projection
MatrixView, ## Shader location: matrix uniform: view (camera transform)
MatrixProjection, ## Shader location: matrix uniform: projection
MatrixModel, ## Shader location: matrix uniform: model (transform)
MatrixNormal, ## Shader location: matrix uniform: normal
VectorView, ## Shader location: vector uniform: view
ColorDiffuse, ## Shader location: vector uniform: diffuse color
ColorSpecular, ## Shader location: vector uniform: specular color
ColorAmbient, ## Shader location: vector uniform: ambient color
MapAlbedo, ## Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)
MapMetalness, ## Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)
MapNormal, ## Shader location: sampler2d texture: normal
MapRoughness, ## Shader location: sampler2d texture: roughness
MapOcclusion, ## Shader location: sampler2d texture: occlusion
MapEmission, ## Shader location: sampler2d texture: emission
MapHeight, ## Shader location: sampler2d texture: height
MapCubemap, ## Shader location: samplerCube texture: cubemap
MapIrradiance, ## Shader location: samplerCube texture: irradiance
MapPrefilter, ## Shader location: samplerCube texture: prefilter
MapBrdf, ## Shader location: sampler2d texture: brdf
VertexBoneids, ## Shader location: vertex attribute: boneIds
VertexBoneweights, ## Shader location: vertex attribute: boneWeights
BoneMatrices ## Shader location: array of matrices uniform: boneMatrices |
Shader location index |
BlendMode {.size: 4.} = enum
Alpha, ## Blend textures considering alpha (default)
Additive, ## Blend textures adding colors
Multiplied, ## Blend textures multiplying colors
AddColors, ## Blend textures adding colors (alternative)
SubtractColors, ## Blend textures subtracting colors (alternative)
AlphaPremultiply, ## Blend premultiplied textures considering alpha
Custom, ## Blend textures using custom src/dst factors (use rlSetBlendFactors())
CustomSeparate ## Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate()) |
Color blending modes (pre-defined) |
Color {.importc, header: "raylib.h", completeStruct, bycopy.} = object
r*: uint8 ## Color red value
g*: uint8 ## Color green value
b*: uint8 ## Color blue value
a*: uint8 ## Color alpha value
|
Color, 4 components, R8G8B8A8 (32bit) |
RenderTexture {.importc, header: "raylib.h", completeStruct, bycopy.} = object
id*: uint32 ## OpenGL framebuffer object id
texture*: Texture ## Color buffer attachment texture
depth*: Texture ## Depth buffer attachment texture
|
RenderTexture, fbo for texture rendering |
MaterialMap {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Material map texture
color*: Color ## Material map color
value*: float32 ## Material map value
|
MaterialMap |
proc clearBackground(color: Color) {.importc: "ClearBackground", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Set background color (framebuffer clear color) |
proc drawPixel(posX: int32; posY: int32; color: Color) {.importc: "DrawPixel",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a pixel using geometry Can be slow, use with care |
proc drawPixel(position: Vector2; color: Color) {.importc: "DrawPixelV",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a pixel using geometry (Vector version) Can be slow, use with care |
proc drawLine(startPosX: int32; startPosY: int32; endPosX: int32;
endPosY: int32; color: Color) {.importc: "DrawLine", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a line |
proc drawLine(startPos: Vector2; endPos: Vector2; color: Color) {.
importc: "DrawLineV", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line (using gl lines) |
proc drawLine(startPos: Vector2; endPos: Vector2; thick: float32; color: Color) {.
importc: "DrawLineEx", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line (using triangles/quads) |
proc drawLineBezier(startPos: Vector2; endPos: Vector2; thick: float32;
color: Color) {.importc: "DrawLineBezier", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line segment cubic-bezier in-out interpolation |
proc drawCircle(centerX: int32; centerY: int32; radius: float32; color: Color) {.
importc: "DrawCircle", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled circle |
proc drawCircleSector(center: Vector2; radius: float32; startAngle: float32;
endAngle: float32; segments: int32; color: Color) {.
importc: "DrawCircleSector", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a piece of a circle |
proc drawCircleSectorLines(center: Vector2; radius: float32;
startAngle: float32; endAngle: float32;
segments: int32; color: Color) {.
importc: "DrawCircleSectorLines", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw circle sector outline |
proc drawCircleGradient(centerX: int32; centerY: int32; radius: float32;
inner: Color; outer: Color) {.
importc: "DrawCircleGradient", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a gradient-filled circle |
proc drawCircle(center: Vector2; radius: float32; color: Color) {.
importc: "DrawCircleV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled circle (Vector version) |
proc drawCircleLines(centerX: int32; centerY: int32; radius: float32;
color: Color) {.importc: "DrawCircleLines", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw circle outline |
proc drawCircleLines(center: Vector2; radius: float32; color: Color) {.
importc: "DrawCircleLinesV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw circle outline (Vector version) |
proc drawEllipse(centerX: int32; centerY: int32; radiusH: float32;
radiusV: float32; color: Color) {.importc: "DrawEllipse",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw ellipse |
proc drawEllipseLines(centerX: int32; centerY: int32; radiusH: float32;
radiusV: float32; color: Color) {.
importc: "DrawEllipseLines", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw ellipse outline |
proc drawRing(center: Vector2; innerRadius: float32; outerRadius: float32;
startAngle: float32; endAngle: float32; segments: int32;
color: Color) {.importc: "DrawRing", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw ring |
proc drawRingLines(center: Vector2; innerRadius: float32; outerRadius: float32;
startAngle: float32; endAngle: float32; segments: int32;
color: Color) {.importc: "DrawRingLines", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw ring outline |
proc drawRectangle(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangle", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(position: Vector2; size: Vector2; color: Color) {.
importc: "DrawRectangleV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled rectangle (Vector version) |
proc drawRectangle(rec: Rectangle; color: Color) {.importc: "DrawRectangleRec",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(rec: Rectangle; origin: Vector2; rotation: float32;
color: Color) {.importc: "DrawRectanglePro", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle with pro parameters |
proc drawRectangleGradientV(posX: int32; posY: int32; width: int32;
height: int32; top: Color; bottom: Color) {.
importc: "DrawRectangleGradientV", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a vertical-gradient-filled rectangle |
proc drawRectangleGradientH(posX: int32; posY: int32; width: int32;
height: int32; left: Color; right: Color) {.
importc: "DrawRectangleGradientH", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a horizontal-gradient-filled rectangle |
proc drawRectangleGradient(rec: Rectangle; topLeft: Color; bottomLeft: Color;
topRight: Color; bottomRight: Color) {.
importc: "DrawRectangleGradientEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a gradient-filled rectangle with custom vertex colors |
proc drawRectangleLines(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangleLines",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle outline |
proc drawRectangleLines(rec: Rectangle; lineThick: float32; color: Color) {.
importc: "DrawRectangleLinesEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle outline with extended parameters |
proc drawRectangleRounded(rec: Rectangle; roundness: float32; segments: int32;
color: Color) {.importc: "DrawRectangleRounded",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; color: Color) {.
importc: "DrawRectangleRoundedLines", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle lines with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; lineThick: float32; color: Color) {.
importc: "DrawRectangleRoundedLinesEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges outline |
proc drawTriangle(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.
importc: "DrawTriangle", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled triangle (vertex in counter-clockwise order!) |
proc drawTriangleLines(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.
importc: "DrawTriangleLines", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw triangle outline (vertex in counter-clockwise order!) |
proc drawPoly(center: Vector2; sides: int32; radius: float32; rotation: float32;
color: Color) {.importc: "DrawPoly", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a regular polygon (Vector version) |
proc drawPolyLines(center: Vector2; sides: int32; radius: float32;
rotation: float32; color: Color) {.importc: "DrawPolyLines",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a polygon outline of n sides |
proc drawPolyLines(center: Vector2; sides: int32; radius: float32;
rotation: float32; lineThick: float32; color: Color) {.
importc: "DrawPolyLinesEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a polygon outline of n sides with extended parameters |
proc drawSplineSegmentLinear(p1: Vector2; p2: Vector2; thick: float32;
color: Color) {.importc: "DrawSplineSegmentLinear",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw spline segment: Linear, 2 points |
proc drawSplineSegmentBasis(p1: Vector2; p2: Vector2; p3: Vector2; p4: Vector2;
thick: float32; color: Color) {.
importc: "DrawSplineSegmentBasis", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: B-Spline, 4 points |
proc drawSplineSegmentCatmullRom(p1: Vector2; p2: Vector2; p3: Vector2;
p4: Vector2; thick: float32; color: Color) {.
importc: "DrawSplineSegmentCatmullRom", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Catmull-Rom, 4 points |
proc drawSplineSegmentBezierQuadratic(p1: Vector2; c2: Vector2; p3: Vector2;
thick: float32; color: Color) {.
importc: "DrawSplineSegmentBezierQuadratic", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Quadratic Bezier, 2 points, 1 control point |
proc drawSplineSegmentBezierCubic(p1: Vector2; c2: Vector2; c3: Vector2;
p4: Vector2; thick: float32; color: Color) {.
importc: "DrawSplineSegmentBezierCubic", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw spline segment: Cubic Bezier, 2 points, 2 control points |
func genImageColor(width: int32; height: int32; color: Color): Image {.
importc: "GenImageColor", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: plain color |
func genImageGradientLinear(width: int32; height: int32; direction: int32;
start: Color; end: Color): Image {.
importc: "GenImageGradientLinear", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: linear gradient, direction in degrees 0..360, 0=Vertical gradient |
func genImageGradientRadial(width: int32; height: int32; density: float32;
inner: Color; outer: Color): Image {.
importc: "GenImageGradientRadial", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: radial gradient |
func genImageGradientSquare(width: int32; height: int32; density: float32;
inner: Color; outer: Color): Image {.
importc: "GenImageGradientSquare", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: square gradient |
func genImageChecked(width: int32; height: int32; checksX: int32;
checksY: int32; col1: Color; col2: Color): Image {.
importc: "GenImageChecked", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Generate image: checked |
func imageToPOT(image: var Image; fill: Color) {.importc: "ImageToPOT",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Convert image to POT (power-of-two) |
func imageAlphaClear(image: var Image; color: Color; threshold: float32) {.
importc: "ImageAlphaClear", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Clear alpha channel to desired color |
func imageResizeCanvas(image: var Image; newWidth: int32; newHeight: int32;
offsetX: int32; offsetY: int32; fill: Color) {.
importc: "ImageResizeCanvas", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resize canvas and fill with color |
func imageColorTint(image: var Image; color: Color) {.importc: "ImageColorTint",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: tint |
func imageColorInvert(image: var Image) {.importc: "ImageColorInvert",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: invert |
func imageColorGrayscale(image: var Image) {.importc: "ImageColorGrayscale",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Modify image color: grayscale |
func imageColorContrast(image: var Image; contrast: float32) {.
importc: "ImageColorContrast", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: contrast (-100 to 100) |
func imageColorBrightness(image: var Image; brightness: int32) {.
importc: "ImageColorBrightness", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: brightness (-255 to 255) |
func imageColorReplace(image: var Image; color: Color; replace: Color) {.
importc: "ImageColorReplace", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Modify image color: replace color |
func getImageColor(image: Image; x: int32; y: int32): Color {.
importc: "GetImageColor", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get image pixel color at (x, y) position |
func imageClearBackground(dst: var Image; color: Color) {.
importc: "ImageClearBackground", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Clear image background with given color |
func imageDrawPixel(dst: var Image; posX: int32; posY: int32; color: Color) {.
importc: "ImageDrawPixel", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image |
func imageDrawPixel(dst: var Image; position: Vector2; color: Color) {.
importc: "ImageDrawPixelV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw pixel within an image (Vector version) |
func imageDrawLine(dst: var Image; startPosX: int32; startPosY: int32;
endPosX: int32; endPosY: int32; color: Color) {.
importc: "ImageDrawLine", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; color: Color) {.
importc: "ImageDrawLineV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw line within an image (Vector version) |
func imageDrawLine(dst: var Image; start: Vector2; end: Vector2; thick: int32;
color: Color) {.importc: "ImageDrawLineEx",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line defining thickness within an image |
func imageDrawCircle(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.importc: "ImageDrawCircle",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a filled circle within an image |
func imageDrawCircle(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleV",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a filled circle within an image (Vector version) |
func imageDrawCircleLines(dst: var Image; centerX: int32; centerY: int32;
radius: int32; color: Color) {.
importc: "ImageDrawCircleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw circle outline within an image |
func imageDrawCircleLines(dst: var Image; center: Vector2; radius: int32;
color: Color) {.importc: "ImageDrawCircleLinesV",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw circle outline within an image (Vector version) |
func imageDrawRectangle(dst: var Image; posX: int32; posY: int32; width: int32;
height: int32; color: Color) {.
importc: "ImageDrawRectangle", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangle(dst: var Image; position: Vector2; size: Vector2;
color: Color) {.importc: "ImageDrawRectangleV",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle within an image (Vector version) |
func imageDrawRectangle(dst: var Image; rec: Rectangle; color: Color) {.
importc: "ImageDrawRectangleRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangleLines(dst: var Image; rec: Rectangle; thick: int32;
color: Color) {.importc: "ImageDrawRectangleLines",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle lines within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
color: Color) {.importc: "ImageDrawTriangle",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle within an image |
func imageDrawTriangle(dst: var Image; v1: Vector2; v2: Vector2; v3: Vector2;
c1: Color; c2: Color; c3: Color) {.
importc: "ImageDrawTriangleEx", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle with interpolated colors within an image |
func imageDrawTriangleLines(dst: var Image; v1: Vector2; v2: Vector2;
v3: Vector2; color: Color) {.
importc: "ImageDrawTriangleLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw triangle outline within an image |
func imageDraw(dst: var Image; src: Image; srcRec: Rectangle; dstRec: Rectangle;
tint: Color) {.importc: "ImageDraw", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a source image within a destination image (tint applied to source) |
proc drawTexture(texture: Texture2D; posX: int32; posY: int32; tint: Color) {.
importc: "DrawTexture", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D |
proc drawTexture(texture: Texture2D; position: Vector2; tint: Color) {.
importc: "DrawTextureV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a Texture2D with position defined as Vector2 |
proc drawTexture(texture: Texture2D; position: Vector2; rotation: float32;
scale: float32; tint: Color) {.importc: "DrawTextureEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a Texture2D with extended parameters |
proc drawTexture(texture: Texture2D; source: Rectangle; position: Vector2;
tint: Color) {.importc: "DrawTextureRec", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a part of a texture defined by a rectangle |
proc drawTexture(texture: Texture2D; source: Rectangle; dest: Rectangle;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawTexturePro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a part of a texture defined by a rectangle with 'pro' parameters |
proc drawTextureNPatch(texture: Texture2D; nPatchInfo: NPatchInfo;
dest: Rectangle; origin: Vector2; rotation: float32;
tint: Color) {.importc: "DrawTextureNPatch", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draws a texture (or part of it) that stretches or shrinks nicely |
func colorNormalize(color: Color): Vector4 {.importc: "ColorNormalize",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get Color normalized as float 0..1 |
func colorFromNormalized(normalized: Vector4): Color {.
importc: "ColorFromNormalized", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get Color from normalized values 0..1 |
func colorToHSV(color: Color): Vector3 {.importc: "ColorToHSV",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get HSV values for a Color, hue 0..360, saturation/value 0..1 |
func colorFromHSV(hue: float32; saturation: float32; value: float32): Color {.
importc: "ColorFromHSV", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get a Color from HSV values, hue 0..360, saturation/value 0..1 |
func colorTint(color: Color; tint: Color): Color {.importc: "ColorTint",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get color multiplied with another color |
func colorBrightness(color: Color; factor: float32): Color {.
importc: "ColorBrightness", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get color with brightness correction, brightness factor goes from -1.0f to 1.0f |
func colorContrast(color: Color; contrast: float32): Color {.
importc: "ColorContrast", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get color with contrast correction, contrast values between -1.0f and 1.0f |
func colorAlpha(color: Color; alpha: float32): Color {.importc: "ColorAlpha",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get color with alpha applied, alpha goes from 0.0f to 1.0f |
func colorAlphaBlend(dst: Color; src: Color; tint: Color): Color {.
importc: "ColorAlphaBlend", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get src alpha-blended into dst color with tint |
func colorLerp(color1: Color; color2: Color; factor: float32): Color {.
importc: "ColorLerp", header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get color lerp interpolation between two colors, factor 0.0f..1.0f |
proc drawTextCodepoint(font: Font; codepoint: Rune; position: Vector2;
fontSize: float32; tint: Color) {.
importc: "DrawTextCodepoint", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw one character (codepoint) |
proc drawLine3D(startPos: Vector3; endPos: Vector3; color: Color) {.
importc: "DrawLine3D", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a line in 3D world space |
proc drawPoint3D(position: Vector3; color: Color) {.importc: "DrawPoint3D",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a point in 3D space, actually a small line |
proc drawCircle3D(center: Vector3; radius: float32; rotationAxis: Vector3;
rotationAngle: float32; color: Color) {.
importc: "DrawCircle3D", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a circle in 3D world space |
proc drawTriangle3D(v1: Vector3; v2: Vector3; v3: Vector3; color: Color) {.
importc: "DrawTriangle3D", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled triangle (vertex in counter-clockwise order!) |
proc drawCube(position: Vector3; width: float32; height: float32;
length: float32; color: Color) {.importc: "DrawCube", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw cube |
proc drawCube(position: Vector3; size: Vector3; color: Color) {.
importc: "DrawCubeV", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw cube (Vector version) |
proc drawCubeWires(position: Vector3; width: float32; height: float32;
length: float32; color: Color) {.importc: "DrawCubeWires",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw cube wires |
proc drawCubeWires(position: Vector3; size: Vector3; color: Color) {.
importc: "DrawCubeWiresV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw cube wires (Vector version) |
proc drawSphere(centerPos: Vector3; radius: float32; color: Color) {.
importc: "DrawSphere", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw sphere |
proc drawSphere(centerPos: Vector3; radius: float32; rings: int32;
slices: int32; color: Color) {.importc: "DrawSphereEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw sphere with extended parameters |
proc drawSphereWires(centerPos: Vector3; radius: float32; rings: int32;
slices: int32; color: Color) {.importc: "DrawSphereWires",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw sphere wires |
proc drawCylinder(position: Vector3; radiusTop: float32; radiusBottom: float32;
height: float32; slices: int32; color: Color) {.
importc: "DrawCylinder", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder/cone |
proc drawCylinder(startPos: Vector3; endPos: Vector3; startRadius: float32;
endRadius: float32; sides: int32; color: Color) {.
importc: "DrawCylinderEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder with base at startPos and top at endPos |
proc drawCylinderWires(position: Vector3; radiusTop: float32;
radiusBottom: float32; height: float32; slices: int32;
color: Color) {.importc: "DrawCylinderWires", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a cylinder/cone wires |
proc drawCylinderWires(startPos: Vector3; endPos: Vector3; startRadius: float32;
endRadius: float32; sides: int32; color: Color) {.
importc: "DrawCylinderWiresEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a cylinder wires with base at startPos and top at endPos |
proc drawCapsule(startPos: Vector3; endPos: Vector3; radius: float32;
slices: int32; rings: int32; color: Color) {.
importc: "DrawCapsule", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a capsule with the center of its sphere caps at startPos and endPos |
proc drawCapsuleWires(startPos: Vector3; endPos: Vector3; radius: float32;
slices: int32; rings: int32; color: Color) {.
importc: "DrawCapsuleWires", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw capsule wireframe with the center of its sphere caps at startPos and endPos |
proc drawPlane(centerPos: Vector3; size: Vector2; color: Color) {.
importc: "DrawPlane", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a plane XZ |
proc drawRay(ray: Ray; color: Color) {.importc: "DrawRay", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a ray line |
proc drawModel(model: Model; position: Vector3; scale: float32; tint: Color) {.
importc: "DrawModel", sideEffect, header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a model (with texture if set) |
proc drawModel(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model with extended parameters |
proc drawModelWires(model: Model; position: Vector3; scale: float32; tint: Color) {.
importc: "DrawModelWires", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model wires (with texture if set) |
proc drawModelWires(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelWiresEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model wires (with texture if set) with extended parameters |
proc drawModelPoints(model: Model; position: Vector3; scale: float32;
tint: Color) {.importc: "DrawModelPoints", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a model as points |
proc drawModelPoints(model: Model; position: Vector3; rotationAxis: Vector3;
rotationAngle: float32; scale: Vector3; tint: Color) {.
importc: "DrawModelPointsEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a model as points with extended parameters |
proc drawBoundingBox(box: BoundingBox; color: Color) {.
importc: "DrawBoundingBox", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw bounding box (wires) |
proc drawBillboard(camera: Camera; texture: Texture2D; position: Vector3;
scale: float32; tint: Color) {.importc: "DrawBillboard",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a billboard texture |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; size: Vector2; tint: Color) {.
importc: "DrawBillboardRec", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; up: Vector3; size: Vector2;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawBillboardPro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source and rotation |
proc drawLineStrip(points: openArray[Vector2]; color: Color) {.raises: [],
tags: [], forbids: [].} |
Draw lines sequence (using gl lines) |
proc drawTriangleFan(points: openArray[Vector2]; color: Color) {.raises: [],
tags: [], forbids: [].} |
Draw a triangle fan defined by points (first vertex is the center) |
proc drawTriangleStrip(points: openArray[Vector2]; color: Color) {.raises: [],
tags: [], forbids: [].} |
Draw a triangle strip defined by points |
proc drawSplineLinear(points: openArray[Vector2]; thick: float32; color: Color) {.
raises: [], tags: [], forbids: [].} |
Draw spline: Linear, minimum 2 points |
proc drawSplineBasis(points: openArray[Vector2]; thick: float32; color: Color) {.
raises: [], tags: [], forbids: [].} |
Draw spline: B-Spline, minimum 4 points |
proc drawSplineCatmullRom(points: openArray[Vector2]; thick: float32;
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw spline: Catmull-Rom, minimum 4 points |
proc drawSplineBezierQuadratic(points: openArray[Vector2]; thick: float32;
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw spline: Quadratic Bezier, minimum 3 points (1 control point): p1, c2, p3, c4... |
proc drawSplineBezierCubic(points: openArray[Vector2]; thick: float32;
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw spline: Cubic Bezier, minimum 4 points (2 control points): p1, c2, c3, p4, c5, c6... |
proc imageText(text: string; fontSize: int32; color: Color): Image {.raises: [],
tags: [], forbids: [].} |
Create an image from text (default font) |
proc imageText(font: Font; text: string; fontSize: float32; spacing: float32;
tint: Color): Image {.raises: [], tags: [], forbids: [].} |
Create an image from text (custom sprite font) |
proc imageDrawTriangleFan(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle fan defined by points within an image (first vertex is the center) |
proc imageDrawTriangleStrip(dst: var Image; points: openArray[Vector2];
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw a triangle strip defined by points within an image |
proc imageDrawText(dst: var Image; text: string; posX: int32; posY: int32;
fontSize: int32; color: Color) {.raises: [], tags: [],
forbids: [].} |
Draw text (using default font) within an image (destination) |
proc imageDrawText(dst: var Image; font: Font; text: string; position: Vector2;
fontSize: float32; spacing: float32; tint: Color) {.
raises: [], tags: [], forbids: [].} |
Draw text (custom sprite font) within an image (destination) |
proc drawText(text: string; posX: int32; posY: int32; fontSize: int32;
color: Color) {.raises: [], tags: [], forbids: [].} |
Draw text (using default font) |
proc drawText(font: Font; text: string; position: Vector2; fontSize: float32;
spacing: float32; tint: Color) {.raises: [], tags: [], forbids: [].} |
Draw text using font and additional parameters |
proc drawText(font: Font; text: string; position: Vector2; origin: Vector2;
rotation: float32; fontSize: float32; spacing: float32;
tint: Color) {.raises: [], tags: [], forbids: [].} |
Draw text using Font and pro parameters (rotation) |
proc drawTriangleStrip3D(points: openArray[Vector3]; color: Color) {.raises: [],
tags: [], forbids: [].} |
Draw a triangle strip defined by points |
proc loadImageColors(image: Image): RArray[Color] {.raises: [], tags: [],
forbids: [].} |
Load color data from image as a Color array (RGBA - 32bit) |
proc loadImagePalette(image: Image; maxPaletteSize: int32): RArray[Color] {.
raises: [], tags: [], forbids: [].} |
Load colors palette from image as a Color array (RGBA - 32bit) |
template toColorArray(a: openArray[byte]): untyped |
Note: that a should be properly formatted, with a byte representation that aligns with the memory layout of the Color type. |
proc getPixelColor[T: Pixel](pixel: T): Color |
Get Color from a source pixel pointer of certain format |
proc setPixelColor[T: Pixel](pixel: var T; color: Color) |
Set color formatted into destination pixel pointer |
proc loadFontFromImage(image: Image; key: Color; firstChar: int32): Font {.
raises: [RaylibError], tags: [], forbids: [].} |
Load font from Image (XNA style) |
proc drawTextCodepoints(font: Font; codepoints: openArray[Rune];
position: Vector2; fontSize: float32; spacing: float32;
tint: Color) {.raises: [], tags: [], forbids: [].} |
Draw multiple character (codepoint) |
proc fade(color: Color; alpha: float32): Color {.raises: [], tags: [],
forbids: [].} |
Get color with alpha applied, alpha goes from 0.0 to 1.0 |
proc colorToInt(color: Color): int32 {.raises: [], tags: [], forbids: [].} |
Get hexadecimal value for a Color |
proc getColor(hexValue: uint32): Color {.raises: [], tags: [], forbids: [].} |
Get Color structure from hexadecimal value |
Function | Description |
---|---|
Rectangle {.importc: "rlRectangle", header: "raylib.h", completeStruct, bycopy.} = object
x*: float32 ## Rectangle top-left corner position x
y*: float32 ## Rectangle top-left corner position y
width*: float32 ## Rectangle width
height*: float32 ## Rectangle height
|
Rectangle, 4 components |
NPatchInfo {.importc, header: "raylib.h", completeStruct, bycopy.} = object
source*: Rectangle ## Texture source rectangle
left*: int32 ## Left border offset
top*: int32 ## Top border offset
right*: int32 ## Right border offset
bottom*: int32 ## Bottom border offset
layout*: NPatchLayout ## Layout of the n-patch: 3x3, 1x3 or 3x1
|
NPatchInfo, n-patch layout info |
Font {.importc, header: "raylib.h", completeStruct, bycopy.} = object
baseSize*: int32 ## Base size (default chars height)
## Number of glyph characters
glyphPadding*: int32 ## Padding around the glyph characters
texture*: Texture2D ## Texture atlas containing the glyphs
## Rectangles in texture for the glyphs
## Glyphs info data
|
Font, font texture and GlyphInfo array data |
proc setShapesTexture(texture: Texture2D; source: Rectangle) {.
importc: "SetShapesTexture", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set texture and rectangle to be used on shapes drawing |
proc getShapesTextureRectangle(): Rectangle {.
importc: "GetShapesTextureRectangle", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get texture source rectangle that is used for shapes drawing |
proc drawRectangle(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangle", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(position: Vector2; size: Vector2; color: Color) {.
importc: "DrawRectangleV", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a color-filled rectangle (Vector version) |
proc drawRectangle(rec: Rectangle; color: Color) {.importc: "DrawRectangleRec",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw a color-filled rectangle |
proc drawRectangle(rec: Rectangle; origin: Vector2; rotation: float32;
color: Color) {.importc: "DrawRectanglePro", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a color-filled rectangle with pro parameters |
proc drawRectangleGradientV(posX: int32; posY: int32; width: int32;
height: int32; top: Color; bottom: Color) {.
importc: "DrawRectangleGradientV", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a vertical-gradient-filled rectangle |
proc drawRectangleGradientH(posX: int32; posY: int32; width: int32;
height: int32; left: Color; right: Color) {.
importc: "DrawRectangleGradientH", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a horizontal-gradient-filled rectangle |
proc drawRectangleGradient(rec: Rectangle; topLeft: Color; bottomLeft: Color;
topRight: Color; bottomRight: Color) {.
importc: "DrawRectangleGradientEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a gradient-filled rectangle with custom vertex colors |
proc drawRectangleLines(posX: int32; posY: int32; width: int32; height: int32;
color: Color) {.importc: "DrawRectangleLines",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle outline |
proc drawRectangleLines(rec: Rectangle; lineThick: float32; color: Color) {.
importc: "DrawRectangleLinesEx", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle outline with extended parameters |
proc drawRectangleRounded(rec: Rectangle; roundness: float32; segments: int32;
color: Color) {.importc: "DrawRectangleRounded",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; color: Color) {.
importc: "DrawRectangleRoundedLines", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle lines with rounded edges |
proc drawRectangleRoundedLines(rec: Rectangle; roundness: float32;
segments: int32; lineThick: float32; color: Color) {.
importc: "DrawRectangleRoundedLinesEx", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw rectangle with rounded edges outline |
func checkCollisionRecs(rec1: Rectangle; rec2: Rectangle): bool {.
importc: "CheckCollisionRecs", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check collision between two rectangles |
func checkCollisionCircleRec(center: Vector2; radius: float32; rec: Rectangle): bool {.
importc: "CheckCollisionCircleRec", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check collision between circle and rectangle |
func checkCollisionPointRec(point: Vector2; rec: Rectangle): bool {.
importc: "CheckCollisionPointRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if point is inside rectangle |
func getCollisionRec(rec1: Rectangle; rec2: Rectangle): Rectangle {.
importc: "GetCollisionRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get collision rectangle for two rectangles collision |
func imageFromImage(image: Image; rec: Rectangle): Image {.
importc: "ImageFromImage", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Create an image from another image piece |
func imageCrop(image: var Image; crop: Rectangle) {.importc: "ImageCrop",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Crop an image to a defined rectangle |
func getImageAlphaBorder(image: Image; threshold: float32): Rectangle {.
importc: "GetImageAlphaBorder", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get image alpha border rectangle |
func imageDrawRectangle(dst: var Image; posX: int32; posY: int32; width: int32;
height: int32; color: Color) {.
importc: "ImageDrawRectangle", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangle(dst: var Image; position: Vector2; size: Vector2;
color: Color) {.importc: "ImageDrawRectangleV",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw rectangle within an image (Vector version) |
func imageDrawRectangle(dst: var Image; rec: Rectangle; color: Color) {.
importc: "ImageDrawRectangleRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw rectangle within an image |
func imageDrawRectangleLines(dst: var Image; rec: Rectangle; thick: int32;
color: Color) {.importc: "ImageDrawRectangleLines",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Draw rectangle lines within an image |
func imageDraw(dst: var Image; src: Image; srcRec: Rectangle; dstRec: Rectangle;
tint: Color) {.importc: "ImageDraw", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Draw a source image within a destination image (tint applied to source) |
proc drawTexture(texture: Texture2D; source: Rectangle; position: Vector2;
tint: Color) {.importc: "DrawTextureRec", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draw a part of a texture defined by a rectangle |
proc drawTexture(texture: Texture2D; source: Rectangle; dest: Rectangle;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawTexturePro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a part of a texture defined by a rectangle with 'pro' parameters |
proc drawTextureNPatch(texture: Texture2D; nPatchInfo: NPatchInfo;
dest: Rectangle; origin: Vector2; rotation: float32;
tint: Color) {.importc: "DrawTextureNPatch", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Draws a texture (or part of it) that stretches or shrinks nicely |
func getGlyphAtlasRec(font: Font; codepoint: Rune): Rectangle {.
importc: "GetGlyphAtlasRec", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; size: Vector2; tint: Color) {.
importc: "DrawBillboardRec", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source |
proc drawBillboard(camera: Camera; texture: Texture2D; source: Rectangle;
position: Vector3; up: Vector3; size: Vector2;
origin: Vector2; rotation: float32; tint: Color) {.
importc: "DrawBillboardPro", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Draw a billboard texture defined by source and rotation |
proc updateTexture[T: Pixel](texture: Texture2D; rec: Rectangle;
pixels: openArray[T]) |
Update GPU texture rectangle with new data |
proc genImageFontAtlas(chars: openArray[GlyphInfo]; recs: out RArray[Rectangle];
fontSize: int32; padding: int32; packMethod: int32): Image {.
raises: [], tags: [], forbids: [].} |
Generate image font atlas using chars info |
Function | Description |
---|---|
MaxShaderLocations = 32 |
Maximum number of shader locations supported |
MaxMaterialMaps = 12 |
Maximum number of shader maps supported |
MaxMeshVertexBuffers = 9 |
Maximum vertex buffers (VBO) per mesh |
ConfigFlags {.size: 4.} = enum
FullscreenMode = 2, ## Set to run program in fullscreen
WindowResizable = 4, ## Set to allow resizable window
WindowUndecorated = 8, ## Set to disable window decoration (frame and buttons)
WindowTransparent = 16, ## Set to allow transparent framebuffer
Msaa4xHint = 32, ## Set to try enabling MSAA 4X
VsyncHint = 64, ## Set to try enabling V-Sync on GPU
WindowHidden = 128, ## Set to hide window
WindowAlwaysRun = 256, ## Set to allow windows running while minimized
WindowMinimized = 512, ## Set to minimize window (iconify)
WindowMaximized = 1024, ## Set to maximize window (expanded to monitor)
WindowUnfocused = 2048, ## Set to window non focused
WindowTopmost = 4096, ## Set to window always on top
WindowHighdpi = 8192, ## Set to support HighDPI
WindowMousePassthrough = 16384, ## Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
BorderlessWindowedMode = 32768, ## Set to run program in borderless windowed mode
InterlacedHint = 65536 ## Set to try enabling interlaced video format (for V3D) |
System/Window config flags |
TraceLogLevel {.size: 4.} = enum
All, ## Display all logs
Trace, ## Trace logging, intended for internal use only
Debug, ## Debug logging, used for internal debugging, it should be disabled on release builds
Info, ## Info logging, used for program execution info
Warning, ## Warning logging, used on recoverable failures
Error, ## Error logging, used on unrecoverable failures
Fatal, ## Fatal logging, used to abort program: exit(EXIT_FAILURE)
None ## Disable logging |
Trace log level |
KeyboardKey {.size: 4.} = enum
Null, ## Key: NULL, used for no key pressed
Back = 4, ## Key: Android back button
Menu, ## Key: Android menu button
VolumeUp = 24, ## Key: Android volume up button
VolumeDown, ## Key: Android volume down button
Space = 32, ## Key: Space
Apostrophe = 39, ## Key: '
Comma = 44, ## Key: ,
Minus, ## Key: -
Period, ## Key: .
Slash, ## Key: /
Zero, ## Key: 0
One, ## Key: 1
Two, ## Key: 2
Three, ## Key: 3
Four, ## Key: 4
Five, ## Key: 5
Six, ## Key: 6
Seven, ## Key: 7
Eight, ## Key: 8
Nine, ## Key: 9
Semicolon = 59, ## Key: ;
Equal = 61, ## Key: =
A = 65, ## Key: A | a
B, ## Key: B | b
C, ## Key: C | c
D, ## Key: D | d
E, ## Key: E | e
F, ## Key: F | f
G, ## Key: G | g
H, ## Key: H | h
I, ## Key: I | i
J, ## Key: J | j
K, ## Key: K | k
L, ## Key: L | l
M, ## Key: M | m
N, ## Key: N | n
O, ## Key: O | o
P, ## Key: P | p
Q, ## Key: Q | q
R, ## Key: R | r
S, ## Key: S | s
T, ## Key: T | t
U, ## Key: U | u
V, ## Key: V | v
W, ## Key: W | w
X, ## Key: X | x
Y, ## Key: Y | y
Z, ## Key: Z | z
LeftBracket, ## Key: [
Backslash, ## Key: '\'
RightBracket, ## Key: ]
Grave = 96, ## Key: `
Escape = 256, ## Key: Esc
Enter, ## Key: Enter
Tab, ## Key: Tab
Backspace, ## Key: Backspace
Insert, ## Key: Ins
Delete, ## Key: Del
Right, ## Key: Cursor right
Left, ## Key: Cursor left
Down, ## Key: Cursor down
Up, ## Key: Cursor up
PageUp, ## Key: Page up
PageDown, ## Key: Page down
Home, ## Key: Home
End, ## Key: End
CapsLock = 280, ## Key: Caps lock
ScrollLock, ## Key: Scroll down
NumLock, ## Key: Num lock
PrintScreen, ## Key: Print screen
Pause, ## Key: Pause
F1 = 290, ## Key: F1
F2, ## Key: F2
F3, ## Key: F3
F4, ## Key: F4
F5, ## Key: F5
F6, ## Key: F6
F7, ## Key: F7
F8, ## Key: F8
F9, ## Key: F9
F10, ## Key: F10
F11, ## Key: F11
F12, ## Key: F12
Kp0 = 320, ## Key: Keypad 0
Kp1, ## Key: Keypad 1
Kp2, ## Key: Keypad 2
Kp3, ## Key: Keypad 3
Kp4, ## Key: Keypad 4
Kp5, ## Key: Keypad 5
Kp6, ## Key: Keypad 6
Kp7, ## Key: Keypad 7
Kp8, ## Key: Keypad 8
Kp9, ## Key: Keypad 9
KpDecimal, ## Key: Keypad .
KpDivide, ## Key: Keypad /
KpMultiply, ## Key: Keypad *
KpSubtract, ## Key: Keypad -
KpAdd, ## Key: Keypad +
KpEnter, ## Key: Keypad Enter
KpEqual, ## Key: Keypad =
LeftShift = 340, ## Key: Shift left
LeftControl, ## Key: Control left
LeftAlt, ## Key: Alt left
LeftSuper, ## Key: Super left
RightShift, ## Key: Shift right
RightControl, ## Key: Control right
RightAlt, ## Key: Alt right
RightSuper, ## Key: Super right
KbMenu ## Key: KB menu |
Keyboard keys (US keyboard layout) |
MouseButton {.size: 4.} = enum
Left, ## Mouse button left
Right, ## Mouse button right
Middle, ## Mouse button middle (pressed wheel)
Side, ## Mouse button side (advanced mouse device)
Extra, ## Mouse button extra (advanced mouse device)
Forward, ## Mouse button forward (advanced mouse device)
Back ## Mouse button back (advanced mouse device) |
Mouse buttons |
MouseCursor {.size: 4.} = enum
Default, ## Default pointer shape
Arrow, ## Arrow shape
Ibeam, ## Text writing cursor shape
Crosshair, ## Cross shape
PointingHand, ## Pointing hand cursor
ResizeEw, ## Horizontal resize/move arrow shape
ResizeNs, ## Vertical resize/move arrow shape
ResizeNwse, ## Top-left to bottom-right diagonal resize/move arrow shape
ResizeNesw, ## The top-right to bottom-left diagonal resize/move arrow shape
ResizeAll, ## The omnidirectional resize/move cursor shape
NotAllowed ## The operation-not-allowed shape |
Mouse cursor |
GamepadButton {.size: 4.} = enum
Unknown, ## Unknown button, just for error checking
LeftFaceUp, ## Gamepad left DPAD up button
LeftFaceRight, ## Gamepad left DPAD right button
LeftFaceDown, ## Gamepad left DPAD down button
LeftFaceLeft, ## Gamepad left DPAD left button
RightFaceUp, ## Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
RightFaceRight, ## Gamepad right button right (i.e. PS3: Circle, Xbox: B)
RightFaceDown, ## Gamepad right button down (i.e. PS3: Cross, Xbox: A)
RightFaceLeft, ## Gamepad right button left (i.e. PS3: Square, Xbox: X)
LeftTrigger1, ## Gamepad top/back trigger left (first), it could be a trailing button
LeftTrigger2, ## Gamepad top/back trigger left (second), it could be a trailing button
RightTrigger1, ## Gamepad top/back trigger right (first), it could be a trailing button
RightTrigger2, ## Gamepad top/back trigger right (second), it could be a trailing button
MiddleLeft, ## Gamepad center buttons, left one (i.e. PS3: Select)
Middle, ## Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
MiddleRight, ## Gamepad center buttons, right one (i.e. PS3: Start)
LeftThumb, ## Gamepad joystick pressed button left
RightThumb ## Gamepad joystick pressed button right |
Gamepad buttons |
GamepadAxis {.size: 4.} = enum
LeftX, ## Gamepad left stick X axis
LeftY, ## Gamepad left stick Y axis
RightX, ## Gamepad right stick X axis
RightY, ## Gamepad right stick Y axis
LeftTrigger, ## Gamepad back trigger left, pressure level: [1..-1]
RightTrigger ## Gamepad back trigger right, pressure level: [1..-1] |
Gamepad axis |
MaterialMapIndex {.size: 4.} = enum
Albedo, ## Albedo material (same as: MATERIAL_MAP_DIFFUSE)
Metalness, ## Metalness material (same as: MATERIAL_MAP_SPECULAR)
Normal, ## Normal material
Roughness, ## Roughness material
Occlusion, ## Ambient occlusion material
Emission, ## Emission material
Height, ## Heightmap material
Cubemap, ## Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
Irradiance, ## Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
Prefilter, ## Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
Brdf ## Brdf material |
Material map index |
ShaderUniformDataType {.size: 4.} = enum
Float, ## Shader uniform type: float
Vec2, ## Shader uniform type: vec2 (2 float)
Vec3, ## Shader uniform type: vec3 (3 float)
Vec4, ## Shader uniform type: vec4 (4 float)
Int, ## Shader uniform type: int
Ivec2, ## Shader uniform type: ivec2 (2 int)
Ivec3, ## Shader uniform type: ivec3 (3 int)
Ivec4, ## Shader uniform type: ivec4 (4 int)
Sampler2d ## Shader uniform type: sampler2d |
Shader uniform data type |
ShaderAttributeDataType {.size: 4.} = enum
Float, ## Shader attribute type: float
Vec2, ## Shader attribute type: vec2 (2 float)
Vec3, ## Shader attribute type: vec3 (3 float)
Vec4 ## Shader attribute type: vec4 (4 float) |
Shader attribute data types |
PixelFormat {.size: 4.} = enum
UncompressedGrayscale = 1, ## 8 bit per pixel (no alpha)
UncompressedGrayAlpha, ## 8*2 bpp (2 channels)
UncompressedR5g6b5, ## 16 bpp
UncompressedR8g8b8, ## 24 bpp
UncompressedR5g5b5a1, ## 16 bpp (1 bit alpha)
UncompressedR4g4b4a4, ## 16 bpp (4 bit alpha)
UncompressedR8g8b8a8, ## 32 bpp
UncompressedR32, ## 32 bpp (1 channel - float)
UncompressedR32g32b32, ## 32*3 bpp (3 channels - float)
UncompressedR32g32b32a32, ## 32*4 bpp (4 channels - float)
UncompressedR16, ## 16 bpp (1 channel - half float)
UncompressedR16g16b16, ## 16*3 bpp (3 channels - half float)
UncompressedR16g16b16a16, ## 16*4 bpp (4 channels - half float)
CompressedDxt1Rgb, ## 4 bpp (no alpha)
CompressedDxt1Rgba, ## 4 bpp (1 bit alpha)
CompressedDxt3Rgba, ## 8 bpp
CompressedDxt5Rgba, ## 8 bpp
CompressedEtc1Rgb, ## 4 bpp
CompressedEtc2Rgb, ## 4 bpp
CompressedEtc2EacRgba, ## 8 bpp
CompressedPvrtRgb, ## 4 bpp
CompressedPvrtRgba, ## 4 bpp
CompressedAstc4x4Rgba, ## 8 bpp
CompressedAstc8x8Rgba ## 2 bpp |
Pixel formats |
CubemapLayout {.size: 4.} = enum
AutoDetect, ## Automatically detect layout type
LineVertical, ## Layout is defined by a vertical line with faces
LineHorizontal, ## Layout is defined by a horizontal line with faces
CrossThreeByFour, ## Layout is defined by a 3x4 cross with cubemap faces
CrossFourByThree ## Layout is defined by a 4x3 cross with cubemap faces |
Cubemap layouts |
FontType {.size: 4.} = enum
Default, ## Default font generation, anti-aliased
Bitmap, ## Bitmap font generation, no anti-aliasing
Sdf ## SDF font generation, requires external shader |
Font type, defines generation method |
Gesture {.size: 4.} = enum
None, ## No gesture
Tap, ## Tap gesture
Doubletap, ## Double tap gesture
Hold = 4, ## Hold gesture
Drag = 8, ## Drag gesture
SwipeRight = 16, ## Swipe right gesture
SwipeLeft = 32, ## Swipe left gesture
SwipeUp = 64, ## Swipe up gesture
SwipeDown = 128, ## Swipe down gesture
PinchIn = 256, ## Pinch in gesture
PinchOut = 512 ## Pinch out gesture |
Gesture |
CameraMode {.size: 4.} = enum
Custom, ## Camera custom, controlled by user (UpdateCamera() does nothing)
Free, ## Camera free mode
Orbital, ## Camera orbital, around target, zoom supported
FirstPerson, ## Camera first person
ThirdPerson ## Camera third person |
Camera system modes |
CameraProjection {.size: 4.} = enum
Perspective, ## Perspective projection
Orthographic ## Orthographic projection |
Camera projection |
NPatchLayout {.size: 4.} = enum
NinePatch, ## Npatch layout: 3x3 tiles
ThreePatchVertical, ## Npatch layout: 1x3 tiles
ThreePatchHorizontal ## Npatch layout: 3x1 tiles |
N-patch layout |
ShaderLocation = distinct int32 |
Shader location |
Vector2 {.importc, header: "raylib.h", completeStruct, bycopy.} = object
x*: float32 ## Vector x component
y*: float32 ## Vector y component
|
Vector2, 2 components |
Vector3 {.importc, header: "raylib.h", completeStruct, bycopy.} = object
x*: float32 ## Vector x component
y*: float32 ## Vector y component
z*: float32 ## Vector z component
|
Vector3, 3 components |
Vector4 {.importc, header: "raylib.h", completeStruct, bycopy.} = object
x*: float32 ## Vector x component
y*: float32 ## Vector y component
z*: float32 ## Vector z component
w*: float32 ## Vector w component
|
Vector4, 4 components |
Matrix {.importc, header: "raylib.h", completeStruct, bycopy.} = object
m0*, m4*, m8*, m12*: float32 ## Matrix first row (4 components)
m1*, m5*, m9*, m13*: float32 ## Matrix second row (4 components)
m2*, m6*, m10*, m14*: float32 ## Matrix third row (4 components)
m3*, m7*, m11*, m15*: float32 ## Matrix fourth row (4 components)
|
Matrix, 4x4 components, column major, OpenGL style, right-handed |
Camera3D {.importc, header: "raylib.h", completeStruct, bycopy.} = object
position*: Vector3 ## Camera position
target*: Vector3 ## Camera target it looks-at
up*: Vector3 ## Camera up vector (rotation over its axis)
fovy*: float32 ## Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
projection*: CameraProjection ## Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
Camera, defines position/orientation in 3d space |
Camera2D {.importc, header: "raylib.h", completeStruct, bycopy.} = object
offset*: Vector2 ## Camera offset (displacement from target)
target*: Vector2 ## Camera target (rotation and zoom origin)
rotation*: float32 ## Camera rotation in degrees
zoom*: float32 ## Camera zoom (scaling), should be 1.0f by default
|
Camera2D, defines position/orientation in 2d space |
Mesh {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Number of vertices stored in arrays
## Number of triangles stored (indexed or not)
## Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
## Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
## Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
## Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
## Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
## Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
## Vertex indices (in case vertex data comes indexed)
## Animated vertex positions (after bones transformations)
## Animated normals (after bones transformations)
## Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)
## Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)
## Bones animated transformation matrices
## Number of bones
vaoId*: uint32 ## OpenGL Vertex Array Object id
## OpenGL Vertex Buffer Objects id (default vertex data)
|
Mesh, vertex data and vao/vbo |
Shader {.importc, header: "raylib.h", completeStruct, bycopy.} = object
id*: uint32 ## Shader program id
## Shader locations array (RL_MAX_SHADER_LOCATIONS)
|
Shader |
Material {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Material shader
## Material maps array (MAX_MATERIAL_MAPS)
params*: array[4, float32] ## Material generic parameters (if required)
|
Material, includes shader and maps |
Transform {.importc, header: "raylib.h", completeStruct, bycopy.} = object
translation*: Vector3 ## Translation
rotation*: Quaternion ## Rotation
scale*: Vector3 ## Scale
|
Transform, vertex transformation data |
BoneInfo {.importc, header: "raylib.h", completeStruct, bycopy.} = object
name*: array[32, char] ## Bone name
parent*: int32 ## Bone parent
|
Bone, skeletal animation bone |
Model {.importc, header: "raylib.h", completeStruct, bycopy.} = object
transform*: Matrix ## Local transform matrix
## Number of meshes
## Number of materials
## Meshes array
## Materials array
## Mesh material number
## Number of bones
## Bones information (skeleton)
## Bones base transformation (pose)
|
Model, meshes, materials and animation data |
ModelAnimation {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Number of bones
## Number of animation frames
## Bones information (skeleton)
## Poses array by frame
name*: array[32, char] ## Animation name
|
ModelAnimation |
Ray {.importc, header: "raylib.h", completeStruct, bycopy.} = object
position*: Vector3 ## Ray position (origin)
direction*: Vector3 ## Ray direction (normalized)
|
Ray, ray for raycasting |
RayCollision {.importc, header: "raylib.h", completeStruct, bycopy.} = object
hit*: bool ## Did the ray hit something?
distance*: float32 ## Distance to the nearest hit
point*: Vector3 ## Point of the nearest hit
normal*: Vector3 ## Surface normal of hit
|
RayCollision, ray hit information |
BoundingBox {.importc, header: "raylib.h", completeStruct, bycopy.} = object
min*: Vector3 ## Minimum vertex box-corner
max*: Vector3 ## Maximum vertex box-corner
|
BoundingBox |
Wave {.importc, header: "raylib.h", completeStruct, bycopy.} = object
frameCount*: uint32 ## Total number of frames (considering channels)
sampleRate*: uint32 ## Frequency (samples per second)
sampleSize*: uint32 ## Bit depth (bits per sample): 8, 16, 32 (24 not supported)
channels*: uint32 ## Number of channels (1-mono, 2-stereo, ...)
data*: pointer ## Buffer data pointer
|
Wave, audio wave data |
AudioStream {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Pointer to internal data used by the audio system
## Pointer to internal data processor, useful for audio effects
sampleRate*: uint32 ## Frequency (samples per second)
sampleSize*: uint32 ## Bit depth (bits per sample): 8, 16, 32 (24 not supported)
channels*: uint32 ## Number of channels (1-mono, 2-stereo, ...)
|
AudioStream, custom audio stream |
Sound {.importc, header: "raylib.h", completeStruct, bycopy.} = object
stream*: AudioStream ## Audio stream
frameCount*: uint32 ## Total number of frames (considering channels)
|
Sound |
Music {.importc, header: "raylib.h", completeStruct, bycopy.} = object
stream*: AudioStream ## Audio stream
frameCount*: uint32 ## Total number of frames (considering channels)
looping*: bool ## Music looping enable
ctxType*: int32 ## Type of music context (audio filetype)
ctxData*: pointer ## Audio context data, depends on type
|
Music, audio stream, anything longer than ~10 seconds should be streamed |
VrDeviceInfo {.importc, header: "raylib.h", completeStruct, bycopy.} = object
hResolution*: int32 ## Horizontal resolution in pixels
vResolution*: int32 ## Vertical resolution in pixels
hScreenSize*: float32 ## Horizontal size in meters
vScreenSize*: float32 ## Vertical size in meters
eyeToScreenDistance*: float32 ## Distance between eye and display in meters
lensSeparationDistance*: float32 ## Lens separation distance in meters
interpupillaryDistance*: float32 ## IPD (distance between pupils) in meters
lensDistortionValues*: array[4, float32] ## Lens distortion constant parameters
chromaAbCorrection*: array[4, float32] ## Chromatic aberration correction parameters
|
VrDeviceInfo, Head-Mounted-Display device parameters |
VrStereoConfig {.importc, header: "raylib.h", completeStruct, bycopy.} = object
projection*: array[2, Matrix] ## VR projection matrices (per eye)
viewOffset*: array[2, Matrix] ## VR view offset matrices (per eye)
leftLensCenter*: array[2, float32] ## VR left lens center
rightLensCenter*: array[2, float32] ## VR right lens center
leftScreenCenter*: array[2, float32] ## VR left screen center
rightScreenCenter*: array[2, float32] ## VR right screen center
scale*: array[2, float32] ## VR distortion scale
scaleIn*: array[2, float32] ## VR distortion scale in
|
VrStereoConfig, VR stereo rendering configuration for simulator |
AutomationEvent {.importc, header: "raylib.h", completeStruct, bycopy.} = object
frame*: uint32 ## Event frame
## Event type (AutomationEventType)
params*: array[4, int32] ## Event parameters (if required)
|
Automation event |
AutomationEventList {.importc, header: "raylib.h", completeStruct, bycopy.} = object
## Events max entries (MAX_AUTOMATION_EVENTS)
## Events entries count
## Events entries
|
Automation event list |
Quaternion {.borrow: `.`.} = distinct Vector4 |
Quaternion, 4 components (Vector4 alias) |
Camera = Camera3D |
Camera type fallback, defaults to Camera3D |
LoadFileDataCallback = proc (fileName: ConstCstring; bytesRead: ptr uint32): ptr UncheckedArray[
uint8] {.cdecl.} |
FileIO: Load binary data |
SaveFileDataCallback = proc (fileName: ConstCstring; data: pointer;
bytesToWrite: uint32): bool {.cdecl.} |
FileIO: Save binary data |
LoadFileTextCallback = proc (fileName: ConstCstring): cstring {.cdecl.} |
FileIO: Load text data |
SaveFileTextCallback = proc (fileName: ConstCstring; text: cstring): bool {.
cdecl.} |
FileIO: Save text data |
AudioCallback = proc (bufferData: pointer; frames: uint32) {.cdecl.} |
Audio thread callback to request new data |
proc closeWindow() {.importc: "rlCloseWindow", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Close window and unload OpenGL context |
proc windowShouldClose(): bool {.importc: "WindowShouldClose", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) |
proc isWindowReady(): bool {.importc: "IsWindowReady", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window has been initialized successfully |
proc isWindowFullscreen(): bool {.importc: "IsWindowFullscreen", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window is currently fullscreen |
proc isWindowHidden(): bool {.importc: "IsWindowHidden", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window is currently hidden |
proc isWindowMinimized(): bool {.importc: "IsWindowMinimized", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window is currently minimized |
proc isWindowMaximized(): bool {.importc: "IsWindowMaximized", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window is currently maximized |
proc isWindowFocused(): bool {.importc: "IsWindowFocused", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window is currently focused |
proc isWindowResized(): bool {.importc: "IsWindowResized", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if window has been resized last frame |
proc isWindowState(flag: ConfigFlags): bool {.importc: "IsWindowState",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if one specific window flag is enabled |
proc setWindowState(flags: Flags[ConfigFlags]) {.importc: "SetWindowState",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window configuration state using flags |
proc clearWindowState(flags: Flags[ConfigFlags]) {.importc: "ClearWindowState",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Clear window configuration state flags |
proc toggleFullscreen() {.importc: "ToggleFullscreen", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Toggle window state: fullscreen/windowed, resizes monitor to match window resolution |
proc toggleBorderlessWindowed() {.importc: "ToggleBorderlessWindowed",
sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Toggle window state: borderless windowed, resizes window to match monitor resolution |
proc maximizeWindow() {.importc: "MaximizeWindow", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window state: maximized, if resizable |
proc minimizeWindow() {.importc: "MinimizeWindow", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window state: minimized, if resizable |
proc restoreWindow() {.importc: "RestoreWindow", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set window state: not minimized/maximized |
proc setWindowPosition(x: int32; y: int32) {.importc: "SetWindowPosition",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window position on screen |
proc setWindowMonitor(monitor: int32) {.importc: "SetWindowMonitor", sideEffect,
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set monitor for the current window |
proc setWindowMinSize(width: int32; height: int32) {.
importc: "SetWindowMinSize", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) |
proc setWindowMaxSize(width: int32; height: int32) {.
importc: "SetWindowMaxSize", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) |
proc setWindowSize(width: int32; height: int32) {.importc: "SetWindowSize",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window dimensions |
proc setWindowOpacity(opacity: float32) {.importc: "SetWindowOpacity",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window opacity 0.0f..1.0f |
proc setWindowFocused() {.importc: "SetWindowFocused", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set window focused |
proc getWindowHandle(): pointer {.importc: "GetWindowHandle", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get native window handle |
proc getScreenWidth(): int32 {.importc: "GetScreenWidth", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get current screen width |
proc getScreenHeight(): int32 {.importc: "GetScreenHeight", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get current screen height |
proc getRenderWidth(): int32 {.importc: "GetRenderWidth", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get current render width (it considers HiDPI) |
proc getRenderHeight(): int32 {.importc: "GetRenderHeight", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get current render height (it considers HiDPI) |
proc getMonitorCount(): int32 {.importc: "GetMonitorCount", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get number of connected monitors |
proc getCurrentMonitor(): int32 {.importc: "GetCurrentMonitor", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get current monitor where window is placed |
proc getMonitorPosition(monitor: int32): Vector2 {.
importc: "GetMonitorPosition", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get specified monitor position |
proc getMonitorWidth(monitor: int32): int32 {.importc: "GetMonitorWidth",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get specified monitor width (current video mode used by monitor) |
proc getMonitorHeight(monitor: int32): int32 {.importc: "GetMonitorHeight",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get specified monitor height (current video mode used by monitor) |
proc getMonitorPhysicalWidth(monitor: int32): int32 {.
importc: "GetMonitorPhysicalWidth", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get specified monitor physical width in millimetres |
proc getMonitorPhysicalHeight(monitor: int32): int32 {.
importc: "GetMonitorPhysicalHeight", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get specified monitor physical height in millimetres |
proc getMonitorRefreshRate(monitor: int32): int32 {.
importc: "GetMonitorRefreshRate", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get specified monitor refresh rate |
proc getWindowPosition(): Vector2 {.importc: "GetWindowPosition", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get window position XY on monitor |
proc getWindowScaleDPI(): Vector2 {.importc: "GetWindowScaleDPI", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get window scale DPI factor |
proc enableEventWaiting() {.importc: "EnableEventWaiting", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Enable waiting for events on EndDrawing(), no automatic event polling |
proc disableEventWaiting() {.importc: "DisableEventWaiting", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Disable waiting for events on EndDrawing(), automatic events polling |
proc showCursor() {.importc: "rlShowCursor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Shows cursor |
proc hideCursor() {.importc: "HideCursor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Hides cursor |
proc isCursorHidden(): bool {.importc: "IsCursorHidden", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if cursor is not visible |
proc enableCursor() {.importc: "EnableCursor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Enables cursor (unlock cursor) |
proc disableCursor() {.importc: "DisableCursor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Disables cursor (lock cursor) |
proc isCursorOnScreen(): bool {.importc: "IsCursorOnScreen", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if cursor is on the screen |
proc beginMode2D(camera: Camera2D) {.importc: "BeginMode2D", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Begin 2D mode with custom camera (2D) |
proc endMode2D() {.importc: "EndMode2D", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Ends 2D mode with custom camera |
proc beginMode3D(camera: Camera3D) {.importc: "BeginMode3D", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Begin 3D mode with custom camera (3D) |
proc endMode3D() {.importc: "EndMode3D", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Ends 3D mode and returns to default 2D orthographic mode |
proc beginShaderMode(shader: Shader) {.importc: "BeginShaderMode", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Begin custom shader drawing |
proc endShaderMode() {.importc: "EndShaderMode", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
End custom shader drawing (use default shader) |
proc beginBlendMode(mode: BlendMode) {.importc: "BeginBlendMode", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Begin blending mode (alpha, additive, multiplied, subtract, custom) |
proc endBlendMode() {.importc: "EndBlendMode", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
End blending mode (reset to default: alpha blending) |
proc beginScissorMode(x: int32; y: int32; width: int32; height: int32) {.
importc: "BeginScissorMode", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Begin scissor mode (define screen area for following drawing) |
proc endScissorMode() {.importc: "EndScissorMode", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
End scissor mode |
proc beginVrStereoMode(config: VrStereoConfig) {.importc: "BeginVrStereoMode",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Begin stereo rendering (requires VR simulator) |
proc endVrStereoMode() {.importc: "EndVrStereoMode", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
End stereo rendering (requires VR simulator) |
proc loadVrStereoConfig(device: VrDeviceInfo): VrStereoConfig {.
importc: "LoadVrStereoConfig", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Load VR stereo config for VR simulator device parameters |
func isShaderValid(shader: Shader): bool {.importc: "IsShaderValid",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a shader is valid (loaded on GPU) |
proc setShaderValueMatrix(shader: Shader; locIndex: ShaderLocation; mat: Matrix) {.
importc: "SetShaderValueMatrix", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set shader uniform value (matrix 4x4) |
proc getScreenToWorldRay(position: Vector2; camera: Camera): Ray {.
importc: "GetScreenToWorldRay", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get a ray trace from screen position (i.e mouse) |
proc getScreenToWorldRay(position: Vector2; camera: Camera; width: int32;
height: int32): Ray {.importc: "GetScreenToWorldRayEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get a ray trace from screen position (i.e mouse) in a viewport |
proc getWorldToScreen(position: Vector3; camera: Camera): Vector2 {.
importc: "GetWorldToScreen", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get the screen space position for a 3d world space position |
proc getWorldToScreen(position: Vector3; camera: Camera; width: int32;
height: int32): Vector2 {.importc: "GetWorldToScreenEx",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get size position for a 3d world space position |
func getWorldToScreen2D(position: Vector2; camera: Camera2D): Vector2 {.
importc: "GetWorldToScreen2D", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get the screen space position for a 2d camera world space position |
func getScreenToWorld2D(position: Vector2; camera: Camera2D): Vector2 {.
importc: "GetScreenToWorld2D", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get the world space position for a 2d camera screen space position |
func getCameraMatrix(camera: Camera): Matrix {.importc: "GetCameraMatrix",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get camera transform matrix (view matrix) |
func getCameraMatrix2D(camera: Camera2D): Matrix {.importc: "GetCameraMatrix2D",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get camera 2d transform matrix |
proc setTargetFPS(fps: int32) {.importc: "SetTargetFPS", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Set target FPS (maximum) |
proc getFrameTime(): float32 {.importc: "GetFrameTime", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get time in seconds for last frame drawn (delta time) |
proc getTime(): float64 {.importc: "GetTime", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get elapsed time in seconds since InitWindow() |
proc getFPS(): int32 {.importc: "GetFPS", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get current FPS |
proc swapScreenBuffer() {.importc: "SwapScreenBuffer", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Swap back buffer with front buffer (screen drawing) |
proc pollInputEvents() {.importc: "PollInputEvents", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Register all input events |
proc waitTime(seconds: float64) {.importc: "WaitTime", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Wait for some time (halt program execution) |
proc setConfigFlags(flags: Flags[ConfigFlags]) {.importc: "SetConfigFlags",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Setup init configuration flags (view FLAGS) |
proc traceLog(logLevel: TraceLogLevel; text: cstring) {.importc: "TraceLog",
varargs, sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) |
proc setTraceLogLevel(logLevel: TraceLogLevel) {.importc: "SetTraceLogLevel",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set the current threshold (minimum) log level |
proc setLoadFileDataCallback(callback: LoadFileDataCallback) {.
importc: "SetLoadFileDataCallback", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set custom file binary data loader |
proc setSaveFileDataCallback(callback: SaveFileDataCallback) {.
importc: "SetSaveFileDataCallback", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set custom file binary data saver |
proc setLoadFileTextCallback(callback: LoadFileTextCallback) {.
importc: "SetLoadFileTextCallback", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set custom file text data loader |
proc setSaveFileTextCallback(callback: SaveFileTextCallback) {.
importc: "SetSaveFileTextCallback", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set custom file text data saver |
proc isFileDropped(): bool {.importc: "IsFileDropped", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if a file has been dropped into window |
proc unloadAutomationEventList(list: AutomationEventList) {.
importc: "UnloadAutomationEventList", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Unload automation events list from file |
proc setAutomationEventList(list: var AutomationEventList) {.
importc: "SetAutomationEventList", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set automation event list to record to |
proc setAutomationEventBaseFrame(frame: int32) {.
importc: "SetAutomationEventBaseFrame", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Set automation event internal base frame to start recording |
proc startAutomationEventRecording() {.importc: "StartAutomationEventRecording",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Start recording automation events (AutomationEventList must be set) |
proc stopAutomationEventRecording() {.importc: "StopAutomationEventRecording",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Stop recording automation events |
proc playAutomationEvent(event: AutomationEvent) {.
importc: "PlayAutomationEvent", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Play a recorded automation event |
proc isKeyPressed(key: KeyboardKey): bool {.importc: "IsKeyPressed", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a key has been pressed once |
proc isKeyPressedRepeat(key: KeyboardKey): bool {.importc: "IsKeyPressedRepeat",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a key has been pressed again |
proc isKeyDown(key: KeyboardKey): bool {.importc: "IsKeyDown", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a key is being pressed |
proc isKeyReleased(key: KeyboardKey): bool {.importc: "IsKeyReleased",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a key has been released once |
proc isKeyUp(key: KeyboardKey): bool {.importc: "IsKeyUp", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if a key is NOT being pressed |
proc getKeyPressed(): KeyboardKey {.importc: "GetKeyPressed", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty |
proc getCharPressed(): int32 {.importc: "GetCharPressed", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty |
proc setExitKey(key: KeyboardKey) {.importc: "SetExitKey", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Set a custom key to exit program (default is ESC) |
proc isGamepadAvailable(gamepad: int32): bool {.importc: "IsGamepadAvailable",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a gamepad is available |
proc isGamepadButtonPressed(gamepad: int32; button: GamepadButton): bool {.
importc: "IsGamepadButtonPressed", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Check if a gamepad button has been pressed once |
proc isGamepadButtonDown(gamepad: int32; button: GamepadButton): bool {.
importc: "IsGamepadButtonDown", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if a gamepad button is being pressed |
proc isGamepadButtonReleased(gamepad: int32; button: GamepadButton): bool {.
importc: "IsGamepadButtonReleased", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Check if a gamepad button has been released once |
proc isGamepadButtonUp(gamepad: int32; button: GamepadButton): bool {.
importc: "IsGamepadButtonUp", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if a gamepad button is NOT being pressed |
proc getGamepadButtonPressed(): GamepadButton {.
importc: "GetGamepadButtonPressed", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get the last gamepad button pressed |
proc getGamepadAxisCount(gamepad: int32): int32 {.
importc: "GetGamepadAxisCount", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get gamepad axis count for a gamepad |
proc getGamepadAxisMovement(gamepad: int32; axis: GamepadAxis): float32 {.
importc: "GetGamepadAxisMovement", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get axis movement value for a gamepad axis |
proc setGamepadVibration(gamepad: int32; leftMotor: float32;
rightMotor: float32; duration: float32) {.
importc: "SetGamepadVibration", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set gamepad vibration for both motors (duration in seconds) |
proc isMouseButtonPressed(button: MouseButton): bool {.
importc: "IsMouseButtonPressed", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if a mouse button has been pressed once |
proc isMouseButtonDown(button: MouseButton): bool {.
importc: "IsMouseButtonDown", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if a mouse button is being pressed |
proc isMouseButtonReleased(button: MouseButton): bool {.
importc: "IsMouseButtonReleased", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Check if a mouse button has been released once |
proc isMouseButtonUp(button: MouseButton): bool {.importc: "IsMouseButtonUp",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a mouse button is NOT being pressed |
proc getMouseX(): int32 {.importc: "GetMouseX", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get mouse position X |
proc getMouseY(): int32 {.importc: "GetMouseY", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get mouse position Y |
proc getMousePosition(): Vector2 {.importc: "GetMousePosition", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get mouse position XY |
proc getMouseDelta(): Vector2 {.importc: "GetMouseDelta", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get mouse delta between frames |
proc setMousePosition(x: int32; y: int32) {.importc: "SetMousePosition",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set mouse position XY |
proc setMouseOffset(offsetX: int32; offsetY: int32) {.importc: "SetMouseOffset",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set mouse offset |
proc setMouseScale(scaleX: float32; scaleY: float32) {.importc: "SetMouseScale",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set mouse scaling |
proc getMouseWheelMove(): float32 {.importc: "GetMouseWheelMove", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get mouse wheel movement for X or Y, whichever is larger |
proc getMouseWheelMoveV(): Vector2 {.importc: "GetMouseWheelMoveV", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get mouse wheel movement for both X and Y |
proc setMouseCursor(cursor: MouseCursor) {.importc: "SetMouseCursor",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set mouse cursor |
proc getTouchX(): int32 {.importc: "GetTouchX", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get touch position X for touch point 0 (relative to screen size) |
proc getTouchY(): int32 {.importc: "GetTouchY", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get touch position Y for touch point 0 (relative to screen size) |
proc getTouchPosition(index: int32): Vector2 {.importc: "GetTouchPosition",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get touch position XY for a touch point index (relative to screen size) |
proc getTouchPointId(index: int32): int32 {.importc: "GetTouchPointId",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get touch point identifier for given index |
proc getTouchPointCount(): int32 {.importc: "GetTouchPointCount", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get number of touch points |
proc setGesturesEnabled(flags: Flags[Gesture]) {.importc: "SetGesturesEnabled",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Enable a set of gestures using flags |
proc isGestureDetected(gesture: Gesture): bool {.importc: "IsGestureDetected",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a gesture have been detected |
proc getGestureDetected(): Gesture {.importc: "GetGestureDetected", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get latest detected gesture |
proc getGestureHoldDuration(): float32 {.importc: "GetGestureHoldDuration",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get gesture hold time in seconds |
proc getGestureDragVector(): Vector2 {.importc: "GetGestureDragVector",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get gesture drag vector |
proc getGestureDragAngle(): float32 {.importc: "GetGestureDragAngle",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get gesture drag angle |
proc getGesturePinchVector(): Vector2 {.importc: "GetGesturePinchVector",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get gesture pinch delta |
proc getGesturePinchAngle(): float32 {.importc: "GetGesturePinchAngle",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Get gesture pinch angle |
proc updateCamera(camera: var Camera; mode: CameraMode) {.
importc: "UpdateCamera", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Update camera position for selected mode |
proc updateCamera(camera: var Camera; movement: Vector3; rotation: Vector3;
zoom: float32) {.importc: "UpdateCameraPro", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Update camera movement/rotation |
func getSplinePointLinear(startPos: Vector2; endPos: Vector2; t: float32): Vector2 {.
importc: "GetSplinePointLinear", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get (evaluate) spline point: Linear |
func getSplinePointBasis(p1: Vector2; p2: Vector2; p3: Vector2; p4: Vector2;
t: float32): Vector2 {.importc: "GetSplinePointBasis",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get (evaluate) spline point: B-Spline |
func getSplinePointCatmullRom(p1: Vector2; p2: Vector2; p3: Vector2;
p4: Vector2; t: float32): Vector2 {.
importc: "GetSplinePointCatmullRom", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get (evaluate) spline point: Catmull-Rom |
func getSplinePointBezierQuad(p1: Vector2; c2: Vector2; p3: Vector2; t: float32): Vector2 {.
importc: "GetSplinePointBezierQuad", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get (evaluate) spline point: Quadratic Bezier |
func getSplinePointBezierCubic(p1: Vector2; c2: Vector2; c3: Vector2;
p4: Vector2; t: float32): Vector2 {.
importc: "GetSplinePointBezierCubic", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get (evaluate) spline point: Cubic Bezier |
func checkCollisionCircles(center1: Vector2; radius1: float32; center2: Vector2;
radius2: float32): bool {.
importc: "CheckCollisionCircles", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check collision between two circles |
func checkCollisionCircleLine(center: Vector2; radius: float32; p1: Vector2;
p2: Vector2): bool {.
importc: "CheckCollisionCircleLine", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if circle collides with a line created betweeen two points p1 and p2 |
func checkCollisionPointCircle(point: Vector2; center: Vector2; radius: float32): bool {.
importc: "CheckCollisionPointCircle", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if point is inside circle |
func checkCollisionPointTriangle(point: Vector2; p1: Vector2; p2: Vector2;
p3: Vector2): bool {.
importc: "CheckCollisionPointTriangle", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if point is inside a triangle |
func checkCollisionPointLine(point: Vector2; p1: Vector2; p2: Vector2;
threshold: int32): bool {.
importc: "CheckCollisionPointLine", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if point belongs to line created between two points p1 and p2 with defined margin in pixels threshold |
func checkCollisionLines(startPos1: Vector2; endPos1: Vector2;
startPos2: Vector2; endPos2: Vector2;
collisionPoint: out Vector2): bool {.
importc: "CheckCollisionLines", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check the collision between two lines defined by two points each, returns collision point by reference |
func getPixelDataSize(width: int32; height: int32; format: PixelFormat): int32 {.
importc: "GetPixelDataSize", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get pixel data size in bytes for certain format |
proc getFontDefault(): Font {.importc: "GetFontDefault", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get the default Font |
func isFontValid(font: Font): bool {.importc: "IsFontValid", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Check if a font is valid (font data loaded, WARNING: GPU texture not checked) |
proc setTextLineSpacing(spacing: int32) {.importc: "SetTextLineSpacing",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set vertical line spacing when drawing with line-breaks |
func getGlyphIndex(font: Font; codepoint: Rune): int32 {.
importc: "GetGlyphIndex", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found |
func getGlyphInfo(font: Font; codepoint: Rune): GlyphInfo {.
importc: "GetGlyphInfo", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found |
func isModelValid(model: Model): bool {.importc: "IsModelValid",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if a model is valid (loaded in GPU, VAO/VBOs) |
proc getModelBoundingBox(model: Model): BoundingBox {.
importc: "GetModelBoundingBox", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Compute model bounding box limits (considers all meshes) |
proc uploadMesh(mesh: var Mesh; dynamic: bool) {.importc: "UploadMesh",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Upload mesh vertex data in GPU and provide VAO/VBO ids |
func getMeshBoundingBox(mesh: Mesh): BoundingBox {.
importc: "GetMeshBoundingBox", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Compute mesh bounding box limits |
proc genMeshTangents(mesh: var Mesh) {.importc: "GenMeshTangents", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Compute mesh tangents |
proc genMeshPoly(sides: int32; radius: float32): Mesh {.importc: "GenMeshPoly",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Generate polygonal mesh |
proc genMeshPlane(width: float32; length: float32; resX: int32; resZ: int32): Mesh {.
importc: "GenMeshPlane", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate plane mesh (with subdivisions) |
proc genMeshCube(width: float32; height: float32; length: float32): Mesh {.
importc: "GenMeshCube", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate cuboid mesh |
proc genMeshSphere(radius: float32; rings: int32; slices: int32): Mesh {.
importc: "GenMeshSphere", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate sphere mesh (standard sphere) |
proc genMeshHemiSphere(radius: float32; rings: int32; slices: int32): Mesh {.
importc: "GenMeshHemiSphere", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate half-sphere mesh (no bottom cap) |
proc genMeshCylinder(radius: float32; height: float32; slices: int32): Mesh {.
importc: "GenMeshCylinder", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate cylinder mesh |
proc genMeshCone(radius: float32; height: float32; slices: int32): Mesh {.
importc: "GenMeshCone", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate cone/pyramid mesh |
proc genMeshTorus(radius: float32; size: float32; radSeg: int32; sides: int32): Mesh {.
importc: "GenMeshTorus", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate torus mesh |
proc genMeshKnot(radius: float32; size: float32; radSeg: int32; sides: int32): Mesh {.
importc: "GenMeshKnot", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Generate trefoil knot mesh |
proc loadMaterialDefault(): Material {.importc: "LoadMaterialDefault",
sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) |
func isMaterialValid(material: Material): bool {.importc: "IsMaterialValid",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a material is valid (shader assigned, map textures loaded in GPU) |
proc updateModelAnimation(model: Model; anim: ModelAnimation; frame: int32) {.
importc: "UpdateModelAnimation", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Update model animation pose (CPU) |
func updateModelAnimationBones(model: Model; anim: ModelAnimation; frame: int32) {.
importc: "UpdateModelAnimationBones", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Update model animation mesh bone matrices (GPU skinning) |
func isModelAnimationValid(model: Model; anim: ModelAnimation): bool {.
importc: "IsModelAnimationValid", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check model animation skeleton match |
func checkCollisionSpheres(center1: Vector3; radius1: float32; center2: Vector3;
radius2: float32): bool {.
importc: "CheckCollisionSpheres", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check collision between two spheres |
func checkCollisionBoxes(box1: BoundingBox; box2: BoundingBox): bool {.
importc: "CheckCollisionBoxes", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check collision between two bounding boxes |
func checkCollisionBoxSphere(box: BoundingBox; center: Vector3; radius: float32): bool {.
importc: "CheckCollisionBoxSphere", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check collision between box and sphere |
func getRayCollisionSphere(ray: Ray; center: Vector3; radius: float32): RayCollision {.
importc: "GetRayCollisionSphere", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get collision info between ray and sphere |
func getRayCollisionBox(ray: Ray; box: BoundingBox): RayCollision {.
importc: "GetRayCollisionBox", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get collision info between ray and box |
func getRayCollisionMesh(ray: Ray; mesh: Mesh; transform: Matrix): RayCollision {.
importc: "GetRayCollisionMesh", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get collision info between ray and mesh |
func getRayCollisionTriangle(ray: Ray; p1: Vector3; p2: Vector3; p3: Vector3): RayCollision {.
importc: "GetRayCollisionTriangle", header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Get collision info between ray and triangle |
func getRayCollisionQuad(ray: Ray; p1: Vector3; p2: Vector3; p3: Vector3;
p4: Vector3): RayCollision {.
importc: "GetRayCollisionQuad", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get collision info between ray and quad |
proc initAudioDevice() {.importc: "InitAudioDevice", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Initialize audio device and context |
proc closeAudioDevice() {.importc: "CloseAudioDevice", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Close the audio device and context |
func isAudioDeviceReady(): bool {.importc: "IsAudioDeviceReady",
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Check if audio device has been initialized successfully |
proc setMasterVolume(volume: float32) {.importc: "SetMasterVolume", sideEffect,
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set master volume (listener) |
proc getMasterVolume(): float32 {.importc: "GetMasterVolume", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Get master volume (listener) |
func isWaveValid(wave: Wave): bool {.importc: "IsWaveValid", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Checks if wave data is valid (data loaded and parameters) |
func isSoundValid(sound: Sound): bool {.importc: "IsSoundValid",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Checks if a sound is valid (data loaded and buffers initialized) |
proc playSound(sound: Sound) {.importc: "PlaySound", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Play a sound |
proc stopSound(sound: Sound) {.importc: "StopSound", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Stop playing a sound |
proc pauseSound(sound: Sound) {.importc: "PauseSound", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Pause a sound |
proc resumeSound(sound: Sound) {.importc: "ResumeSound", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resume a paused sound |
proc isSoundPlaying(sound: Sound): bool {.importc: "IsSoundPlaying", sideEffect,
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if a sound is currently playing |
proc setSoundVolume(sound: Sound; volume: float32) {.importc: "SetSoundVolume",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set volume for a sound (1.0 is max level) |
proc setSoundPitch(sound: Sound; pitch: float32) {.importc: "SetSoundPitch",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set pitch for a sound (1.0 is base level) |
proc setSoundPan(sound: Sound; pan: float32) {.importc: "SetSoundPan",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set pan for a sound (0.5 is center) |
func waveCopy(wave: Wave): Wave {.importc: "WaveCopy", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Copy a wave to a new wave |
func waveCrop(wave: var Wave; initFrame: int32; finalFrame: int32) {.
importc: "WaveCrop", header: "raylib.h", raises: [], tags: [], forbids: [].} |
Crop a wave to defined frames range |
func waveFormat(wave: var Wave; sampleRate: int32; sampleSize: int32;
channels: int32) {.importc: "WaveFormat", header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Convert wave data to desired format |
func isMusicValid(music: Music): bool {.importc: "IsMusicValid",
header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Checks if a music stream is valid (context and buffers initialized) |
proc playMusicStream(music: Music) {.importc: "PlayMusicStream", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Start music playing |
proc isMusicStreamPlaying(music: Music): bool {.importc: "IsMusicStreamPlaying",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Check if music is playing |
proc updateMusicStream(music: Music) {.importc: "UpdateMusicStream", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Updates buffers for music streaming |
proc stopMusicStream(music: Music) {.importc: "StopMusicStream", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Stop music playing |
proc pauseMusicStream(music: Music) {.importc: "PauseMusicStream", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Pause music playing |
proc resumeMusicStream(music: Music) {.importc: "ResumeMusicStream", sideEffect,
header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Resume playing paused music |
proc seekMusicStream(music: Music; position: float32) {.
importc: "SeekMusicStream", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Seek music to a position (in seconds) |
proc setMusicVolume(music: Music; volume: float32) {.importc: "SetMusicVolume",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set volume for music (1.0 is max level) |
proc setMusicPitch(music: Music; pitch: float32) {.importc: "SetMusicPitch",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set pitch for a music (1.0 is base level) |
proc setMusicPan(music: Music; pan: float32) {.importc: "SetMusicPan",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Set pan for a music (0.5 is center) |
func getMusicTimeLength(music: Music): float32 {.importc: "GetMusicTimeLength",
header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get music time length (in seconds) |
proc getMusicTimePlayed(music: Music): float32 {.importc: "GetMusicTimePlayed",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Get current music time played (in seconds) |
func isAudioStreamValid(stream: AudioStream): bool {.
importc: "IsAudioStreamValid", header: "raylib.h", raises: [], tags: [],
forbids: [].} |
Checks if an audio stream is valid (buffers initialized) |
proc isAudioStreamProcessed(stream: AudioStream): bool {.
importc: "IsAudioStreamProcessed", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Check if any audio stream buffers requires refill |
proc playAudioStream(stream: AudioStream) {.importc: "PlayAudioStream",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Play audio stream |
proc pauseAudioStream(stream: AudioStream) {.importc: "PauseAudioStream",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Pause audio stream |
proc resumeAudioStream(stream: AudioStream) {.importc: "ResumeAudioStream",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Resume audio stream |
proc isAudioStreamPlaying(stream: AudioStream): bool {.
importc: "IsAudioStreamPlaying", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Check if audio stream is playing |
proc stopAudioStream(stream: AudioStream) {.importc: "StopAudioStream",
sideEffect, header: "raylib.h", raises: [], tags: [], forbids: [].} |
Stop audio stream |
proc setAudioStreamVolume(stream: AudioStream; volume: float32) {.
importc: "SetAudioStreamVolume", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set volume for audio stream (1.0 is max level) |
proc setAudioStreamPitch(stream: AudioStream; pitch: float32) {.
importc: "SetAudioStreamPitch", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set pitch for audio stream (1.0 is base level) |
proc setAudioStreamPan(stream: AudioStream; pan: float32) {.
importc: "SetAudioStreamPan", sideEffect, header: "raylib.h", raises: [],
tags: [], forbids: [].} |
Set pan for audio stream (0.5 is centered) |
proc setAudioStreamBufferSizeDefault(size: int32) {.
importc: "SetAudioStreamBufferSizeDefault", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Default size for new audio streams |
proc setAudioStreamCallback(stream: AudioStream; callback: AudioCallback) {.
importc: "SetAudioStreamCallback", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Audio thread callback to request new data |
proc attachAudioStreamProcessor(stream: AudioStream; processor: AudioCallback) {.
importc: "AttachAudioStreamProcessor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Attach audio stream processor to stream, receives the samples as 'float' |
proc detachAudioStreamProcessor(stream: AudioStream; processor: AudioCallback) {.
importc: "DetachAudioStreamProcessor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Detach audio stream processor from stream |
proc attachAudioMixedProcessor(processor: AudioCallback) {.
importc: "AttachAudioMixedProcessor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Attach audio stream processor to the entire audio pipeline, receives the samples as 'float' |
proc detachAudioMixedProcessor(processor: AudioCallback) {.
importc: "DetachAudioMixedProcessor", sideEffect, header: "raylib.h",
raises: [], tags: [], forbids: [].} |
Detach audio stream processor from the entire audio pipeline |
proc `[]=`(x: var ModelMeshMaterial; i: int; val: int32) {.raises: [], tags: [],
forbids: [].} |
Set the material for a mesh |
proc setWindowTitle(title: string) {.raises: [], tags: [], forbids: [].} |
Set title for window |
proc getMonitorName(monitor: int32): string {.raises: [], tags: [], forbids: [].} |
Get the human-readable, UTF-8 encoded name of the specified monitor |
proc setClipboardText(text: string) {.raises: [], tags: [], forbids: [].} |
Set clipboard text content |
proc getClipboardText(): string {.raises: [], tags: [], forbids: [].} |
Get clipboard text content |
proc loadShader(vsFileName: string; fsFileName: string): Shader {.raises: [],
tags: [], forbids: [].} |
Load shader from files and bind default locations |
proc loadShaderFromMemory(vsCode: string; fsCode: string): Shader {.raises: [],
tags: [], forbids: [].} |
Load shader from code strings and bind default locations |
proc getShaderLocation(shader: Shader; uniformName: string): ShaderLocation {.
raises: [], tags: [], forbids: [].} |
Get shader uniform location |
proc getShaderLocationAttrib(shader: Shader; attribName: string): ShaderLocation {.
raises: [], tags: [], forbids: [].} |
Get shader attribute location |
proc takeScreenshot(fileName: string) {.raises: [], tags: [], forbids: [].} |
Takes a screenshot of current screen (filename extension defines format) |
proc loadAutomationEventList(fileName: string): AutomationEventList {.
raises: [], tags: [], forbids: [].} |
Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS |
proc exportAutomationEventList(list: AutomationEventList; fileName: string): bool {.
raises: [], tags: [], forbids: [].} |
Export automation events list as text file |
proc getGamepadName(gamepad: int32): string {.raises: [], tags: [], forbids: [].} |
Get gamepad internal name id |
proc setGamepadMappings(mappings: string): int32 {.raises: [], tags: [],
forbids: [].} |
Set internal gamepad mappings (SDL_GameControllerDB) |
proc checkCollisionPointPoly(point: Vector2; points: openArray[Vector2]): bool {.
raises: [], tags: [], forbids: [].} |
Check if point is within a polygon described by array of vertices |
proc exportFontAsCode(font: Font; fileName: string): bool {.raises: [],
tags: [], forbids: [].} |
Export font as code file, returns true on success |
proc measureText(text: string; fontSize: int32): int32 {.raises: [], tags: [],
forbids: [].} |
Measure string width for default font |
proc measureText(font: Font; text: string; fontSize: float32; spacing: float32): Vector2 {.
raises: [], tags: [], forbids: [].} |
Measure string size for Font |
proc exportMesh(mesh: Mesh; fileName: string): bool {.raises: [], tags: [],
forbids: [].} |
Export mesh data to file, returns true on success |
proc exportMeshAsCode(mesh: Mesh; fileName: string): bool {.raises: [],
tags: [], forbids: [].} |
Export mesh as code file (.h) defining multiple arrays of vertex attributes |
proc exportWave(wave: Wave; fileName: string): bool {.raises: [], tags: [],
forbids: [].} |
Export wave data to file, returns true on success |
proc exportWaveAsCode(wave: Wave; fileName: string): bool {.raises: [],
tags: [], forbids: [].} |
Export wave sample data to code (.h), returns true on success |
TraceLogCallback = proc (logLevel: TraceLogLevel; text: string) {.nimcall.} |
Logging: Redirect trace log messages |
proc setTraceLogCallback(callback: TraceLogCallback) {.raises: [], tags: [],
forbids: [].} |
Set custom trace log |
proc initWindow(width: int32; height: int32; title: string) {.
raises: [RaylibError], tags: [], forbids: [].} |
Initialize window and OpenGL context |
proc getDroppedFiles(): seq[string] {.raises: [], tags: [], forbids: [].} |
Get dropped files names |
proc exportDataAsCode(data: openArray[byte]; fileName: string): bool {.
raises: [ValueError], tags: [WriteIOEffect], forbids: [].} |
Export data to code (.nim), returns true on success |
proc setShaderValue[T: ShaderV](shader: Shader; locIndex: ShaderLocation;
value: T) |
Set shader uniform value |
proc setShaderValueV[T: ShaderV](shader: Shader; locIndex: ShaderLocation;
value: openArray[T]) |
Set shader uniform value vector |
proc loadModelAnimations(fileName: string): RArray[ModelAnimation] {.
raises: [RaylibError], tags: [], forbids: [].} |
Load model animations from file |
proc loadWaveSamples(wave: Wave): RArray[float32] {.raises: [], tags: [],
forbids: [].} |
Load samples data from wave as a floats array |
proc loadMaterials(fileName: string): RArray[Material] {.raises: [RaylibError],
tags: [], forbids: [].} |
Load materials from model file |
proc loadFontData(fileData: openArray[uint8]; fontSize: int32;
codepoints: openArray[int32]; type: FontType): RArray[
GlyphInfo] {.raises: [], tags: [], forbids: [].} |
Load font data for further use |
proc loadFont(fileName: string): Font {.raises: [RaylibError], tags: [],
forbids: [].} |
Load font from file into GPU memory (VRAM) |
proc loadFont(fileName: string; fontSize: int32; codepoints: openArray[int32]): Font {.
raises: [RaylibError], tags: [], forbids: [].} |
Load font from file with extended parameters, use an empty array for codepoints to load the default character set |
proc loadFontFromMemory(fileType: string; fileData: openArray[uint8];
fontSize: int32; codepoints: openArray[int32]): Font {.
raises: [RaylibError], tags: [], forbids: [].} |
Load font from memory buffer, fileType refers to extension: i.e. '.ttf' |
proc loadFontFromData(chars: sink RArray[GlyphInfo]; baseSize, padding: int32;
packMethod: int32): Font {.raises: [RaylibError],
tags: [], forbids: [].} |
Load font using chars info |
proc updateMeshBuffer[T](mesh: var Mesh; index: int32; data: openArray[T];
offset: int32) |
Update mesh vertex data in GPU for a specific buffer index |
proc drawMeshInstanced(mesh: Mesh; material: Material;
transforms: openArray[Matrix]) {.raises: [], tags: [],
forbids: [].} |
Draw multiple mesh instances with material and different transforms |
proc loadWave(fileName: string): Wave {.raises: [RaylibError], tags: [],
forbids: [].} |
Load wave data from file |
proc loadWaveFromMemory(fileType: string; fileData: openArray[uint8]): Wave {.
raises: [RaylibError], tags: [], forbids: [].} |
Load wave from memory buffer, fileType refers to extension: i.e. '.wav' |
proc loadSound(fileName: string): Sound {.raises: [RaylibError], tags: [],
forbids: [].} |
Load sound from file |
proc loadSoundAlias(source: Sound): SoundAlias {.raises: [RaylibError],
tags: [], forbids: [].} |
Create a new sound that shares the same sample data as the source sound, does not own the sound data |
proc loadSoundFromWave(wave: Wave): Sound {.raises: [RaylibError], tags: [],
forbids: [].} |
Load sound from wave data |
proc updateSound[T](sound: var Sound; data: openArray[T]) |
Update sound buffer with new data |
proc loadMusicStream(fileName: string): Music {.raises: [RaylibError], tags: [],
forbids: [].} |
Load music stream from file |
proc loadMusicStreamFromMemory(fileType: string; data: openArray[uint8]): Music {.
raises: [RaylibError], tags: [], forbids: [].} |
Load music stream from data |
proc loadAudioStream(sampleRate: uint32; sampleSize: uint32; channels: uint32): AudioStream {.
raises: [RaylibError], tags: [], forbids: [].} |
Load audio stream (to stream raw audio pcm data) |
proc updateAudioStream[T](stream: var AudioStream; data: openArray[T]) |
Update audio stream buffers with data |
proc loadModel(fileName: string): Model {.raises: [RaylibError], tags: [],
forbids: [].} |
Load model from files (meshes and materials) |
proc loadModelFromMesh(mesh: sink Mesh): Model {.raises: [RaylibError],
tags: [], forbids: [].} |
Load model from generated mesh (default material) |
template drawing(body: untyped) |
Setup canvas (framebuffer) to start drawing |
template mode2D(camera: Camera2D; body: untyped) |
2D mode with custom camera (2D) |
template mode3D(camera: Camera3D; body: untyped) |
3D mode with custom camera (3D) |
template shaderMode(shader: Shader; body: untyped) |
Custom shader drawing |
template blendMode(mode: BlendMode; body: untyped) |
Blending mode (alpha, additive, multiplied, subtract, custom) |
template scissorMode(x, y, width, height: int32; body: untyped) |
Scissor mode (define screen area for following drawing) |
template vrStereoMode(config: VrStereoConfig; body: untyped) |
Stereo rendering (requires VR simulator) |
This code creates an ice cream display using the Naylib library in Nim.
import naylib
import raylib
const
windowWidth = 400
windowHeight = 400
proc main() =
# Initialize the window
initWindow(windowWidth, windowHeight, "Ice Cream")
# Define the colors for the ice cream
var
coneColor = Beige
scoopColor1 = Skyblue
scoopColor2 = Violet
while not windowShouldClose():
# Clear the background to white
beginDrawing()
clearBackground(White)
# Draw the ice cream cone
drawRectangle(Vector2(x:float32(150), y:float32(290)),Vector2(x:float32(100), y:float32(100)),coneColor)
# Draw the ice cream scoops
drawCircle(200, 220, 50, scoopColor1)
drawCircle(170, 250, 50, scoopColor2)
drawCircle(230, 250, 50, scoopColor1)
# Update the window
drawFPS(10, 10)
endDrawing()
main();