Vector2
#struct Vector2A 2D vector.
| Name | Type | Description |
|---|---|---|
x | f32 = 0 | The x field. |
y | f32 = 0 | The y field. |
Standard library · Graphics and games
Games and graphics with raylib: windows, 2D and 3D drawing, textures, text, input and audio.
import gui.raylibThis package binds raylib 5.5, a small library for 2D and 3D games and graphics programs. It opens a window with an OpenGL context, and gives drawing of shapes, textures, text and 3D models, keyboard, mouse, gamepad and touch input, and sound and music. The names are the ones of the raylib cheat sheet, so every raylib tutorial reads almost the same in Salam.
Programs link against the raylib shared library (libraylib, version 5.5). Install it with your package manager or build it from source; if it is missing, the build fails at the link step.
Raylib passes Color, Vector2, Rectangle, Camera3D and the other structs by value. Salam passes them the way the C compiler of the platform does, on x86-64 (System V and Windows) and AArch64. The --backend=native compiler refuses such calls with a clear message; use the default backend.
Raylib works with 32-bit floats. Every function that takes a f32 also has a version that takes f64, so DrawCircle(400, 225, 50.0, Red()) works. Struct fields are f32; build vectors and rectangles with Vec2, Vec3 and Rect.
Colors are functions: Red(), RayWhite(), Blank(). Build your own with RGB and RGBA.
Functions that change a value in place, such as ImageResize and UpdateCamera, take a variable and need it declared with mut.
Strings returned by raylib, such as GetMonitorName, belong to raylib: copy them if you keep them and never free them.
Everything you load (LoadTexture, LoadSound, LoadModel, ...) has an Unload call; raylib does not free it for you before the window closes.
The window needs a desktop session, so the examples on this page are only type-checked by the site.
Every raylib program has the same shape: open a window, ask for a frame rate, then loop until WindowShouldClose, drawing between BeginDrawing and EndDrawing. GetFrameTime gives the seconds since the last frame, which keeps movement the same speed on every machine.
import gui.raylib
func main:
raylib.InitWindow(800, 450, "Bouncing ball")
raylib.SetTargetFPS(60)
mut x := 400.0
mut y := 225.0
mut dx := 240.0
mut dy := 180.0
until not raylib.WindowShouldClose():
dt := raylib.GetFrameTime() as f64
x += dx * dt
y += dy * dt
if x < 20.0 or x > 780.0:
dx = -dx
end
if y < 20.0 or y > 430.0:
dy = -dy
end
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawCircle(x as int, y as int, 20.0, raylib.Maroon())
raylib.DrawText("Close the window to quit", 10, 10, 20, raylib.DarkGray())
raylib.EndDrawing()
end
raylib.CloseWindow()
endIsKeyDown reports a key that is held, IsKeyPressed only the frame it went down. CheckCollisionRecs tests two rectangles, which is enough for many 2D games: try the move first and keep it only when it does not hit the wall.
import gui.raylib
func main:
raylib.InitWindow(800, 450, "Move the square")
raylib.SetTargetFPS(60)
mut px := 100.0
mut py := 100.0
wall := raylib.Rect(500.0, 150.0, 60.0, 150.0)
until not raylib.WindowShouldClose():
dt := raylib.GetFrameTime() as f64
mut nx := px
mut ny := py
if raylib.IsKeyDown(raylib.KEY_RIGHT): nx += 200.0 * dt end
if raylib.IsKeyDown(raylib.KEY_LEFT): nx -= 200.0 * dt end
if raylib.IsKeyDown(raylib.KEY_DOWN): ny += 200.0 * dt end
if raylib.IsKeyDown(raylib.KEY_UP): ny -= 200.0 * dt end
player := raylib.Rect(nx, ny, 40.0, 40.0)
if not raylib.CheckCollisionRecs(player, wall):
px = nx
py = ny
end
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawRectangleRec(wall, raylib.DarkGray())
raylib.DrawRectangle(px as int, py as int, 40, 40, raylib.Blue())
raylib.DrawText("Arrow keys move the square", 10, 10, 20, raylib.Gray())
raylib.EndDrawing()
end
raylib.CloseWindow()
end3D drawing sits between BeginMode3D and EndMode3D and uses a Camera3D. UpdateCamera with CAMERA_ORBITAL turns the camera around its target; it changes the camera, so declare it with mut.
import gui.raylib
func main:
raylib.InitWindow(800, 450, "3D cube")
raylib.SetTargetFPS(60)
mut camera := raylib.NewCamera3D(
raylib.Vec3(6.0, 6.0, 6.0),
raylib.Vec3(0.0, 1.0, 0.0),
raylib.Vec3(0.0, 1.0, 0.0),
45.0,
raylib.CAMERA_PERSPECTIVE
)
until not raylib.WindowShouldClose():
raylib.UpdateCamera(camera, raylib.CAMERA_ORBITAL)
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.BeginMode3D(camera)
raylib.DrawCube(raylib.Vec3(0.0, 1.0, 0.0), 2.0, 2.0, 2.0, raylib.Red())
raylib.DrawCubeWires(raylib.Vec3(0.0, 1.0, 0.0), 2.0, 2.0, 2.0, raylib.Maroon())
raylib.DrawGrid(10, 1.0)
raylib.EndMode3D()
raylib.DrawFPS(10, 10)
raylib.EndDrawing()
end
raylib.CloseWindow()
endstruct Vector2A 2D vector.
| Name | Type | Description |
|---|---|---|
x | f32 = 0 | The x field. |
y | f32 = 0 | The y field. |
struct Vector3A 3D vector.
| Name | Type | Description |
|---|---|---|
x | f32 = 0 | The x field. |
y | f32 = 0 | The y field. |
z | f32 = 0 | The z field. |
struct Vector4A 4D vector, also used as a quaternion.
| Name | Type | Description |
|---|---|---|
x | f32 = 0 | The x field. |
y | f32 = 0 | The y field. |
z | f32 = 0 | The z field. |
w | f32 = 0 | The w field. |
struct MatrixA 4x4 matrix.
| Name | Type | Description |
|---|---|---|
m0 | f32 = 0 | The m0 field. |
m4 | f32 = 0 | The m4 field. |
m8 | f32 = 0 | The m8 field. |
m12 | f32 = 0 | The m12 field. |
m1 | f32 = 0 | The m1 field. |
m5 | f32 = 0 | The m5 field. |
m9 | f32 = 0 | The m9 field. |
m13 | f32 = 0 | The m13 field. |
m2 | f32 = 0 | The m2 field. |
m6 | f32 = 0 | The m6 field. |
m10 | f32 = 0 | The m10 field. |
m14 | f32 = 0 | The m14 field. |
m3 | f32 = 0 | The m3 field. |
m7 | f32 = 0 | The m7 field. |
m11 | f32 = 0 | The m11 field. |
m15 | f32 = 0 | The m15 field. |
struct ColorA color with red, green, blue and alpha bytes.
| Name | Type | Description |
|---|---|---|
r | u8 = 0 | The r field. |
g | u8 = 0 | The g field. |
b | u8 = 0 | The b field. |
a | u8 = 0 | The a field. |
struct RectangleA rectangle with a position and a size.
| Name | Type | Description |
|---|---|---|
x | f32 = 0 | The x field. |
y | f32 = 0 | The y field. |
width | f32 = 0 | The width field. |
height | f32 = 0 | The height field. |
struct ImagePixel data in CPU memory.
| Name | Type | Description |
|---|---|---|
data | void* | The data field. |
width | int = 0 | The width field. |
height | int = 0 | The height field. |
mipmaps | int = 0 | The mipmaps field. |
format | int = 0 | The format field. |
struct TextureA texture stored in GPU memory.
| Name | Type | Description |
|---|---|---|
id | u32 = 0 | The id field. |
width | int = 0 | The width field. |
height | int = 0 | The height field. |
mipmaps | int = 0 | The mipmaps field. |
format | int = 0 | The format field. |
struct RenderTextureA texture you can draw into.
| Name | Type | Description |
|---|---|---|
id | u32 = 0 | The id field. |
texture | Texture | The texture field. |
depth | Texture | The depth field. |
struct NPatchInfoDescribes a nine-patch texture.
| Name | Type | Description |
|---|---|---|
source | Rectangle | The source field. |
left | int = 0 | The left field. |
top | int = 0 | The top field. |
right | int = 0 | The right field. |
bottom | int = 0 | The bottom field. |
layoutKind | int = 0 | The layoutKind field. |
struct GlyphInfoMetrics and pixels of one font glyph.
| Name | Type | Description |
|---|---|---|
value | int = 0 | The value field. |
offsetX | int = 0 | The offsetX field. |
offsetY | int = 0 | The offsetY field. |
advanceX | int = 0 | The advanceX field. |
image | Image | The image field. |
struct FontA font made of glyph rectangles in a texture.
| Name | Type | Description |
|---|---|---|
baseSize | int = 0 | The baseSize field. |
glyphCount | int = 0 | The glyphCount field. |
glyphPadding | int = 0 | The glyphPadding field. |
texture | Texture | The texture field. |
recs | Rectangle* | The recs field. |
glyphs | GlyphInfo* | The glyphs field. |
struct Camera3DA 3D camera.
| Name | Type | Description |
|---|---|---|
position | Vector3 | The position field. |
target | Vector3 | The target field. |
up | Vector3 | The up field. |
fovy | f32 = 0 | The fovy field. |
projection | int = 0 | The projection field. |
struct Camera2DA 2D camera.
| Name | Type | Description |
|---|---|---|
offset | Vector2 | The offset field. |
target | Vector2 | The target field. |
rotation | f32 = 0 | The rotation field. |
zoom | f32 = 0 | The zoom field. |
struct MeshVertex data of a 3D shape.
| Name | Type | Description |
|---|---|---|
vertexCount | int = 0 | The vertexCount field. |
triangleCount | int = 0 | The triangleCount field. |
vertices | f32* | The vertices field. |
texcoords | f32* | The texcoords field. |
texcoords2 | f32* | The texcoords2 field. |
normals | f32* | The normals field. |
tangents | f32* | The tangents field. |
colors | u8* | The colors field. |
indices | u16* | The indices field. |
animVertices | f32* | The animVertices field. |
animNormals | f32* | The animNormals field. |
boneIds | u8* | The boneIds field. |
boneWeights | f32* | The boneWeights field. |
boneMatrices | Matrix* | The boneMatrices field. |
boneCount | int = 0 | The boneCount field. |
vaoId | u32 = 0 | The vaoId field. |
vboId | u32* | The vboId field. |
struct ShaderA GPU shader program.
| Name | Type | Description |
|---|---|---|
id | u32 = 0 | The id field. |
locs | int* | The locs field. |
struct MaterialMapOne texture slot of a material.
| Name | Type | Description |
|---|---|---|
texture | Texture | The texture field. |
color | Color | The color field. |
value | f32 = 0 | The value field. |
struct MaterialA shader with its texture maps.
| Name | Type | Description |
|---|---|---|
shader | Shader | The shader field. |
maps | MaterialMap* | The maps field. |
param0 | f32 = 0 | The param0 field. |
param1 | f32 = 0 | The param1 field. |
param2 | f32 = 0 | The param2 field. |
param3 | f32 = 0 | The param3 field. |
struct TransformTranslation, rotation and scale.
| Name | Type | Description |
|---|---|---|
translation | Vector3 | The translation field. |
rotation | Vector4 | The rotation field. |
scale | Vector3 | The scale field. |
struct BoneInfoA skeleton bone (the name is stored as eight 32-bit words).
| Name | Type | Description |
|---|---|---|
name0 | u32 = 0 | The name0 field. |
name1 | u32 = 0 | The name1 field. |
name2 | u32 = 0 | The name2 field. |
name3 | u32 = 0 | The name3 field. |
name4 | u32 = 0 | The name4 field. |
name5 | u32 = 0 | The name5 field. |
name6 | u32 = 0 | The name6 field. |
name7 | u32 = 0 | The name7 field. |
parent | int = 0 | The parent field. |
struct ModelA set of meshes and materials.
| Name | Type | Description |
|---|---|---|
transform | Matrix | The transform field. |
meshCount | int = 0 | The meshCount field. |
materialCount | int = 0 | The materialCount field. |
meshes | Mesh* | The meshes field. |
materials | Material* | The materials field. |
meshMaterial | int* | The meshMaterial field. |
boneCount | int = 0 | The boneCount field. |
bones | BoneInfo* | The bones field. |
bindPose | Transform* | The bindPose field. |
struct ModelAnimationA skeletal animation for a model.
| Name | Type | Description |
|---|---|---|
boneCount | int = 0 | The boneCount field. |
frameCount | int = 0 | The frameCount field. |
bones | BoneInfo* | The bones field. |
framePoses | void* | The framePoses field. |
name0 | u32 = 0 | The name0 field. |
name1 | u32 = 0 | The name1 field. |
name2 | u32 = 0 | The name2 field. |
name3 | u32 = 0 | The name3 field. |
name4 | u32 = 0 | The name4 field. |
name5 | u32 = 0 | The name5 field. |
name6 | u32 = 0 | The name6 field. |
name7 | u32 = 0 | The name7 field. |
struct RayA ray with a start and a direction.
| Name | Type | Description |
|---|---|---|
position | Vector3 | The position field. |
direction | Vector3 | The direction field. |
struct RayCollisionThe result of a ray test.
| Name | Type | Description |
|---|---|---|
hit | bool = false | The hit field. |
distance | f32 = 0 | The distance field. |
point | Vector3 | The point field. |
normal | Vector3 | The normal field. |
struct BoundingBoxAn axis-aligned box.
| Name | Type | Description |
|---|---|---|
min | Vector3 | The min field. |
max | Vector3 | The max field. |
struct WaveDecoded audio samples.
| Name | Type | Description |
|---|---|---|
frameCount | u32 = 0 | The frameCount field. |
sampleRate | u32 = 0 | The sampleRate field. |
sampleSize | u32 = 0 | The sampleSize field. |
channels | u32 = 0 | The channels field. |
data | void* | The data field. |
struct AudioStreamA raw audio stream.
| Name | Type | Description |
|---|---|---|
buffer | void* | The buffer field. |
processor | void* | The processor field. |
sampleRate | u32 = 0 | The sampleRate field. |
sampleSize | u32 = 0 | The sampleSize field. |
channels | u32 = 0 | The channels field. |
struct SoundA short sound loaded in memory.
| Name | Type | Description |
|---|---|---|
stream | AudioStream | The stream field. |
frameCount | u32 = 0 | The frameCount field. |
struct MusicA streamed music file.
| Name | Type | Description |
|---|---|---|
stream | AudioStream | The stream field. |
frameCount | u32 = 0 | The frameCount field. |
looping | bool = false | The looping field. |
ctxType | int = 0 | The ctxType field. |
ctxData | void* | The ctxData field. |
struct FilePathListA list of file paths.
| Name | Type | Description |
|---|---|---|
capacity | u32 = 0 | The capacity field. |
count | u32 = 0 | The count field. |
paths | void* | The paths field. |
const KEY_NULL: i32 = 0Keyboard key code: null.
const KEY_APOSTROPHE: i32 = 39Keyboard key code: apostrophe.
const KEY_COMMA: i32 = 44Keyboard key code: comma.
const KEY_MINUS: i32 = 45Keyboard key code: minus.
const KEY_PERIOD: i32 = 46Keyboard key code: period.
const KEY_SLASH: i32 = 47Keyboard key code: slash.
const KEY_SEMICOLON: i32 = 59Keyboard key code: semicolon.
const KEY_EQUAL: i32 = 61Keyboard key code: equal.
const KEY_LEFT_BRACKET: i32 = 91Keyboard key code: left bracket.
const KEY_BACKSLASH: i32 = 92Keyboard key code: backslash.
const KEY_RIGHT_BRACKET: i32 = 93Keyboard key code: right bracket.
const KEY_GRAVE: i32 = 96Keyboard key code: grave.
const KEY_SPACE: i32 = 32Keyboard key code: space.
const KEY_ESCAPE: i32 = 256Keyboard key code: escape.
const KEY_ENTER: i32 = 257Keyboard key code: enter.
const KEY_TAB: i32 = 258Keyboard key code: tab.
const KEY_BACKSPACE: i32 = 259Keyboard key code: backspace.
const KEY_INSERT: i32 = 260Keyboard key code: insert.
const KEY_DELETE: i32 = 261Keyboard key code: delete.
const KEY_RIGHT: i32 = 262Keyboard key code: right.
const KEY_LEFT: i32 = 263Keyboard key code: left.
const KEY_DOWN: i32 = 264Keyboard key code: down.
const KEY_UP: i32 = 265Keyboard key code: up.
const KEY_PAGE_UP: i32 = 266Keyboard key code: page up.
const KEY_PAGE_DOWN: i32 = 267Keyboard key code: page down.
const KEY_HOME: i32 = 268Keyboard key code: home.
const KEY_END: i32 = 269Keyboard key code: end.
const KEY_CAPS_LOCK: i32 = 280Keyboard key code: caps lock.
const KEY_SCROLL_LOCK: i32 = 281Keyboard key code: scroll lock.
const KEY_NUM_LOCK: i32 = 282Keyboard key code: num lock.
const KEY_PRINT_SCREEN: i32 = 283Keyboard key code: print screen.
const KEY_PAUSE: i32 = 284Keyboard key code: pause.
const KEY_LEFT_SHIFT: i32 = 340Keyboard key code: left shift.
const KEY_LEFT_CONTROL: i32 = 341Keyboard key code: left control.
const KEY_LEFT_ALT: i32 = 342Keyboard key code: left alt.
const KEY_LEFT_SUPER: i32 = 343Keyboard key code: left super.
const KEY_RIGHT_SHIFT: i32 = 344Keyboard key code: right shift.
const KEY_RIGHT_CONTROL: i32 = 345Keyboard key code: right control.
const KEY_RIGHT_ALT: i32 = 346Keyboard key code: right alt.
const KEY_RIGHT_SUPER: i32 = 347Keyboard key code: right super.
const KEY_KB_MENU: i32 = 348Keyboard key code: kb menu.
const KEY_ZERO: i32 = 48Keyboard key code: zero.
const KEY_ONE: i32 = 49Keyboard key code: one.
const KEY_TWO: i32 = 50Keyboard key code: two.
const KEY_THREE: i32 = 51Keyboard key code: three.
const KEY_FOUR: i32 = 52Keyboard key code: four.
const KEY_FIVE: i32 = 53Keyboard key code: five.
const KEY_SIX: i32 = 54Keyboard key code: six.
const KEY_SEVEN: i32 = 55Keyboard key code: seven.
const KEY_EIGHT: i32 = 56Keyboard key code: eight.
const KEY_NINE: i32 = 57Keyboard key code: nine.
const KEY_A: i32 = 65Keyboard key code: a.
const KEY_B: i32 = 66Keyboard key code: b.
const KEY_C: i32 = 67Keyboard key code: c.
const KEY_D: i32 = 68Keyboard key code: d.
const KEY_E: i32 = 69Keyboard key code: e.
const KEY_F: i32 = 70Keyboard key code: f.
const KEY_G: i32 = 71Keyboard key code: g.
const KEY_H: i32 = 72Keyboard key code: h.
const KEY_I: i32 = 73Keyboard key code: i.
const KEY_J: i32 = 74Keyboard key code: j.
const KEY_K: i32 = 75Keyboard key code: k.
const KEY_L: i32 = 76Keyboard key code: l.
const KEY_M: i32 = 77Keyboard key code: m.
const KEY_N: i32 = 78Keyboard key code: n.
const KEY_O: i32 = 79Keyboard key code: o.
const KEY_P: i32 = 80Keyboard key code: p.
const KEY_Q: i32 = 81Keyboard key code: q.
const KEY_R: i32 = 82Keyboard key code: r.
const KEY_S: i32 = 83Keyboard key code: s.
const KEY_T: i32 = 84Keyboard key code: t.
const KEY_U: i32 = 85Keyboard key code: u.
const KEY_V: i32 = 86Keyboard key code: v.
const KEY_W: i32 = 87Keyboard key code: w.
const KEY_X: i32 = 88Keyboard key code: x.
const KEY_Y: i32 = 89Keyboard key code: y.
const KEY_Z: i32 = 90Keyboard key code: z.
const KEY_F1: i32 = 290Keyboard key code: f1.
const KEY_F2: i32 = 291Keyboard key code: f2.
const KEY_F3: i32 = 292Keyboard key code: f3.
const KEY_F4: i32 = 293Keyboard key code: f4.
const KEY_F5: i32 = 294Keyboard key code: f5.
const KEY_F6: i32 = 295Keyboard key code: f6.
const KEY_F7: i32 = 296Keyboard key code: f7.
const KEY_F8: i32 = 297Keyboard key code: f8.
const KEY_F9: i32 = 298Keyboard key code: f9.
const KEY_F10: i32 = 299Keyboard key code: f10.
const KEY_F11: i32 = 300Keyboard key code: f11.
const KEY_F12: i32 = 301Keyboard key code: f12.
const KEY_KP_0: i32 = 320Keyboard key code: kp 0.
const KEY_KP_1: i32 = 321Keyboard key code: kp 1.
const KEY_KP_2: i32 = 322Keyboard key code: kp 2.
const KEY_KP_3: i32 = 323Keyboard key code: kp 3.
const KEY_KP_4: i32 = 324Keyboard key code: kp 4.
const KEY_KP_5: i32 = 325Keyboard key code: kp 5.
const KEY_KP_6: i32 = 326Keyboard key code: kp 6.
const KEY_KP_7: i32 = 327Keyboard key code: kp 7.
const KEY_KP_8: i32 = 328Keyboard key code: kp 8.
const KEY_KP_9: i32 = 329Keyboard key code: kp 9.
const KEY_KP_DECIMAL: i32 = 330Keyboard key code: kp decimal.
const KEY_KP_DIVIDE: i32 = 331Keyboard key code: kp divide.
const KEY_KP_MULTIPLY: i32 = 332Keyboard key code: kp multiply.
const KEY_KP_SUBTRACT: i32 = 333Keyboard key code: kp subtract.
const KEY_KP_ADD: i32 = 334Keyboard key code: kp add.
const KEY_KP_ENTER: i32 = 335Keyboard key code: kp enter.
const KEY_KP_EQUAL: i32 = 336Keyboard key code: kp equal.
const FLAG_VSYNC_HINT: u32 = 64Window or config flag: vsync hint.
const FLAG_FULLSCREEN_MODE: u32 = 2Window or config flag: fullscreen mode.
const FLAG_WINDOW_RESIZABLE: u32 = 4Window or config flag: window resizable.
const FLAG_WINDOW_UNDECORATED: u32 = 8Window or config flag: window undecorated.
const FLAG_WINDOW_HIDDEN: u32 = 128Window or config flag: window hidden.
const FLAG_WINDOW_MINIMIZED: u32 = 512Window or config flag: window minimized.
const FLAG_WINDOW_MAXIMIZED: u32 = 1024Window or config flag: window maximized.
const FLAG_WINDOW_UNFOCUSED: u32 = 2048Window or config flag: window unfocused.
const FLAG_WINDOW_TOPMOST: u32 = 4096Window or config flag: window topmost.
const FLAG_WINDOW_ALWAYS_RUN: u32 = 256Window or config flag: window always run.
const FLAG_WINDOW_TRANSPARENT: u32 = 16Window or config flag: window transparent.
const FLAG_WINDOW_HIGHDPI: u32 = 8192Window or config flag: window highdpi.
const FLAG_WINDOW_MOUSE_PASSTHROUGH: u32 = 16384Window or config flag: window mouse passthrough.
const FLAG_BORDERLESS_WINDOWED_MODE: u32 = 32768Window or config flag: borderless windowed mode.
const FLAG_MSAA_4X_HINT: u32 = 32Window or config flag: msaa 4x hint.
const FLAG_INTERLACED_HINT: u32 = 65536Window or config flag: interlaced hint.
const LOG_ALL: i32 = 0Log level: all.
const LOG_TRACE: i32 = 1Log level: trace.
const LOG_DEBUG: i32 = 2Log level: debug.
const LOG_INFO: i32 = 3Log level: info.
const LOG_WARNING: i32 = 4Log level: warning.
const LOG_ERROR: i32 = 5Log level: error.
const LOG_FATAL: i32 = 6Log level: fatal.
const LOG_NONE: i32 = 7Log level: none.
const MOUSE_BUTTON_LEFT: i32 = 0Mouse: button left.
const MOUSE_BUTTON_RIGHT: i32 = 1Mouse: button right.
const MOUSE_BUTTON_MIDDLE: i32 = 2Mouse: button middle.
const MOUSE_BUTTON_SIDE: i32 = 3Mouse: button side.
const MOUSE_BUTTON_EXTRA: i32 = 4Mouse: button extra.
const MOUSE_BUTTON_FORWARD: i32 = 5Mouse: button forward.
const MOUSE_BUTTON_BACK: i32 = 6Mouse: button back.
const MOUSE_CURSOR_DEFAULT: i32 = 0Mouse: cursor default.
const MOUSE_CURSOR_ARROW: i32 = 1Mouse: cursor arrow.
const MOUSE_CURSOR_IBEAM: i32 = 2Mouse: cursor ibeam.
const MOUSE_CURSOR_CROSSHAIR: i32 = 3Mouse: cursor crosshair.
const MOUSE_CURSOR_POINTING_HAND: i32 = 4Mouse: cursor pointing hand.
const MOUSE_CURSOR_RESIZE_EW: i32 = 5Mouse: cursor resize ew.
const MOUSE_CURSOR_RESIZE_NS: i32 = 6Mouse: cursor resize ns.
const MOUSE_CURSOR_RESIZE_NWSE: i32 = 7Mouse: cursor resize nwse.
const MOUSE_CURSOR_RESIZE_NESW: i32 = 8Mouse: cursor resize nesw.
const MOUSE_CURSOR_RESIZE_ALL: i32 = 9Mouse: cursor resize all.
const MOUSE_CURSOR_NOT_ALLOWED: i32 = 10Mouse: cursor not allowed.
const GAMEPAD_BUTTON_UNKNOWN: i32 = 0Gamepad: button unknown.
const GAMEPAD_BUTTON_LEFT_FACE_UP: i32 = 1Gamepad: button left face up.
const GAMEPAD_BUTTON_LEFT_FACE_RIGHT: i32 = 2Gamepad: button left face right.
const GAMEPAD_BUTTON_LEFT_FACE_DOWN: i32 = 3Gamepad: button left face down.
const GAMEPAD_BUTTON_LEFT_FACE_LEFT: i32 = 4Gamepad: button left face left.
const GAMEPAD_BUTTON_RIGHT_FACE_UP: i32 = 5Gamepad: button right face up.
const GAMEPAD_BUTTON_RIGHT_FACE_RIGHT: i32 = 6Gamepad: button right face right.
const GAMEPAD_BUTTON_RIGHT_FACE_DOWN: i32 = 7Gamepad: button right face down.
const GAMEPAD_BUTTON_RIGHT_FACE_LEFT: i32 = 8Gamepad: button right face left.
const GAMEPAD_BUTTON_LEFT_TRIGGER_1: i32 = 9Gamepad: button left trigger 1.
const GAMEPAD_BUTTON_LEFT_TRIGGER_2: i32 = 10Gamepad: button left trigger 2.
const GAMEPAD_BUTTON_RIGHT_TRIGGER_1: i32 = 11Gamepad: button right trigger 1.
const GAMEPAD_BUTTON_RIGHT_TRIGGER_2: i32 = 12Gamepad: button right trigger 2.
const GAMEPAD_BUTTON_MIDDLE_LEFT: i32 = 13Gamepad: button middle left.
const GAMEPAD_BUTTON_MIDDLE: i32 = 14Gamepad: button middle.
const GAMEPAD_BUTTON_MIDDLE_RIGHT: i32 = 15Gamepad: button middle right.
const GAMEPAD_BUTTON_LEFT_THUMB: i32 = 16Gamepad: button left thumb.
const GAMEPAD_BUTTON_RIGHT_THUMB: i32 = 17Gamepad: button right thumb.
const GAMEPAD_AXIS_LEFT_X: i32 = 0Gamepad: axis left x.
const GAMEPAD_AXIS_LEFT_Y: i32 = 1Gamepad: axis left y.
const GAMEPAD_AXIS_RIGHT_X: i32 = 2Gamepad: axis right x.
const GAMEPAD_AXIS_RIGHT_Y: i32 = 3Gamepad: axis right y.
const GAMEPAD_AXIS_LEFT_TRIGGER: i32 = 4Gamepad: axis left trigger.
const GAMEPAD_AXIS_RIGHT_TRIGGER: i32 = 5Gamepad: axis right trigger.
const BLEND_ALPHA: i32 = 0Blend mode: alpha.
const BLEND_ADDITIVE: i32 = 1Blend mode: additive.
const BLEND_MULTIPLIED: i32 = 2Blend mode: multiplied.
const BLEND_ADD_COLORS: i32 = 3Blend mode: add colors.
const BLEND_SUBTRACT_COLORS: i32 = 4Blend mode: subtract colors.
const BLEND_ALPHA_PREMULTIPLY: i32 = 5Blend mode: alpha premultiply.
const BLEND_CUSTOM: i32 = 6Blend mode: custom.
const TEXTURE_FILTER_POINT: i32 = 0Texture option: filter point.
const TEXTURE_FILTER_BILINEAR: i32 = 1Texture option: filter bilinear.
const TEXTURE_FILTER_TRILINEAR: i32 = 2Texture option: filter trilinear.
const TEXTURE_FILTER_ANISOTROPIC_4X: i32 = 3Texture option: filter anisotropic 4x.
const TEXTURE_FILTER_ANISOTROPIC_8X: i32 = 4Texture option: filter anisotropic 8x.
const TEXTURE_FILTER_ANISOTROPIC_16X: i32 = 5Texture option: filter anisotropic 16x.
const TEXTURE_WRAP_REPEAT: i32 = 0Texture option: wrap repeat.
const TEXTURE_WRAP_CLAMP: i32 = 1Texture option: wrap clamp.
const TEXTURE_WRAP_MIRROR_REPEAT: i32 = 2Texture option: wrap mirror repeat.
const TEXTURE_WRAP_MIRROR_CLAMP: i32 = 3Texture option: wrap mirror clamp.
const CAMERA_CUSTOM: i32 = 0Camera setting: custom.
const CAMERA_FREE: i32 = 1Camera setting: free.
const CAMERA_ORBITAL: i32 = 2Camera setting: orbital.
const CAMERA_FIRST_PERSON: i32 = 3Camera setting: first person.
const CAMERA_THIRD_PERSON: i32 = 4Camera setting: third person.
const CAMERA_PERSPECTIVE: i32 = 0Camera setting: perspective.
const CAMERA_ORTHOGRAPHIC: i32 = 1Camera setting: orthographic.
const PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: i32 = 1Pixel format: uncompressed grayscale.
const PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: i32 = 2Pixel format: uncompressed gray alpha.
const PIXELFORMAT_UNCOMPRESSED_R5G6B5: i32 = 3Pixel format: uncompressed r5g6b5.
const PIXELFORMAT_UNCOMPRESSED_R8G8B8: i32 = 4Pixel format: uncompressed r8g8b8.
const PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: i32 = 5Pixel format: uncompressed r5g5b5a1.
const PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: i32 = 6Pixel format: uncompressed r4g4b4a4.
const PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: i32 = 7Pixel format: uncompressed r8g8b8a8.
const PIXELFORMAT_UNCOMPRESSED_R32: i32 = 8Pixel format: uncompressed r32.
const PIXELFORMAT_UNCOMPRESSED_R32G32B32: i32 = 9Pixel format: uncompressed r32g32b32.
const PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: i32 = 10Pixel format: uncompressed r32g32b32a32.
const SHADER_UNIFORM_FLOAT: i32 = 0Shader uniform type: uniform float.
const SHADER_UNIFORM_VEC2: i32 = 1Shader uniform type: uniform vec2.
const SHADER_UNIFORM_VEC3: i32 = 2Shader uniform type: uniform vec3.
const SHADER_UNIFORM_VEC4: i32 = 3Shader uniform type: uniform vec4.
const SHADER_UNIFORM_INT: i32 = 4Shader uniform type: uniform int.
const SHADER_UNIFORM_SAMPLER2D: i32 = 8Shader uniform type: uniform sampler2d.
const MATERIAL_MAP_ALBEDO: i32 = 0Material map slot: map albedo.
const MATERIAL_MAP_METALNESS: i32 = 1Material map slot: map metalness.
const MATERIAL_MAP_NORMAL: i32 = 2Material map slot: map normal.
const MATERIAL_MAP_ROUGHNESS: i32 = 3Material map slot: map roughness.
const MATERIAL_MAP_OCCLUSION: i32 = 4Material map slot: map occlusion.
const MATERIAL_MAP_EMISSION: i32 = 5Material map slot: map emission.
const GESTURE_NONE: u32 = 0Touch gesture: none.
const GESTURE_TAP: u32 = 1Touch gesture: tap.
const GESTURE_DOUBLETAP: u32 = 2Touch gesture: doubletap.
const GESTURE_HOLD: u32 = 4Touch gesture: hold.
const GESTURE_DRAG: u32 = 8Touch gesture: drag.
const GESTURE_SWIPE_RIGHT: u32 = 16Touch gesture: swipe right.
const GESTURE_SWIPE_LEFT: u32 = 32Touch gesture: swipe left.
const GESTURE_SWIPE_UP: u32 = 64Touch gesture: swipe up.
const GESTURE_SWIPE_DOWN: u32 = 128Touch gesture: swipe down.
const GESTURE_PINCH_IN: u32 = 256Touch gesture: pinch in.
const GESTURE_PINCH_OUT: u32 = 512Touch gesture: pinch out.
func IsKeyPressed(key: int): boolReturns true when the key is pressed this frame.
func IsKeyPressedRepeat(key: int): boolReturns true when the key is pressed again by key repeat.
func IsKeyDown(key: int): boolReturns true when the key is held down.
import gui.raylib
func main:
raylib.InitWindow(400, 300, "Keys")
mut x := 200
until not raylib.WindowShouldClose():
if raylib.IsKeyDown(raylib.KEY_RIGHT): x += 3 end
if raylib.IsKeyDown(raylib.KEY_LEFT): x -= 3 end
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawCircle(x, 150, 20.0, raylib.Maroon())
raylib.EndDrawing()
end
raylib.CloseWindow()
endfunc IsKeyReleased(key: int): boolReturns true when the key is released this frame.
func IsKeyUp(key: int): boolReturns true when the key is not held.
func GetKeyPressed(): intReturns key pressed.
func GetCharPressed(): intReturns char pressed.
func SetExitKey(key: int)Sets exit key.
func IsGamepadAvailable(gamepad: int): boolReturns true when gamepad available holds.
func GetGamepadName(gamepad: int): strReturns gamepad name.
func IsGamepadButtonPressed(gamepad: int, button: int): boolReturns true when the gamepad button is pressed this frame.
func IsGamepadButtonDown(gamepad: int, button: int): boolReturns true when the gamepad button is held down.
func IsGamepadButtonReleased(gamepad: int, button: int): boolReturns true when the gamepad button is released this frame.
func IsGamepadButtonUp(gamepad: int, button: int): boolReturns true when the gamepad button is not held.
func GetGamepadButtonPressed(): intReturns gamepad button pressed.
func GetGamepadAxisCount(gamepad: int): intReturns gamepad axis count.
func GetGamepadAxisMovement(gamepad: int, axis: int): f32Returns gamepad axis movement.
func SetGamepadMappings(mappings: str): intSets gamepad mappings.
func SetGamepadVibration(gamepad: int, leftMotor: f32, rightMotor: f32, duration: f32)Sets gamepad vibration.
func IsMouseButtonPressed(button: int): boolReturns true when the mouse button is pressed this frame.
func IsMouseButtonDown(button: int): boolReturns true when the mouse button is held down.
func IsMouseButtonReleased(button: int): boolReturns true when the mouse button is released this frame.
func IsMouseButtonUp(button: int): boolReturns true when the mouse button is not held.
func GetMouseX(): intReturns mouse x.
func GetMouseY(): intReturns mouse y.
func GetMousePosition(): Vector2Returns mouse position.
func GetMouseDelta(): Vector2Returns mouse delta.
func SetMousePosition(x: int, y: int)Sets mouse position.
func SetMouseOffset(offsetX: int, offsetY: int)Sets mouse offset.
func SetMouseScale(scaleX: f32, scaleY: f32)Sets mouse scale.
func GetMouseWheelMove(): f32Returns mouse wheel move.
func GetMouseWheelMoveV(): Vector2Returns mouse wheel move.
func SetMouseCursor(cursor: int)Sets mouse cursor.
func GetTouchX(): intReturns touch x.
func GetTouchY(): intReturns touch y.
func GetTouchPosition(index: int): Vector2Returns touch position.
func GetTouchPointId(index: int): intReturns touch point id.
func GetTouchPointCount(): intReturns touch point count.
func SetGesturesEnabled(flags: u32)Sets gestures enabled.
func IsGestureDetected(gesture: u32): boolReturns true when gesture detected holds.
func GetGestureDetected(): intReturns gesture detected.
func GetGestureHoldDuration(): f32Returns gesture hold duration.
func GetGestureDragVector(): Vector2Returns gesture drag vector.
func GetGestureDragAngle(): f32Returns gesture drag angle.
func GetGesturePinchVector(): Vector2Returns gesture pinch vector.
func GetGesturePinchAngle(): f32Returns gesture pinch angle.
func UpdateCamera(camera &: Camera3D, mode: int)Updates camera.
func UpdateCameraPro(camera &: Camera3D, movement: Vector3, rotation: Vector3, zoom: f32)Updates camera.
func SetGamepadVibration(gamepad: int, leftMotor: f64, rightMotor: f64, duration: f64)Sets gamepad vibration.
func SetMouseScale(scaleX: f64, scaleY: f64)Sets mouse scale.
func UpdateCameraPro(camera &: Camera3D, movement: Vector3, rotation: Vector3, zoom: f64)Updates camera.
func LoadImage(fileName: str): ImageLoads image and returns it.
func LoadImageRaw(fileName: str, width: int, height: int, format: int, headerSize: int): ImageLoads image raw and returns it.
func LoadImageFromMemory(fileType: str, fileData: u8*, dataSize: int): ImageLoads image from memory and returns it.
func LoadImageFromTexture(texture: Texture): ImageLoads image from texture and returns it.
func LoadImageFromScreen(): ImageLoads image from screen and returns it.
func IsImageValid(image: Image): boolReturns true when the image loaded correctly.
func UnloadImage(image: Image)Frees a loaded image.
func ExportImage(image: Image, fileName: str): boolExport image.
func GenImageColor(width: int, height: int, color: Color): ImageGenerates image color.
func GenImageGradientLinear(width: int, height: int, direction: int, startColor: Color, endColor: Color): ImageGenerates image gradient linear.
func GenImageGradientRadial(width: int, height: int, density: f32, inner: Color, outer: Color): ImageGenerates image gradient radial.
func GenImageGradientSquare(width: int, height: int, density: f32, inner: Color, outer: Color): ImageGenerates image gradient square.
func GenImageChecked(width: int, height: int, checksX: int, checksY: int, col1: Color, col2: Color): ImageGenerates image checked.
func GenImageWhiteNoise(width: int, height: int, factor: f32): ImageGenerates image white noise.
func GenImagePerlinNoise(width: int, height: int, offsetX: int, offsetY: int, scale: f32): ImageGenerates image perlin noise.
func GenImageCellular(width: int, height: int, tileSize: int): ImageGenerates image cellular.
func ImageCopy(image: Image): ImageImage copy.
func ImageFromImage(image: Image, rec: Rectangle): ImageImage from image.
func ImageText(text: str, fontSize: int, color: Color): ImageImage text.
func ImageFormat(image &: Image, newFormat: int)Image format.
func ImageToPOT(image &: Image, fill: Color)Image to power of two.
func ImageCrop(image &: Image, crop: Rectangle)Image crop.
func ImageAlphaCrop(image &: Image, threshold: f32)Image alpha crop.
func ImageAlphaClear(image &: Image, color: Color, threshold: f32)Image alpha clear.
func ImageAlphaMask(image &: Image, alphaMask: Image)Image alpha mask.
func ImageAlphaPremultiply(image &: Image)Image alpha premultiply.
func ImageBlurGaussian(image &: Image, blurSize: int)Image blur gaussian.
func ImageResize(image &: Image, newWidth: int, newHeight: int)Image resize.
func ImageResizeNN(image &: Image, newWidth: int, newHeight: int)Image resize nearest neighbour.
func ImageResizeCanvas(image &: Image, newWidth: int, newHeight: int, offsetX: int, offsetY: int, fill: Color)Image resize canvas.
func ImageMipmaps(image &: Image)Image mipmaps.
func ImageDither(image &: Image, rBpp: int, gBpp: int, bBpp: int, aBpp: int)Image dither.
func ImageFlipVertical(image &: Image)Image flip vertical.
func ImageFlipHorizontal(image &: Image)Image flip horizontal.
func ImageRotate(image &: Image, degrees: int)Image rotate.
func ImageRotateCW(image &: Image)Image rotate clockwise.
func ImageRotateCCW(image &: Image)Image rotate counter-clockwise.
func ImageColorTint(image &: Image, color: Color)Image color tint.
func ImageColorInvert(image &: Image)Image color invert.
func ImageColorGrayscale(image &: Image)Image color grayscale.
func ImageColorContrast(image &: Image, contrast: f32)Image color contrast.
func ImageColorBrightness(image &: Image, brightness: int)Image color brightness.
func ImageColorReplace(image &: Image, color: Color, replace: Color)Image color replace.
func LoadImageColors(image: Image): Color*Loads image colors and returns it.
func UnloadImageColors(colors: Color*)Frees a loaded image colors.
func GetImageAlphaBorder(image: Image, threshold: f32): RectangleReturns image alpha border.
func GetImageColor(image: Image, x: int, y: int): ColorReturns image color.
func ImageClearBackground(dst &: Image, color: Color)Image clear background.
func ImageDrawPixel(dst &: Image, posX: int, posY: int, color: Color)Image draw pixel.
func ImageDrawPixelV(dst &: Image, position: Vector2, color: Color)Image draw pixel.
func ImageDrawLine(dst &: Image, startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color)Image draw line.
func ImageDrawLineV(dst &: Image, startPos: Vector2, endPos: Vector2, color: Color)Image draw line.
func ImageDrawCircle(dst &: Image, centerX: int, centerY: int, radius: int, color: Color)Image draw circle.
func ImageDrawCircleV(dst &: Image, center: Vector2, radius: int, color: Color)Image draw circle.
func ImageDrawRectangle(dst &: Image, posX: int, posY: int, width: int, height: int, color: Color)Image draw rectangle.
func ImageDrawRectangleV(dst &: Image, position: Vector2, size: Vector2, color: Color)Image draw rectangle.
func ImageDrawRectangleRec(dst &: Image, rec: Rectangle, color: Color)Image draw rectangle rectangle.
func ImageDrawRectangleLines(dst &: Image, rec: Rectangle, thick: int, color: Color)Image draw rectangle lines.
func ImageDraw(dst &: Image, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color)Image draw.
func ImageDrawText(dst &: Image, text: str, posX: int, posY: int, fontSize: int, color: Color)Image draw text.
func LoadTexture(fileName: str): TextureLoads texture and returns it.
import gui.raylib
func main:
raylib.InitWindow(400, 300, "Texture")
tex := raylib.LoadTexture("logo.png")
until not raylib.WindowShouldClose():
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawTexture(tex, 100, 50, raylib.White())
raylib.EndDrawing()
end
raylib.UnloadTexture(tex)
raylib.CloseWindow()
endfunc LoadTextureFromImage(image: Image): TextureLoads texture from image and returns it.
func LoadTextureCubemap(image: Image, cubeLayout: int): TextureLoads texture cubemap and returns it.
func LoadRenderTexture(width: int, height: int): RenderTextureLoads render texture and returns it.
func IsTextureValid(texture: Texture): boolReturns true when the texture loaded correctly.
func UnloadTexture(texture: Texture)Frees a loaded texture.
func IsRenderTextureValid(target: RenderTexture): boolReturns true when the render texture loaded correctly.
func UnloadRenderTexture(target: RenderTexture)Frees a loaded render texture.
func UpdateTexture(texture: Texture, pixels: void*)Updates texture.
func UpdateTextureRec(texture: Texture, rec: Rectangle, pixels: void*)Updates texture rectangle.
func GenTextureMipmaps(texture &: Texture)Generates texture mipmaps.
func SetTextureFilter(texture: Texture, filter: int)Sets texture filter.
func SetTextureWrap(texture: Texture, wrap: int)Sets texture wrap.
func DrawTexture(texture: Texture, posX: int, posY: int, tint: Color)Draws texture.
func DrawTextureV(texture: Texture, position: Vector2, tint: Color)Draws texture.
func DrawTextureEx(texture: Texture, position: Vector2, rotation: f32, scale: f32, tint: Color)Draws texture.
func DrawTextureRec(texture: Texture, source: Rectangle, position: Vector2, tint: Color)Draws texture rectangle.
func DrawTexturePro(texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color)Draws texture.
func DrawTextureNPatch(texture: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color)Draws texture NP atch.
func ColorIsEqual(col1: Color, col2: Color): boolColor is equal.
func Fade(color: Color, alpha: f32): ColorFade.
func ColorToInt(color: Color): intColor to int.
func ColorNormalize(color: Color): Vector4Color normalize.
func ColorFromNormalized(normalized: Vector4): ColorColor from normalized.
func ColorToHSV(color: Color): Vector3Color to HSV.
func ColorFromHSV(hue: f32, saturation: f32, value: f32): ColorColor from HSV.
func ColorTint(color: Color, tint: Color): ColorColor tint.
func ColorBrightness(color: Color, factor: f32): ColorColor brightness.
func ColorContrast(color: Color, contrast: f32): ColorColor contrast.
func ColorAlpha(color: Color, alpha: f32): ColorColor alpha.
func ColorAlphaBlend(dst: Color, src: Color, tint: Color): ColorColor alpha blend.
func ColorLerp(color1: Color, color2: Color, factor: f32): ColorColor lerp.
func GetColor(hexValue: u32): ColorReturns color.
func GetPixelColor(srcPtr: void*, format: int): ColorReturns pixel color.
func SetPixelColor(dstPtr: void*, color: Color, format: int)Sets pixel color.
func GetPixelDataSize(width: int, height: int, format: int): intReturns pixel data size.
func GenImageGradientRadial(width: int, height: int, density: f64, inner: Color, outer: Color): ImageGenerates image gradient radial.
func GenImageGradientSquare(width: int, height: int, density: f64, inner: Color, outer: Color): ImageGenerates image gradient square.
func GenImageWhiteNoise(width: int, height: int, factor: f64): ImageGenerates image white noise.
func GenImagePerlinNoise(width: int, height: int, offsetX: int, offsetY: int, scale: f64): ImageGenerates image perlin noise.
func ImageAlphaCrop(image &: Image, threshold: f64)Image alpha crop.
func ImageAlphaClear(image &: Image, color: Color, threshold: f64)Image alpha clear.
func ImageColorContrast(image &: Image, contrast: f64)Image color contrast.
func GetImageAlphaBorder(image: Image, threshold: f64): RectangleReturns image alpha border.
func DrawTextureEx(texture: Texture, position: Vector2, rotation: f64, scale: f64, tint: Color)Draws texture.
func DrawTexturePro(texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: f64, tint: Color)Draws texture.
func DrawTextureNPatch(texture: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f64, tint: Color)Draws texture NP atch.
func Fade(color: Color, alpha: f64): ColorFade.
func ColorFromHSV(hue: f64, saturation: f64, value: f64): ColorColor from HSV.
func ColorBrightness(color: Color, factor: f64): ColorColor brightness.
func ColorContrast(color: Color, contrast: f64): ColorColor contrast.
func ColorAlpha(color: Color, alpha: f64): ColorColor alpha.
func ColorLerp(color1: Color, color2: Color, factor: f64): ColorColor lerp.
func InitWindow(width: int, height: int, title: str)Init window.
import gui.raylib
func main:
raylib.InitWindow(640, 360, "Hello Salam")
raylib.SetTargetFPS(60)
until not raylib.WindowShouldClose():
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawText("Hello from Salam", 190, 170, 30, raylib.DarkGray())
raylib.EndDrawing()
end
raylib.CloseWindow()
endfunc CloseWindow()Close window.
func WindowShouldClose(): boolWindow should close.
func IsWindowReady(): boolReturns true when the window is ready.
func IsWindowFullscreen(): boolReturns true when the window is fullscreen.
func IsWindowHidden(): boolReturns true when the window is hidden.
func IsWindowMinimized(): boolReturns true when the window is minimized.
func IsWindowMaximized(): boolReturns true when the window is maximized.
func IsWindowFocused(): boolReturns true when the window is focused.
func IsWindowResized(): boolReturns true when the window is resized.
func IsWindowState(flag: u32): boolReturns true when the window has the given state flag.
func SetWindowState(flags: u32)Turns on window state flags.
func ClearWindowState(flags: u32)Turns off window state flags.
func ToggleFullscreen()Toggle fullscreen.
func ToggleBorderlessWindowed()Toggle borderless windowed.
func MaximizeWindow()Maximize window.
func MinimizeWindow()Minimize window.
func RestoreWindow()Restore window.
func SetWindowIcon(image: Image)Sets window icon.
func SetWindowTitle(title: str)Sets window title.
func SetWindowPosition(x: int, y: int)Sets window position.
func SetWindowMonitor(monitor: int)Sets window monitor.
func SetWindowMinSize(width: int, height: int)Sets window min size.
func SetWindowMaxSize(width: int, height: int)Sets window max size.
func SetWindowSize(width: int, height: int)Sets window size.
func SetWindowOpacity(opacity: f32)Sets window opacity.
func SetWindowFocused()Sets window focused.
func GetScreenWidth(): intReturns screen width.
func GetScreenHeight(): intReturns screen height.
func GetRenderWidth(): intReturns render width.
func GetRenderHeight(): intReturns render height.
func GetMonitorCount(): intReturns monitor count.
func GetCurrentMonitor(): intReturns current monitor.
func GetMonitorPosition(monitor: int): Vector2Returns monitor position.
func GetMonitorWidth(monitor: int): intReturns monitor width.
func GetMonitorHeight(monitor: int): intReturns monitor height.
func GetMonitorPhysicalWidth(monitor: int): intReturns monitor physical width.
func GetMonitorPhysicalHeight(monitor: int): intReturns monitor physical height.
func GetMonitorRefreshRate(monitor: int): intReturns monitor refresh rate.
func GetWindowPosition(): Vector2Returns window position.
func GetWindowScaleDPI(): Vector2Returns window scale DPI.
func GetMonitorName(monitor: int): strReturns monitor name.
func SetClipboardText(text: str)Sets clipboard text.
func GetClipboardText(): strReturns clipboard text.
func EnableEventWaiting()Enable event waiting.
func DisableEventWaiting()Disable event waiting.
func ShowCursor()Show cursor.
func HideCursor()Hide cursor.
func IsCursorHidden(): boolReturns true when cursor hidden holds.
func EnableCursor()Enable cursor.
func DisableCursor()Disable cursor.
func IsCursorOnScreen(): boolReturns true when cursor on screen holds.
func ClearBackground(color: Color)Clear background.
func BeginDrawing()Starts drawing mode; end it with the matching End call.
func EndDrawing()Ends drawing mode.
func BeginMode2D(camera: Camera2D)Starts 2D mode; end it with the matching End call.
func EndMode2D()Ends 2D mode.
func BeginMode3D(camera: Camera3D)Starts 3D mode; end it with the matching End call.
func EndMode3D()Ends 3D mode.
func BeginTextureMode(target: RenderTexture)Starts texture mode; end it with the matching End call.
func EndTextureMode()Ends texture mode.
func BeginShaderMode(shader: Shader)Starts shader mode; end it with the matching End call.
func EndShaderMode()Ends shader mode.
func BeginBlendMode(mode: int)Starts blend mode; end it with the matching End call.
func EndBlendMode()Ends blend mode.
func BeginScissorMode(x: int, y: int, width: int, height: int)Starts scissor mode; end it with the matching End call.
func EndScissorMode()Ends scissor mode.
func LoadShader(vsFileName: str, fsFileName: str): ShaderLoads shader and returns it.
func LoadShaderFromMemory(vsCode: str, fsCode: str): ShaderLoads shader from memory and returns it.
func IsShaderValid(shader: Shader): boolReturns true when the shader loaded correctly.
func GetShaderLocation(shader: Shader, uniformName: str): intReturns shader location.
func GetShaderLocationAttrib(shader: Shader, attribName: str): intReturns shader location attrib.
func SetShaderValue(shader: Shader, locIndex: int, value: void*, uniformType: int)Sets shader value.
func SetShaderValueV(shader: Shader, locIndex: int, value: void*, uniformType: int, count: int)Sets shader value.
func SetShaderValueMatrix(shader: Shader, locIndex: int, mat: Matrix)Sets shader value matrix.
func SetShaderValueTexture(shader: Shader, locIndex: int, texture: Texture)Sets shader value texture.
func UnloadShader(shader: Shader)Frees a loaded shader.
func GetScreenToWorldRay(position: Vector2, camera: Camera3D): RayReturns screen to world ray.
func GetScreenToWorldRayEx(position: Vector2, camera: Camera3D, width: int, height: int): RayReturns screen to world ray.
func GetWorldToScreen(position: Vector3, camera: Camera3D): Vector2Returns world to screen.
func GetWorldToScreenEx(position: Vector3, camera: Camera3D, width: int, height: int): Vector2Returns world to screen.
func GetWorldToScreen2D(position: Vector2, camera: Camera2D): Vector2Returns world to screen 2D.
func GetScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2Returns screen to world 2D.
func GetCameraMatrix(camera: Camera3D): MatrixReturns camera matrix.
func GetCameraMatrix2D(camera: Camera2D): MatrixReturns camera matrix 2D.
func SetTargetFPS(fps: int)Sets target FPS.
func GetFrameTime(): f32Returns frame time.
func GetTime(): f64Returns time.
func GetFPS(): intReturns FPS.
func SwapScreenBuffer()Swap screen buffer.
func PollInputEvents()Poll input events.
func WaitTime(seconds: f64)Wait time.
func SetRandomSeed(seed: u32)Sets random seed.
func GetRandomValue(min: int, max: int): intReturns random value.
func TakeScreenshot(fileName: str)Take screenshot.
func SetConfigFlags(flags: u32)Sets config flags.
func OpenURL(url: str)Open URL.
func SetTraceLogLevel(logLevel: int)Sets trace log level.
func MemAlloc(size: u32): void*Mem alloc.
func MemFree(ptr: void*)Mem free.
func FileExists(fileName: str): boolFile exists.
func DirectoryExists(dirPath: str): boolDirectory exists.
func IsFileExtension(fileName: str, ext: str): boolReturns true when file extension holds.
func GetFileLength(fileName: str): intReturns file length.
func GetFileExtension(fileName: str): strReturns file extension.
func GetFileName(filePath: str): strReturns file name.
func GetFileNameWithoutExt(filePath: str): strReturns file name without ext.
func GetDirectoryPath(filePath: str): strReturns directory path.
func GetPrevDirectoryPath(dirPath: str): strReturns prev directory path.
func GetWorkingDirectory(): strReturns working directory.
func GetApplicationDirectory(): strReturns application directory.
func ChangeDirectory(dir: str): boolChange directory.
func IsPathFile(path: str): boolReturns true when path file holds.
func IsFileNameValid(fileName: str): boolReturns true when the file name loaded correctly.
func LoadDirectoryFiles(dirPath: str): FilePathListLoads directory files and returns it.
func UnloadDirectoryFiles(files: FilePathList)Frees a loaded directory files.
func IsFileDropped(): boolReturns true when file dropped holds.
func LoadDroppedFiles(): FilePathListLoads dropped files and returns it.
func UnloadDroppedFiles(files: FilePathList)Frees a loaded dropped files.
func LoadFileText(fileName: str): strLoads file text and returns it.
func UnloadFileText(text: str)Frees a loaded file text.
func SaveFileText(fileName: str, text: str): boolSave file text.
func LoadFileData(fileName: str, dataSize &: int): u8*Loads file data and returns it.
func UnloadFileData(data: u8*)Frees a loaded file data.
func SaveFileData(fileName: str, data: void*, dataSize: int): boolSave file data.
func SetWindowOpacity(opacity: f64)Sets window opacity.
func GetFontDefault(): FontReturns font default.
func LoadFont(fileName: str): FontLoads font and returns it.
func LoadFontEx(fileName: str, fontSize: int, codepoints: int*, codepointCount: int): FontLoads font and returns it.
func LoadFontFromImage(image: Image, key: Color, firstChar: int): FontLoads font from image and returns it.
func IsFontValid(font: Font): boolReturns true when the font loaded correctly.
func UnloadFont(font: Font)Frees a loaded font.
func DrawFPS(posX: int, posY: int)Draws FPS.
func DrawText(text: str, posX: int, posY: int, fontSize: int, color: Color)Draws text.
func DrawTextEx(font: Font, text: str, position: Vector2, fontSize: f32, spacing: f32, tint: Color)Draws text.
func DrawTextPro(font: Font, text: str, position: Vector2, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color)Draws text.
func DrawTextCodepoint(font: Font, codepoint: int, position: Vector2, fontSize: f32, tint: Color)Draws text codepoint.
func SetTextLineSpacing(spacing: int)Sets text line spacing.
func MeasureText(text: str, fontSize: int): intMeasure text.
func MeasureTextEx(font: Font, text: str, fontSize: f32, spacing: f32): Vector2Measure text.
func GetGlyphIndex(font: Font, codepoint: int): intReturns glyph index.
func TextLength(text: str): u32Text length.
func TextIsEqual(text1: str, text2: str): boolText is equal.
func TextSubtext(text: str, position: int, length: int): strText subtext.
func TextReplace(text: str, search: str, replacement: str): strText replace.
func TextFindIndex(text: str, find: str): intText find index.
func TextToUpper(text: str): strText to upper.
func TextToLower(text: str): strText to lower.
func TextToPascal(text: str): strText to pascal.
func TextToSnake(text: str): strText to snake.
func TextToCamel(text: str): strText to camel.
func TextToInteger(text: str): intText to integer.
func DrawTextEx(font: Font, text: str, position: Vector2, fontSize: f64, spacing: f64, tint: Color)Draws text.
func DrawTextPro(font: Font, text: str, position: Vector2, origin: Vector2, rotation: f64, fontSize: f64, spacing: f64, tint: Color)Draws text.
func DrawTextCodepoint(font: Font, codepoint: int, position: Vector2, fontSize: f64, tint: Color)Draws text codepoint.
func MeasureTextEx(font: Font, text: str, fontSize: f64, spacing: f64): Vector2Measure text.
func SetShapesTexture(texture: Texture, source: Rectangle)Sets shapes texture.
func GetShapesTexture(): TextureReturns shapes texture.
func GetShapesTextureRectangle(): RectangleReturns shapes texture rectangle.
func DrawPixel(posX: int, posY: int, color: Color)Draws pixel.
func DrawPixelV(position: Vector2, color: Color)Draws pixel.
func DrawLine(startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color)Draws line.
func DrawLineV(startPos: Vector2, endPos: Vector2, color: Color)Draws line.
func DrawLineEx(startPos: Vector2, endPos: Vector2, thick: f32, color: Color)Draws line.
func DrawLineStrip(points: Vector2*, pointCount: int, color: Color)Draws line strip.
func DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: f32, color: Color)Draws line bezier.
func DrawCircle(centerX: int, centerY: int, radius: f32, color: Color)Draws circle.
import gui.raylib
func main:
raylib.InitWindow(400, 300, "Circles")
until not raylib.WindowShouldClose():
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawCircle(200, 150, 80.0, raylib.SkyBlue())
raylib.DrawCircleLines(200, 150, 80.0, raylib.DarkBlue())
raylib.EndDrawing()
end
raylib.CloseWindow()
endfunc DrawCircleSector(center: Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: int, color: Color)Draws circle sector.
func DrawCircleSectorLines(center: Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: int, color: Color)Draws circle sector lines.
func DrawCircleGradient(centerX: int, centerY: int, radius: f32, inner: Color, outer: Color)Draws circle gradient.
func DrawCircleV(center: Vector2, radius: f32, color: Color)Draws circle.
func DrawCircleLines(centerX: int, centerY: int, radius: f32, color: Color)Draws circle lines.
func DrawCircleLinesV(center: Vector2, radius: f32, color: Color)Draws circle lines.
func DrawEllipse(centerX: int, centerY: int, radiusH: f32, radiusV: f32, color: Color)Draws ellipse.
func DrawEllipseLines(centerX: int, centerY: int, radiusH: f32, radiusV: f32, color: Color)Draws ellipse lines.
func DrawRing(center: Vector2, innerRadius: f32, outerRadius: f32, startAngle: f32, endAngle: f32, segments: int, color: Color)Draws ring.
func DrawRingLines(center: Vector2, innerRadius: f32, outerRadius: f32, startAngle: f32, endAngle: f32, segments: int, color: Color)Draws ring lines.
func DrawRectangle(posX: int, posY: int, width: int, height: int, color: Color)Draws rectangle.
func DrawRectangleV(position: Vector2, size: Vector2, color: Color)Draws rectangle.
func DrawRectangleRec(rec: Rectangle, color: Color)Draws rectangle rectangle.
func DrawRectanglePro(rec: Rectangle, origin: Vector2, rotation: f32, color: Color)Draws rectangle.
func DrawRectangleGradientV(posX: int, posY: int, width: int, height: int, top: Color, bottom: Color)Draws rectangle gradient.
func DrawRectangleGradientH(posX: int, posY: int, width: int, height: int, left: Color, right: Color)Draws rectangle gradient h.
func DrawRectangleGradientEx(rec: Rectangle, topLeft: Color, bottomLeft: Color, topRight: Color, bottomRight: Color)Draws rectangle gradient.
func DrawRectangleLines(posX: int, posY: int, width: int, height: int, color: Color)Draws rectangle lines.
func DrawRectangleLinesEx(rec: Rectangle, lineThick: f32, color: Color)Draws rectangle lines.
func DrawRectangleRounded(rec: Rectangle, roundness: f32, segments: int, color: Color)Draws rectangle rounded.
func DrawTriangle(v1: Vector2, v2: Vector2, v3: Vector2, color: Color)Draws triangle.
func DrawTriangleLines(v1: Vector2, v2: Vector2, v3: Vector2, color: Color)Draws triangle lines.
func DrawTriangleFan(points: Vector2*, pointCount: int, color: Color)Draws triangle fan.
func DrawTriangleStrip(points: Vector2*, pointCount: int, color: Color)Draws triangle strip.
func DrawPoly(center: Vector2, sides: int, radius: f32, rotation: f32, color: Color)Draws poly.
func DrawPolyLines(center: Vector2, sides: int, radius: f32, rotation: f32, color: Color)Draws poly lines.
func DrawPolyLinesEx(center: Vector2, sides: int, radius: f32, rotation: f32, lineThick: f32, color: Color)Draws poly lines.
func DrawSplineLinear(points: Vector2*, pointCount: int, thick: f32, color: Color)Draws spline linear.
func DrawSplineBasis(points: Vector2*, pointCount: int, thick: f32, color: Color)Draws spline basis.
func DrawSplineCatmullRom(points: Vector2*, pointCount: int, thick: f32, color: Color)Draws spline catmull rom.
func DrawSplineBezierQuadratic(points: Vector2*, pointCount: int, thick: f32, color: Color)Draws spline bezier quadratic.
func DrawSplineBezierCubic(points: Vector2*, pointCount: int, thick: f32, color: Color)Draws spline bezier cubic.
func CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle): boolReturns true when the shapes (recs) collide.
import gui.raylib
func main:
raylib.InitWindow(400, 300, "Collision")
a := raylib.Rect(50.0, 50.0, 100.0, 100.0)
until not raylib.WindowShouldClose():
mouse := raylib.GetMousePosition()
b := raylib.Rect(mouse.x as f64, mouse.y as f64, 60.0, 60.0)
hit := raylib.CheckCollisionRecs(a, b)
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawRectangleRec(a, hit ? raylib.Red() : raylib.Green())
raylib.DrawRectangleRec(b, raylib.Fade(raylib.Blue(), 0.5))
raylib.EndDrawing()
end
raylib.CloseWindow()
endfunc CheckCollisionCircles(center1: Vector2, radius1: f32, center2: Vector2, radius2: f32): boolReturns true when the shapes (circles) collide.
func CheckCollisionCircleRec(center: Vector2, radius: f32, rec: Rectangle): boolReturns true when the shapes (circle rectangle) collide.
func CheckCollisionPointRec(point: Vector2, rec: Rectangle): boolReturns true when the shapes (point rectangle) collide.
func CheckCollisionPointCircle(point: Vector2, center: Vector2, radius: f32): boolReturns true when the shapes (point circle) collide.
func CheckCollisionPointTriangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2): boolReturns true when the shapes (point triangle) collide.
func CheckCollisionPointLine(point: Vector2, p1: Vector2, p2: Vector2, threshold: int): boolReturns true when the shapes (point line) collide.
func CheckCollisionPointPoly(point: Vector2, points: Vector2*, pointCount: int): boolReturns true when the shapes (point poly) collide.
func CheckCollisionLines(startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint &: Vector2): boolReturns true when the shapes (lines) collide.
func GetCollisionRec(rec1: Rectangle, rec2: Rectangle): RectangleReturns collision rectangle.
func DrawLineEx(startPos: Vector2, endPos: Vector2, thick: f64, color: Color)Draws line.
func DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: f64, color: Color)Draws line bezier.
func DrawCircle(centerX: int, centerY: int, radius: f64, color: Color)Draws circle.
The example for this item is shown with the ones above: gui-raylib-DrawCircle.salam
func DrawCircleSector(center: Vector2, radius: f64, startAngle: f64, endAngle: f64, segments: int, color: Color)Draws circle sector.
func DrawCircleSectorLines(center: Vector2, radius: f64, startAngle: f64, endAngle: f64, segments: int, color: Color)Draws circle sector lines.
func DrawCircleGradient(centerX: int, centerY: int, radius: f64, inner: Color, outer: Color)Draws circle gradient.
func DrawCircleV(center: Vector2, radius: f64, color: Color)Draws circle.
func DrawCircleLines(centerX: int, centerY: int, radius: f64, color: Color)Draws circle lines.
func DrawCircleLinesV(center: Vector2, radius: f64, color: Color)Draws circle lines.
func DrawEllipse(centerX: int, centerY: int, radiusH: f64, radiusV: f64, color: Color)Draws ellipse.
func DrawEllipseLines(centerX: int, centerY: int, radiusH: f64, radiusV: f64, color: Color)Draws ellipse lines.
func DrawRing(center: Vector2, innerRadius: f64, outerRadius: f64, startAngle: f64, endAngle: f64, segments: int, color: Color)Draws ring.
func DrawRingLines(center: Vector2, innerRadius: f64, outerRadius: f64, startAngle: f64, endAngle: f64, segments: int, color: Color)Draws ring lines.
func DrawRectanglePro(rec: Rectangle, origin: Vector2, rotation: f64, color: Color)Draws rectangle.
func DrawRectangleLinesEx(rec: Rectangle, lineThick: f64, color: Color)Draws rectangle lines.
func DrawRectangleRounded(rec: Rectangle, roundness: f64, segments: int, color: Color)Draws rectangle rounded.
func DrawPoly(center: Vector2, sides: int, radius: f64, rotation: f64, color: Color)Draws poly.
func DrawPolyLines(center: Vector2, sides: int, radius: f64, rotation: f64, color: Color)Draws poly lines.
func DrawPolyLinesEx(center: Vector2, sides: int, radius: f64, rotation: f64, lineThick: f64, color: Color)Draws poly lines.
func DrawSplineLinear(points: Vector2*, pointCount: int, thick: f64, color: Color)Draws spline linear.
func DrawSplineBasis(points: Vector2*, pointCount: int, thick: f64, color: Color)Draws spline basis.
func DrawSplineCatmullRom(points: Vector2*, pointCount: int, thick: f64, color: Color)Draws spline catmull rom.
func DrawSplineBezierQuadratic(points: Vector2*, pointCount: int, thick: f64, color: Color)Draws spline bezier quadratic.
func DrawSplineBezierCubic(points: Vector2*, pointCount: int, thick: f64, color: Color)Draws spline bezier cubic.
func CheckCollisionCircles(center1: Vector2, radius1: f64, center2: Vector2, radius2: f64): boolReturns true when the shapes (circles) collide.
func CheckCollisionCircleRec(center: Vector2, radius: f64, rec: Rectangle): boolReturns true when the shapes (circle rectangle) collide.
func CheckCollisionPointCircle(point: Vector2, center: Vector2, radius: f64): boolReturns true when the shapes (point circle) collide.
func DrawLine3D(startPos: Vector3, endPos: Vector3, color: Color)Draws line 3D.
func DrawPoint3D(position: Vector3, color: Color)Draws point 3D.
func DrawCircle3D(center: Vector3, radius: f32, rotationAxis: Vector3, rotationAngle: f32, color: Color)Draws circle 3D.
func DrawTriangle3D(v1: Vector3, v2: Vector3, v3: Vector3, color: Color)Draws triangle 3D.
func DrawTriangleStrip3D(points: Vector3*, pointCount: int, color: Color)Draws triangle strip 3D.
func DrawCube(position: Vector3, width: f32, height: f32, length: f32, color: Color)Draws cube.
func DrawCubeV(position: Vector3, size: Vector3, color: Color)Draws cube.
func DrawCubeWires(position: Vector3, width: f32, height: f32, length: f32, color: Color)Draws cube wires.
func DrawCubeWiresV(position: Vector3, size: Vector3, color: Color)Draws cube wires.
func DrawSphere(centerPos: Vector3, radius: f32, color: Color)Draws sphere.
func DrawSphereEx(centerPos: Vector3, radius: f32, rings: int, slices: int, color: Color)Draws sphere.
func DrawSphereWires(centerPos: Vector3, radius: f32, rings: int, slices: int, color: Color)Draws sphere wires.
func DrawCylinder(position: Vector3, radiusTop: f32, radiusBottom: f32, height: f32, slices: int, color: Color)Draws cylinder.
func DrawCylinderEx(startPos: Vector3, endPos: Vector3, startRadius: f32, endRadius: f32, sides: int, color: Color)Draws cylinder.
func DrawCylinderWires(position: Vector3, radiusTop: f32, radiusBottom: f32, height: f32, slices: int, color: Color)Draws cylinder wires.
func DrawCylinderWiresEx(startPos: Vector3, endPos: Vector3, startRadius: f32, endRadius: f32, sides: int, color: Color)Draws cylinder wires.
func DrawCapsule(startPos: Vector3, endPos: Vector3, radius: f32, slices: int, rings: int, color: Color)Draws capsule.
func DrawCapsuleWires(startPos: Vector3, endPos: Vector3, radius: f32, slices: int, rings: int, color: Color)Draws capsule wires.
func DrawPlane(centerPos: Vector3, size: Vector2, color: Color)Draws plane.
func DrawRay(ray: Ray, color: Color)Draws ray.
func DrawGrid(slices: int, spacing: f32)Draws grid.
func LoadModel(fileName: str): ModelLoads model and returns it.
func LoadModelFromMesh(mesh: Mesh): ModelLoads model from mesh and returns it.
func IsModelValid(model: Model): boolReturns true when the model loaded correctly.
func UnloadModel(model: Model)Frees a loaded model.
func GetModelBoundingBox(model: Model): BoundingBoxReturns model bounding box.
func DrawModel(model: Model, position: Vector3, scale: f32, tint: Color)Draws model.
func DrawModelEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color)Draws model.
func DrawModelWires(model: Model, position: Vector3, scale: f32, tint: Color)Draws model wires.
func DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color)Draws model wires.
func DrawBoundingBox(box: BoundingBox, color: Color)Draws bounding box.
func DrawBillboard(camera: Camera3D, texture: Texture, position: Vector3, scale: f32, tint: Color)Draws billboard.
func DrawBillboardRec(camera: Camera3D, texture: Texture, source: Rectangle, position: Vector3, size: Vector2, tint: Color)Draws billboard rectangle.
func UploadMesh(mesh &: Mesh, dynamic: bool)Upload mesh.
func UnloadMesh(mesh: Mesh)Frees a loaded mesh.
func DrawMesh(mesh: Mesh, material: Material, transform: Matrix)Draws mesh.
func GetMeshBoundingBox(mesh: Mesh): BoundingBoxReturns mesh bounding box.
func GenMeshTangents(mesh &: Mesh)Generates mesh tangents.
func ExportMesh(mesh: Mesh, fileName: str): boolExport mesh.
func GenMeshPoly(sides: int, radius: f32): MeshGenerates mesh poly.
func GenMeshPlane(width: f32, length: f32, resX: int, resZ: int): MeshGenerates mesh plane.
func GenMeshCube(width: f32, height: f32, length: f32): MeshGenerates mesh cube.
func GenMeshSphere(radius: f32, rings: int, slices: int): MeshGenerates mesh sphere.
func GenMeshHemiSphere(radius: f32, rings: int, slices: int): MeshGenerates mesh hemi sphere.
func GenMeshCylinder(radius: f32, height: f32, slices: int): MeshGenerates mesh cylinder.
func GenMeshCone(radius: f32, height: f32, slices: int): MeshGenerates mesh cone.
func GenMeshTorus(radius: f32, size: f32, radSeg: int, sides: int): MeshGenerates mesh torus.
func GenMeshKnot(radius: f32, size: f32, radSeg: int, sides: int): MeshGenerates mesh knot.
func GenMeshHeightmap(heightmap: Image, size: Vector3): MeshGenerates mesh heightmap.
func GenMeshCubicmap(cubicmap: Image, cubeSize: Vector3): MeshGenerates mesh cubicmap.
func LoadMaterialDefault(): MaterialLoads material default and returns it.
func IsMaterialValid(material: Material): boolReturns true when the material loaded correctly.
func UnloadMaterial(material: Material)Frees a loaded material.
func SetMaterialTexture(material &: Material, mapType: int, texture: Texture)Sets material texture.
func SetModelMeshMaterial(model &: Model, meshId: int, materialId: int)Sets model mesh material.
func LoadModelAnimations(fileName: str, animCount &: int): ModelAnimation*Loads model animations and returns it.
func UpdateModelAnimation(model: Model, anim: ModelAnimation, frame: int)Updates model animation.
func UnloadModelAnimation(anim: ModelAnimation)Frees a loaded model animation.
func UnloadModelAnimations(animations: ModelAnimation*, animCount: int)Frees a loaded model animations.
func IsModelAnimationValid(model: Model, anim: ModelAnimation): boolReturns true when the model animation loaded correctly.
func CheckCollisionSpheres(center1: Vector3, radius1: f32, center2: Vector3, radius2: f32): boolReturns true when the shapes (spheres) collide.
func CheckCollisionBoxes(box1: BoundingBox, box2: BoundingBox): boolReturns true when the shapes (boxes) collide.
func CheckCollisionBoxSphere(box: BoundingBox, center: Vector3, radius: f32): boolReturns true when the shapes (box sphere) collide.
func GetRayCollisionSphere(ray: Ray, center: Vector3, radius: f32): RayCollisionReturns ray collision sphere.
func GetRayCollisionBox(ray: Ray, box: BoundingBox): RayCollisionReturns ray collision box.
func GetRayCollisionMesh(ray: Ray, mesh: Mesh, transform: Matrix): RayCollisionReturns ray collision mesh.
func GetRayCollisionTriangle(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3): RayCollisionReturns ray collision triangle.
func GetRayCollisionQuad(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3): RayCollisionReturns ray collision quad.
func DrawCircle3D(center: Vector3, radius: f64, rotationAxis: Vector3, rotationAngle: f64, color: Color)Draws circle 3D.
func DrawCube(position: Vector3, width: f64, height: f64, length: f64, color: Color)Draws cube.
func DrawCubeWires(position: Vector3, width: f64, height: f64, length: f64, color: Color)Draws cube wires.
func DrawSphere(centerPos: Vector3, radius: f64, color: Color)Draws sphere.
func DrawSphereEx(centerPos: Vector3, radius: f64, rings: int, slices: int, color: Color)Draws sphere.
func DrawSphereWires(centerPos: Vector3, radius: f64, rings: int, slices: int, color: Color)Draws sphere wires.
func DrawCylinder(position: Vector3, radiusTop: f64, radiusBottom: f64, height: f64, slices: int, color: Color)Draws cylinder.
func DrawCylinderEx(startPos: Vector3, endPos: Vector3, startRadius: f64, endRadius: f64, sides: int, color: Color)Draws cylinder.
func DrawCylinderWires(position: Vector3, radiusTop: f64, radiusBottom: f64, height: f64, slices: int, color: Color)Draws cylinder wires.
func DrawCylinderWiresEx(startPos: Vector3, endPos: Vector3, startRadius: f64, endRadius: f64, sides: int, color: Color)Draws cylinder wires.
func DrawCapsule(startPos: Vector3, endPos: Vector3, radius: f64, slices: int, rings: int, color: Color)Draws capsule.
func DrawCapsuleWires(startPos: Vector3, endPos: Vector3, radius: f64, slices: int, rings: int, color: Color)Draws capsule wires.
func DrawGrid(slices: int, spacing: f64)Draws grid.
func DrawModel(model: Model, position: Vector3, scale: f64, tint: Color)Draws model.
func DrawModelEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f64, scale: Vector3, tint: Color)Draws model.
func DrawModelWires(model: Model, position: Vector3, scale: f64, tint: Color)Draws model wires.
func DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f64, scale: Vector3, tint: Color)Draws model wires.
func DrawBillboard(camera: Camera3D, texture: Texture, position: Vector3, scale: f64, tint: Color)Draws billboard.
func GenMeshPoly(sides: int, radius: f64): MeshGenerates mesh poly.
func GenMeshPlane(width: f64, length: f64, resX: int, resZ: int): MeshGenerates mesh plane.
func GenMeshCube(width: f64, height: f64, length: f64): MeshGenerates mesh cube.
func GenMeshSphere(radius: f64, rings: int, slices: int): MeshGenerates mesh sphere.
func GenMeshHemiSphere(radius: f64, rings: int, slices: int): MeshGenerates mesh hemi sphere.
func GenMeshCylinder(radius: f64, height: f64, slices: int): MeshGenerates mesh cylinder.
func GenMeshCone(radius: f64, height: f64, slices: int): MeshGenerates mesh cone.
func GenMeshTorus(radius: f64, size: f64, radSeg: int, sides: int): MeshGenerates mesh torus.
func GenMeshKnot(radius: f64, size: f64, radSeg: int, sides: int): MeshGenerates mesh knot.
func CheckCollisionSpheres(center1: Vector3, radius1: f64, center2: Vector3, radius2: f64): boolReturns true when the shapes (spheres) collide.
func CheckCollisionBoxSphere(box: BoundingBox, center: Vector3, radius: f64): boolReturns true when the shapes (box sphere) collide.
func GetRayCollisionSphere(ray: Ray, center: Vector3, radius: f64): RayCollisionReturns ray collision sphere.
func InitAudioDevice()Init audio device.
func CloseAudioDevice()Close audio device.
func IsAudioDeviceReady(): boolReturns true when audio device ready holds.
func SetMasterVolume(volume: f32)Sets master volume.
func GetMasterVolume(): f32Returns master volume.
func LoadWave(fileName: str): WaveLoads wave and returns it.
func IsWaveValid(wave: Wave): boolReturns true when the wave loaded correctly.
func LoadSound(fileName: str): SoundLoads sound and returns it.
func LoadSoundFromWave(wave: Wave): SoundLoads sound from wave and returns it.
func LoadSoundAlias(source: Sound): SoundLoads sound alias and returns it.
func IsSoundValid(sound: Sound): boolReturns true when the sound loaded correctly.
func UpdateSound(sound: Sound, data: void*, sampleCount: int)Updates sound.
func UnloadWave(wave: Wave)Frees a loaded wave.
func UnloadSound(sound: Sound)Frees a loaded sound.
func UnloadSoundAlias(alias: Sound)Frees a loaded sound alias.
func ExportWave(wave: Wave, fileName: str): boolExport wave.
func PlaySound(sound: Sound)Play sound.
import gui.raylib
func main:
raylib.InitWindow(400, 300, "Sound")
raylib.InitAudioDevice()
beep := raylib.LoadSound("beep.wav")
until not raylib.WindowShouldClose():
if raylib.IsKeyPressed(raylib.KEY_SPACE):
raylib.PlaySound(beep)
end
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite())
raylib.DrawText("Press space", 130, 140, 24, raylib.DarkGray())
raylib.EndDrawing()
end
raylib.UnloadSound(beep)
raylib.CloseAudioDevice()
raylib.CloseWindow()
endfunc StopSound(sound: Sound)Stop sound.
func PauseSound(sound: Sound)Pause sound.
func ResumeSound(sound: Sound)Resume sound.
func IsSoundPlaying(sound: Sound): boolReturns true when sound playing holds.
func SetSoundVolume(sound: Sound, volume: f32)Sets sound volume.
func SetSoundPitch(sound: Sound, pitch: f32)Sets sound pitch.
func SetSoundPan(sound: Sound, pan: f32)Sets sound pan.
func WaveCopy(wave: Wave): WaveWave copy.
func WaveCrop(wave &: Wave, initFrame: int, finalFrame: int)Wave crop.
func WaveFormat(wave &: Wave, sampleRate: int, sampleSize: int, channels: int)Wave format.
func LoadWaveSamples(wave: Wave): f32*Loads wave samples and returns it.
func UnloadWaveSamples(samples: f32*)Frees a loaded wave samples.
func LoadMusicStream(fileName: str): MusicLoads music stream and returns it.
func IsMusicValid(music: Music): boolReturns true when the music loaded correctly.
func UnloadMusicStream(music: Music)Frees a loaded music stream.
func PlayMusicStream(music: Music)Play music stream.
func IsMusicStreamPlaying(music: Music): boolReturns true when music stream playing holds.
func UpdateMusicStream(music: Music)Updates music stream.
func StopMusicStream(music: Music)Stop music stream.
func PauseMusicStream(music: Music)Pause music stream.
func ResumeMusicStream(music: Music)Resume music stream.
func SeekMusicStream(music: Music, position: f32)Seek music stream.
func SetMusicVolume(music: Music, volume: f32)Sets music volume.
func SetMusicPitch(music: Music, pitch: f32)Sets music pitch.
func SetMusicPan(music: Music, pan: f32)Sets music pan.
func GetMusicTimeLength(music: Music): f32Returns music time length.
func GetMusicTimePlayed(music: Music): f32Returns music time played.
func SetMasterVolume(volume: f64)Sets master volume.
func SetSoundVolume(sound: Sound, volume: f64)Sets sound volume.
func SetSoundPitch(sound: Sound, pitch: f64)Sets sound pitch.
func SetSoundPan(sound: Sound, pan: f64)Sets sound pan.
func SeekMusicStream(music: Music, position: f64)Seek music stream.
func SetMusicVolume(music: Music, volume: f64)Sets music volume.
func SetMusicPitch(music: Music, pitch: f64)Sets music pitch.
func SetMusicPan(music: Music, pan: f64)Sets music pan.
func Vec2(x: f64, y: f64): Vector2Builds a Vector2 from f64 values.
func Vec3(x: f64, y: f64, z: f64): Vector3Builds a Vector3 from f64 values.
func Vec4(x: f64, y: f64, z: f64, w: f64): Vector4Builds a Vector4 from f64 values.
func Rect(x: f64, y: f64, width: f64, height: f64): RectangleBuilds a Rectangle from f64 values.
func RGB(r: int, g: int, b: int): ColorBuilds an opaque Color from red, green and blue values.
func RGBA(r: int, g: int, b: int, a: int): ColorBuilds a Color from red, green, blue and alpha values.
func NewCamera2D(offset: Vector2, target: Vector2, rotation: f64, zoom: f64): Camera2DBuilds a Camera2D from f64 values.
func NewCamera3D(position: Vector3, target: Vector3, up: Vector3, fovy: f64, projection: int): Camera3DBuilds a Camera3D from f64 values.
func LightGray(): ColorThe raylib LightGray color.
func Gray(): ColorThe raylib Gray color.
func DarkGray(): ColorThe raylib DarkGray color.
func Yellow(): ColorThe raylib Yellow color.
func Gold(): ColorThe raylib Gold color.
func Orange(): ColorThe raylib Orange color.
func Pink(): ColorThe raylib Pink color.
func Red(): ColorThe raylib Red color.
func Maroon(): ColorThe raylib Maroon color.
func Green(): ColorThe raylib Green color.
func Lime(): ColorThe raylib Lime color.
func DarkGreen(): ColorThe raylib DarkGreen color.
func SkyBlue(): ColorThe raylib SkyBlue color.
func Blue(): ColorThe raylib Blue color.
func DarkBlue(): ColorThe raylib DarkBlue color.
func Purple(): ColorThe raylib Purple color.
func Violet(): ColorThe raylib Violet color.
func DarkPurple(): ColorThe raylib DarkPurple color.
func Beige(): ColorThe raylib Beige color.
func Brown(): ColorThe raylib Brown color.
func DarkBrown(): ColorThe raylib DarkBrown color.
func White(): ColorThe raylib White color.
func Black(): ColorThe raylib Black color.
func Blank(): ColorThe raylib Blank color.
func Magenta(): ColorThe raylib Magenta color.
func RayWhite(): ColorThe raylib RayWhite color.