Created
February 7, 2021 23:18
-
-
Save LemoNode/38b8e8df165fff845a33f6a693d10d03 to your computer and use it in GitHub Desktop.
Ion raylib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Audio device management functions | |
@foreign func InitAudioDevice(); | |
@foreign func CloseAudioDevice(); | |
@foreign func IsAudioDeviceReady(): bool; | |
@foreign func SetMasterVolume(volume: float); | |
// Wave/loading: Sound/unloading functions | |
@foreign func LoadWave(fileName: char* const): Wave; | |
@foreign func LoadWaveFromMemory(fileType: char* const, fileData: uchar* const, dataSize: int): Wave; | |
@foreign func LoadSound(fileName: char* const): Sound; | |
@foreign func LoadSoundFromWave(wave: Wave): Sound; | |
@foreign func UpdateSound(sound: Sound, data: void* const, samplesCount: int); | |
@foreign func UnloadWave(wave: Wave); | |
@foreign func UnloadSound(sound: Sound); | |
@foreign func ExportWave(wave: Wave, fileName: char* const): bool; | |
@foreign func ExportWaveAsCode(wave: Wave, fileName: char* const): bool; | |
// Wave/management: Sound functions | |
@foreign func PlaySound(sound: Sound); | |
@foreign func StopSound(sound: Sound); | |
@foreign func PauseSound(sound: Sound); | |
@foreign func ResumeSound(sound: Sound); | |
@foreign func PlaySoundMulti(sound: Sound); | |
@foreign func StopSoundMulti(); | |
@foreign func GetSoundsPlaying(): int; | |
@foreign func IsSoundPlaying(sound: Sound): bool; | |
@foreign func SetSoundVolume(sound: Sound, volume: float); | |
@foreign func SetSoundPitch(sound: Sound, pitch: float); | |
@foreign func WaveFormat(wave: Wave*, sampleRate: int, sampleSize: int, channels: int); | |
@foreign func WaveCopy(wave: Wave): Wave; | |
@foreign func WaveCrop(wave: Wave*, initSample: int, finalSample: int); | |
@foreign func LoadWaveSamples(wave: Wave): float*; | |
@foreign func UnloadWaveSamples(samples: float*); | |
// management: Music functions | |
@foreign func LoadMusicStream(fileName: char* const): Music; | |
@foreign func UnloadMusicStream(music: Music); | |
@foreign func PlayMusicStream(music: Music); | |
@foreign func UpdateMusicStream(music: Music); | |
@foreign func StopMusicStream(music: Music); | |
@foreign func PauseMusicStream(music: Music); | |
@foreign func ResumeMusicStream(music: Music); | |
@foreign func IsMusicPlaying(music: Music): bool; | |
@foreign func SetMusicVolume(music: Music, volume: float); | |
@foreign func SetMusicPitch(music: Music, pitch: float); | |
@foreign func GetMusicTimeLength(music: Music): float; | |
@foreign func GetMusicTimePlayed(music: Music): float; | |
// management: AudioStream functions | |
@foreign func InitAudioStream(sampleRate: uint, sampleSize: uint, channels: uint): AudioStream; | |
@foreign func UpdateAudioStream(stream: AudioStream, data: void* const, samplesCount: int); | |
@foreign func CloseAudioStream(stream: AudioStream); | |
@foreign func IsAudioStreamProcessed(stream: AudioStream): bool; | |
@foreign func PlayAudioStream(stream: AudioStream); | |
@foreign func PauseAudioStream(stream: AudioStream); | |
@foreign func ResumeAudioStream(stream: AudioStream); | |
@foreign func IsAudioStreamPlaying(stream: AudioStream): bool; | |
@foreign func StopAudioStream(stream: AudioStream); | |
@foreign func SetAudioStreamVolume(stream: AudioStream, volume: float); | |
@foreign func SetAudioStreamPitch(stream: AudioStream, pitch: float); | |
@foreign func SetAudioStreamBufferSizeDefault(size: int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for %%I in (.) do set currdir=%%~nxI | |
set flags=-MT -nologo -GR- -Od -Oi -WX -FC -Z7 | |
set links=/link /SUBSYSTEM:CONSOLE -incremental:no -opt:ref | |
set wlibs=raylibdll.lib raylib.lib | |
ion %currdir% | |
cl %flags% out_%currdir%.c %links% %wlibs% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#foreign(header = "<raylib.h>") | |
// Window-related functions | |
@foreign func InitWindow(width: int, height: int, title: char* const); | |
@foreign func WindowShouldClose(): bool; | |
@foreign func CloseWindow(); | |
@foreign func IsWindowReady(): bool; | |
@foreign func IsWindowFullscreen(): bool; | |
@foreign func IsWindowHidden(): bool; | |
@foreign func IsWindowMinimized(): bool; | |
@foreign func IsWindowMaximized(): bool; | |
@foreign func IsWindowFocused(): bool; | |
@foreign func IsWindowResized(): bool; | |
@foreign func IsWindowState(flag: uint): bool; | |
@foreign func SetWindowState(flags: uint); | |
@foreign func ClearWindowState(flags: uint); | |
@foreign func ToggleFullscreen(); | |
@foreign func MaximizeWindow(); | |
@foreign func MinimizeWindow(); | |
@foreign func RestoreWindow(); | |
@foreign func SetWindowIcon(image: Image); | |
@foreign func SetWindowTitle(title: char* const); | |
@foreign func SetWindowPosition(x: int, y: int); | |
@foreign func SetWindowMonitor(monitor: int); | |
@foreign func SetWindowMinSize(width: int, height: int); | |
@foreign func SetWindowSize(width: int, height: int); | |
@foreign func GetWindowHandle(): void*; | |
@foreign func GetScreenWidth(): int; | |
@foreign func GetScreenHeight(): int; | |
@foreign func GetMonitorCount(): int; | |
@foreign func GetMonitorPosition(monitor: int): Vector2; | |
@foreign func GetMonitorWidth(monitor: int): int; | |
@foreign func GetMonitorHeight(monitor: int): int; | |
@foreign func GetMonitorPhysicalWidth(monitor: int): int; | |
@foreign func GetMonitorPhysicalHeight(monitor: int): int; | |
@foreign func GetMonitorRefreshRate(monitor: int): int; | |
@foreign func GetWindowPosition(): Vector2; | |
@foreign func GetWindowScaleDPI(): Vector2; | |
@foreign func GetMonitorName(monitor: int): char* const; | |
@foreign func SetClipboardText(text: char* const); | |
@foreign func GetClipboardText(): char* const; | |
// Cursor-related functions | |
@foreign func ShowCursor(); | |
@foreign func HideCursor(); | |
@foreign func IsCursorHidden(): bool; | |
@foreign func EnableCursor(); | |
@foreign func DisableCursor(); | |
@foreign func IsCursorOnScreen(): bool; | |
// Drawing-related functions | |
@foreign func ClearBackground(color: Color); | |
@foreign func BeginDrawing(); | |
@foreign func EndDrawing(); | |
@foreign func BeginMode2D(camera: Camera2D); | |
@foreign func EndMode2D(); | |
@foreign func BeginMode3D(camera: Camera3D); | |
@foreign func EndMode3D(); | |
@foreign func BeginTextureMode(target: RenderTexture2D); | |
@foreign func EndTextureMode(); | |
@foreign func BeginScissorMode(x: int, y: int, width: int, height: int); | |
@foreign func EndScissorMode(); | |
// Screen-space-related functions | |
@foreign func GetMouseRay(mousePosition: Vector2, camera: Camera): Ray; | |
@foreign func GetCameraMatrix(camera: Camera): Matrix; | |
@foreign func GetCameraMatrix2D(camera: Camera2D): Matrix; | |
@foreign func GetWorldToScreen(position: Vector3, camera: Camera): Vector2; | |
@foreign func GetWorldToScreenEx(position: Vector3, camera: Camera, width: int, height: int): Vector2; | |
@foreign func GetWorldToScreen2D(position: Vector2, camera: Camera2D): Vector2; | |
@foreign func GetScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2; | |
// Timing-related functions | |
@foreign func SetTargetFPS(fps: int); | |
@foreign func GetFPS(): int; | |
@foreign func GetFrameTime(): float; | |
@foreign func GetTime(): double; | |
// Misc. functions | |
@foreign func SetConfigFlags(flags: uint); | |
@foreign func SetTraceLogLevel(logType: int); | |
@foreign func SetTraceLogExit(logType: int); | |
@foreign func SetTraceLogCallback(callback: TraceLogCallback); | |
@foreign func TraceLog(logType: int, text: char* const, ...); | |
@foreign func MemAlloc(size: int): void*; | |
@foreign func MemFree(ptr: void*); | |
@foreign func TakeScreenshot(fileName: char* const); | |
@foreign func GetRandomValue(min: int, max: int): int; | |
// Files management functions | |
@foreign func LoadFileData(fileName: char* const, bytesRead: uint*): uchar*; | |
@foreign func UnloadFileData(data: uchar*); | |
@foreign func SaveFileData(fileName: char* const, data: void*, bytesToWrite: uint): bool; | |
@foreign func LoadFileText(fileName: char* const ): char*; | |
@foreign func UnloadFileText(text: uchar*); | |
@foreign func SaveFileText(fileName: char* const, text: char*): bool; | |
@foreign func FileExists(fileName: char* const): bool; | |
@foreign func DirectoryExists(dirPath: char* const): bool; | |
@foreign func IsFileExtension(fileName: char* const, ext: char* const): bool; | |
@foreign func GetFileExtension(fileName: char* const): char* const; | |
@foreign func GetFileName(filePath: char* const): char* const; | |
@foreign func GetFileNameWithoutExt(filePath: char* const): char* const; | |
@foreign func GetDirectoryPath(filePath: char* const): char* const; | |
@foreign func GetPrevDirectoryPath(dirPath: char* const): char* const; | |
@foreign func GetWorkingDirectory(): char* const; | |
@foreign func GetDirectoryFiles(dirPath: char* const, count: int*): char**; | |
@foreign func ClearDirectoryFiles(); | |
@foreign func ChangeDirectory(dir: char* const): bool; | |
@foreign func IsFileDropped(): bool; | |
@foreign func GetDroppedFiles(count: int*): char**; | |
@foreign func ClearDroppedFiles(); | |
@foreign func GetFileModTime(fileName: char* const): long; | |
@foreign func CompressData(data: uchar*, dataLength: int, compDataLength: int*): uchar*; | |
@foreign func DecompressData(compData: uchar*, compDataLength: int, dataLength: int*): uchar*; | |
// Persistent storage management | |
@foreign func SaveStorageValue(position: uint, value: int): bool; | |
@foreign func LoadStorageValue(position: uint): int; | |
@foreign func OpenURL(url: char* const); | |
// Input-related functions: keyboard | |
@foreign func IsKeyPressed(key: int): bool; | |
@foreign func IsKeyDown(key: int): bool; | |
@foreign func IsKeyReleased(key: int): bool; | |
@foreign func IsKeyUp(key: int): bool; | |
@foreign func SetExitKey(key: int); | |
@foreign func GetKeyPressed(): int; | |
@foreign func GetCharPressed(): int; | |
// Input-related functions: gamepads | |
@foreign func IsGamepadAvailable(gamepad: int): bool; | |
@foreign func IsGamepadName(gamepad: int, name: char* const): bool; | |
@foreign func GetGamepadName(gamepad: int): char* const; | |
@foreign func IsGamepadButtonPressed(gamepad: int, button: int): bool; | |
@foreign func IsGamepadButtonDown(gamepad: int, button: int): bool; | |
@foreign func IsGamepadButtonReleased(gamepad: int, button: int): bool; | |
@foreign func IsGamepadButtonUp(gamepad: int, button: int): bool; | |
@foreign func GetGamepadButtonPressed(): int; | |
@foreign func GetGamepadAxisCount(gamepad: int): int; | |
@foreign func GetGamepadAxisMovement(gamepad: int, axis: int): float; | |
// Input-related functions: mouse | |
@foreign func IsMouseButtonPressed(button: int): bool; | |
@foreign func IsMouseButtonDown(button: int): bool; | |
@foreign func IsMouseButtonReleased(button: int): bool; | |
@foreign func IsMouseButtonUp(button: int): bool; | |
@foreign func GetMouseX(): int; | |
@foreign func GetMouseY(): int; | |
@foreign func GetMousePosition(): Vector2; | |
@foreign func SetMousePosition(x: int, y: int); | |
@foreign func SetMouseOffset(offsetX: int, offsetY: int); | |
@foreign func SetMouseScale(scaleX: float, scaleY: float); | |
@foreign func GetMouseWheelMove(): float; | |
@foreign func GetMouseCursor(): int; | |
@foreign func SetMouseCursor(cursor: int); | |
// Input-related functions: touch | |
@foreign func GetTouchX(): int; | |
@foreign func GetTouchY(): int; | |
@foreign func GetTouchPosition(index: int): Vector2; | |
@foreign func SetGesturesEnabled(gestureFlags: uint); | |
@foreign func IsGestureDetected(gesture: int): bool; | |
@foreign func GetGestureDetected(): int; | |
@foreign func GetTouchPointsCount(): int; | |
@foreign func GetGestureHoldDuration(): float; | |
@foreign func GetGestureDragVector(): Vector2; | |
@foreign func GetGestureDragAngle(): float; | |
@foreign func GetGesturePinchVector(): Vector2; | |
@foreign func GetGesturePinchAngle(): float; | |
// Camera stuff | |
@foreign func SetCameraMode(camera: Camera, mode: int); | |
@foreign func UpdateCamera(camera: Camera*); | |
@foreign func SetCameraPanControl(keyPan: int); | |
@foreign func SetCameraAltControl(keyAlt: int); | |
@foreign func SetCameraSmoothZoomControl(keySmoothZoom: int); | |
@foreign func SetCameraMoveControls(frontKey: int, backKey: int, rightKey: int, leftKey: int, upKey: int, downKey: int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libc | |
import ray | |
enum GameScreen = uint8 { | |
LOGO, | |
TITLE , | |
GAMEPLAY, | |
ENDING, | |
} | |
const screenWidth = 800; | |
const screenHeight = 450; | |
func main(): int { | |
ray.InitWindow(screenWidth, screenHeight, "raylib template - simple game"); | |
currentScreen: GameScreen = LOGO; | |
framesCounter: int = 0; | |
ray.SetTargetFPS(60); | |
while (!ray.WindowShouldClose()) { | |
switch (currentScreen) { | |
case LOGO: | |
framesCounter++; | |
if (framesCounter > 120) { | |
currentScreen = TITLE; | |
} | |
case TITLE: | |
if (ray.IsKeyPressed('P')) { | |
currentScreen = GAMEPLAY; | |
} | |
case GAMEPLAY: | |
if (ray.IsKeyPressed('P')) { | |
currentScreen = ENDING; | |
} | |
case ENDING: | |
if (ray.IsKeyPressed('P')) { | |
currentScreen = TITLE; | |
} | |
default: | |
break; | |
} | |
ray.BeginDrawing(); | |
ray.ClearBackground(ray.RAYWHITE); | |
switch (currentScreen) { | |
case LOGO: | |
ray.DrawText("LOGO SCREEN", 20, 20, 40, ray.LIGHTGRAY); | |
ray.DrawText("WAIT for 2 SECONDS...", 290, 220, 20, ray.GRAY); | |
case TITLE: | |
ray.DrawRectangle(0, 0, screenWidth, screenHeight, ray.GREEN); | |
ray.DrawText("TITLE SCREEN", 20, 20, 40, ray.DARKGREEN); | |
ray.DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, ray.DARKGREEN); | |
case GAMEPLAY: | |
ray.DrawRectangle(0, 0, screenWidth, screenHeight, ray.PURPLE); | |
ray.DrawText("GAMEPLAY SCREEN", 20, 20, 40, ray.MAROON); | |
ray.DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, ray.MAROON); | |
case ENDING: | |
ray.DrawRectangle(0, 0, screenWidth, screenHeight, ray.BLUE); | |
ray.DrawText("ENDING SCREEN", 20, 20, 40, ray.DARKBLUE); | |
ray.DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, ray.DARKBLUE); | |
default: | |
break; | |
} | |
ray.EndDrawing(); | |
} | |
ray.CloseWindow(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic geometric 3D shapes drawing functions | |
@foreign func DrawLine3D(startPos: Vector3, endPos: Vector3, color: Color); | |
@foreign func DrawPoint3D(position: Vector3, color: Color); | |
@foreign func DrawCircle3D(center: Vector3, radius: float, rotationAxis: Vector3, rotationAngle: float, color: Color); | |
@foreign func DrawTriangle3D(v1: Vector3, v2: Vector3, v3: Vector3, color: Color); | |
@foreign func DrawTriangleStrip3D(points: Vector3*, pointsCount: int, color: Color); | |
@foreign func DrawCube(position: Vector3, width: float, height: float, length: float, color: Color); | |
@foreign func DrawCubeV(position: Vector3, size: Vector3, color: Color); | |
@foreign func DrawCubeWires(position: Vector3, width: float, height: float, length: float, color: Color); | |
@foreign func DrawCubeWiresV(position: Vector3, size: Vector3, color: Color); | |
@foreign func DrawCubeTexture(texture: Texture2D, position: Vector3, width: float, height: float, length: float, color: Color); | |
@foreign func DrawSphere(centerPos: Vector3, radius: float, color: Color); | |
@foreign func DrawSphereEx(centerPos: Vector3, radius: float, rings: int, slices: int, color: Color); | |
@foreign func DrawSphereWires(centerPos: Vector3, radius: float, rings: int, slices: int, color: Color); | |
@foreign func DrawCylinder(position: Vector3, radiusTop: float, radiusBottom: float, height: float, slices: int, color: Color); | |
@foreign func DrawCylinderWires(position: Vector3, radiusTop: float, radiusBottom: float, height: float, slices: int, color: Color); | |
@foreign func DrawPlane(centerPos: Vector3, size: Vector2, color: Color); | |
@foreign func DrawRay(ray: Ray, color: Color); | |
@foreign func DrawGrid(slices: int, spacing: float); | |
@foreign func DrawGizmo(position: Vector3); | |
// loading: Model/unloading functions | |
@foreign func LoadModel(fileName: char* const): Model; | |
@foreign func LoadModelFromMesh(mesh: Mesh): Model; | |
@foreign func UnloadModel(model: Model); | |
@foreign func UnloadModelKeepMeshes(model: Model); | |
// loading: Mesh/unloading functions | |
@foreign func LoadMeshes(fileName: char* const, meshCount: int*): Mesh*; | |
@foreign func UnloadMesh(mesh: Mesh); | |
@foreign func ExportMesh(mesh: Mesh, fileName: char* const): bool; | |
// loading: Material/unloading functions | |
@foreign func LoadMaterials(fileName: char* const, materialCount: int*): Material*; | |
@foreign func LoadMaterialDefault(): Material; | |
@foreign func UnloadMaterial(material: Material); | |
@foreign func SetMaterialTexture(material: Material*, mapType: int, texture: Texture2D); | |
@foreign func SetModelMeshMaterial(model: Model*, meshId: int, materialId: int); | |
// animations: Model loading/unloading functions | |
@foreign func LoadModelAnimations(fileName: char* const, animsCount: int*): ModelAnimation*; | |
@foreign func UpdateModelAnimation(model: Model, anim: ModelAnimation, frame: int); | |
@foreign func UnloadModelAnimation(anim: ModelAnimation); | |
@foreign func IsModelAnimationValid(model: Model, anim: ModelAnimation): bool; | |
// generation: Mesh functions | |
@foreign func GenMeshPoly(sides: int, radius: float): Mesh; | |
@foreign func GenMeshPlane(width: float, length: float, resX: int, resZ: int): Mesh; | |
@foreign func GenMeshCube(width: float, height: float, length: float): Mesh; | |
@foreign func GenMeshSphere(radius: float, rings: int, slices: int): Mesh; | |
@foreign func GenMeshHemiSphere(radius: float, rings: int, slices: int): Mesh; | |
@foreign func GenMeshCylinder(radius: float, height: float, slices: int): Mesh; | |
@foreign func GenMeshTorus(radius: float, size: float, radSeg: int, sides: int): Mesh; | |
@foreign func GenMeshKnot(radius: float, size: float, radSeg: int, sides: int): Mesh; | |
@foreign func GenMeshHeightmap(heightmap: Image, size: Vector3): Mesh; | |
@foreign func GenMeshCubicmap(cubicmap: Image, cubeSize: Vector3): Mesh; | |
// manipulation: Mesh functions | |
@foreign func MeshBoundingBox(mesh: Mesh): BoundingBox; | |
@foreign func MeshTangents(mesh: Mesh*); | |
@foreign func MeshBinormals(mesh: Mesh*); | |
@foreign func MeshNormalsSmooth(mesh: Mesh*); | |
// drawing: Model functions | |
@foreign func DrawModel(model: Model, position: Vector3, scale: float, tint: Color); | |
@foreign func DrawModelEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: float, scale: Vector3, tint: Color); | |
@foreign func DrawModelWires(model: Model, position: Vector3, scale: float, tint: Color); | |
@foreign func DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: float, scale: Vector3, tint: Color); | |
@foreign func DrawBoundingBox(box: BoundingBox, color: Color); | |
@foreign func DrawBillboard(camera: Camera, texture: Texture2D, center: Vector3, size: float, tint: Color); | |
@foreign func DrawBillboardRec(camera: Camera, texture: Texture2D, source: Rectangle, center: Vector3, size: float, tint: Color); | |
// Collision detection functions | |
@foreign func CheckCollisionSpheres(center1: Vector3, radius1: float, center2: Vector3, radius2: float): bool; | |
@foreign func CheckCollisionBoxes(box1: BoundingBox, box2: BoundingBox): bool; | |
@foreign func CheckCollisionBoxSphere(box: BoundingBox, center: Vector3, radius: float): bool; | |
@foreign func CheckCollisionRaySphere(ray: Ray, center: Vector3, radius: float): bool; | |
@foreign func CheckCollisionRaySphereEx(ray: Ray, center: Vector3, radius: float, collisionPoint: Vector3*): bool; | |
@foreign func CheckCollisionRayBox(ray: Ray, box: BoundingBox): bool; | |
@foreign func GetCollisionRayMesh(ray: Ray, mesh: Mesh, transform: Matrix): RayHitInfo; | |
@foreign func GetCollisionRayModel(ray: Ray, model: Model): RayHitInfo; | |
@foreign func GetCollisionRayTriangle(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3): RayHitInfo; | |
@foreign func GetCollisionRayGround(ray: Ray, groundHeight: float): RayHitInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libc | |
#foreign(header = "<raylib.h>") | |
enum { | |
MaxShaderLocations = 32, | |
MaxMaterialMaps = 12, | |
} | |
@foreign struct Vector2 { | |
x, y: float; | |
} | |
@foreign struct Vector3 { | |
x, y, z: float; | |
} | |
@foreign struct Vector4 { | |
x, y, z, w: float; | |
} | |
@foreign typedef Quaternion = Vector4; | |
@foreign struct Matrix { | |
m0: float; | |
m4: float; | |
m8: float; | |
m12: float; | |
m1: float; | |
m5: float; | |
m9: float; | |
m13: float; | |
m2: float; | |
m6: float; | |
m10: float; | |
m14: float; | |
m3: float; | |
m7: float; | |
m11: float; | |
m15: float; | |
} | |
@foreign struct Color { | |
r, g, b, a: uint8; | |
} | |
@foreign struct Rectangle { | |
x: float; | |
y: float; | |
width: float; | |
height: float; | |
} | |
@foreign struct Image { | |
width: int; | |
height: int; | |
mipmaps: int; | |
format: int; // PixelFormat | |
} | |
@foreign struct Texture { | |
id: uint32; | |
width: int; | |
height: int; | |
mipmaps: int; | |
format: int; // PixelFormat | |
} | |
@foreign struct RenderTexture { | |
id: uint32; | |
texture: Texture; | |
depth: Texture; | |
} | |
@foreign typedef Texture2D = Texture; | |
@foreign typedef TextureCubemap = Texture; | |
@foreign typedef RenderTexture2D = RenderTexture; | |
@foreign struct NPatchInfo { | |
source: Rectangle; | |
left: int; | |
top: int; | |
right: int; | |
bottom: int; | |
type: int; | |
} | |
@foreign struct CharInfo { | |
value: int; | |
rec: Rectangle; | |
offsetX: int; | |
offsetY: int; | |
advanceX: int; | |
} | |
@foreign struct Font { | |
baseSize: int; | |
charsCount: int; | |
texture: Texture; | |
recs: Rectangle*; | |
chars: CharInfo*; | |
} | |
@foreign struct Camera3D { | |
position: Vector3; | |
target: Vector3; | |
up: Vector3; | |
fovy: float; | |
type: int; | |
} | |
@foreign typedef Camera = Camera2D; | |
@foreign struct Camera2D { | |
offset: Vector2; | |
target: Vector2; | |
rotation: float; | |
zoom: float; | |
} | |
@foreign struct Mesh { | |
vertexCount: int; | |
triangleCount: int; | |
vertices: float*; | |
texcoords: float*; | |
texcoords2: float*; | |
normals: float*; | |
tangents: float*; | |
colors: uint8*; | |
indices: uint16*; | |
animVertices: float*; | |
animNormals: float*; | |
boneIds: int*; | |
boneWeights: float*; | |
vaoID: uint; | |
vboID: uint*; | |
} | |
@foreign struct Shader { | |
id: uint32; | |
locs: int32[MaxShaderLocations]; | |
} | |
@foreign struct MaterialMap { | |
texture: Texture; | |
color: Color; | |
value: float; | |
} | |
@foreign struct Material { | |
shader: Shader; | |
maps: MaterialMap[MaxMaterialMaps]; | |
params: float*; | |
} | |
@foreign struct Model { | |
transform: Matrix; | |
meshCount: int32; | |
meshes: Mesh[]; | |
materialCount: int32; | |
materials: Material[]; | |
meshMaterial: int32*; | |
boneCount: int32; | |
bones: BoneInfo[]; | |
bindPose: Transform[]; | |
} | |
@foreign struct Transform { | |
translation: Vector3; | |
rotation: Vector4; | |
scale: Vector3; | |
} | |
@foreign struct BoneInfo { | |
name: int8[32]; | |
parent: int32; | |
} | |
@foreign struct ModelAnimation { | |
boneCount: int; | |
frameCount: int; | |
bones: BoneInfo*; | |
framePoses: Transform**; | |
} | |
@foreign struct Ray { | |
position: Vector3; | |
direction: Vector3; | |
} | |
@foreign struct RayHitInfo { | |
hit: bool; | |
distance: float; | |
position: Vector3; | |
normal: Vector3; | |
} | |
@foreign struct BoundingBox { | |
min: Vector3; | |
max: Vector3; | |
} | |
@foreign struct Wave { | |
sampleCount: uint32; | |
sampleRate: uint32; | |
sampleSize: uint32; | |
channels: uint32; | |
} | |
@foreign struct Sound { | |
sampleCount: uint32; | |
stream: AudioStream; | |
} | |
@foreign struct Music { | |
ctxType: int32; | |
ctxData: void*; | |
sampleCount: uint32; | |
loopCount: uint32; | |
stream: AudioStream; | |
} | |
@foreign struct rAudioBuffer; | |
@foreign struct AudioStream { | |
buffer: rAudioBuffer*; | |
sampleRate: uint; | |
sampleSize: uint; | |
channels: uint; | |
} | |
@foreign struct VrDeviceInfo { | |
hResolution: int; | |
vResolution: int; | |
hScreenSize: float; | |
vScreenSize: float; | |
vScreenCenter: float; | |
eyeToScreenDistance: float; | |
lensSeparationDistance: float; | |
interpupillaryDistance: float; | |
lensDistortionValues: float[4]; | |
chromaAbCorrection: float[4]; | |
} | |
@foregion var LIGHTGRAY = Color{200, 200, 200, 255}; | |
@foregion var GRAY = Color{130, 130, 130, 255}; | |
@foregion var DARKGRAY = Color{80, 80, 80, 255}; | |
@foregion var YELLOW = Color{253, 249, 0, 255}; | |
@foregion var GOLD = Color{255, 203, 0, 255}; | |
@foregion var ORANGE = Color{255, 161, 0, 255}; | |
@foregion var PINK = Color{255, 109, 194, 255}; | |
@foregion var RED = Color{230, 41, 55, 255}; | |
@foregion var MAROON = Color{190, 33, 55, 255}; | |
@foregion var GREEN = Color{0, 228, 48, 255}; | |
@foregion var LIME = Color{0, 158, 47, 255}; | |
@foregion var DARKGREEN = Color{0, 117, 44, 255}; | |
@foregion var SKYBLUE = Color{102, 191, 255, 255}; | |
@foregion var BLUE = Color{0, 121, 241, 255}; | |
@foregion var DARKBLUE = Color{0, 82, 172, 255}; | |
@foregion var PURPLE = Color{200, 122, 255, 255}; | |
@foregion var VIOLET = Color{135, 60, 190, 255}; | |
@foregion var DARKPURPLE = Color{112, 31, 126, 255}; | |
@foregion var BEIGE = Color{211, 176, 131, 255}; | |
@foregion var BROWN = Color{127, 106, 79, 255}; | |
@foregion var DARKBROWN = Color{76, 63, 47, 255}; | |
@foregion var WHITE = Color{255, 255, 255, 255}; | |
@foregion var BLACK = Color{0, 0, 0, 255}; | |
@foregion var BLANK = Color{0, 0, 0, 0}; | |
@foregion var MAGENTA = Color{255, 0, 255, 255}; | |
@foregion var RAYWHITE = Color{245, 245, 245, 255}; | |
@foregion enum ConfigFlag { | |
FLAG_VSYNC_HINT = 0x00000040, | |
FLAG_FULLSCREEN_MODE = 0x00000002, | |
FLAG_WINDOW_RESIZABLE = 0x00000004, | |
FLAG_WINDOW_UNDECORATED = 0x00000008, | |
FLAG_WINDOW_HIDDEN = 0x00000080, | |
FLAG_WINDOW_MINIMIZED = 0x00000200, | |
FLAG_WINDOW_MAXIMIZED = 0x00000400, | |
FLAG_WINDOW_UNFOCUSED = 0x00000800, | |
FLAG_WINDOW_TOPMOST = 0x00001000, | |
FLAG_WINDOW_ALWAYS_RUN = 0x00000100, | |
FLAG_WINDOW_TRANSPARENT = 0x00000010, | |
FLAG_WINDOW_HIGHDPI = 0x00002000, | |
FLAG_MSAA_4X_HINT = 0x00000020, | |
FLAG_INTERLACED_HINT = 0x00010000 | |
} | |
@foregion enum TraceLogType { | |
LOG_ALL = 0, | |
LOG_TRACE, | |
LOG_DEBUG, | |
LOG_INFO, | |
LOG_WARNING, | |
LOG_ERROR, | |
LOG_FATAL, | |
LOG_NONE | |
} | |
@foregion enum KeyboardKey { | |
KEY_APOSTROPHE = 39, | |
KEY_COMMA = 44, | |
KEY_MINUS = 45, | |
KEY_PERIOD = 46, | |
KEY_SLASH = 47, | |
KEY_ZERO = 48, | |
KEY_ONE = 49, | |
KEY_TWO = 50, | |
KEY_THREE = 51, | |
KEY_FOUR = 52, | |
KEY_FIVE = 53, | |
KEY_SIX = 54, | |
KEY_SEVEN = 55, | |
KEY_EIGHT = 56, | |
KEY_NINE = 57, | |
KEY_SEMICOLON = 59, | |
KEY_EQUAL = 61, | |
KEY_A = 65, | |
KEY_B = 66, | |
KEY_C = 67, | |
KEY_D = 68, | |
KEY_E = 69, | |
KEY_F = 70, | |
KEY_G = 71, | |
KEY_H = 72, | |
KEY_I = 73, | |
KEY_J = 74, | |
KEY_K = 75, | |
KEY_L = 76, | |
KEY_M = 77, | |
KEY_N = 78, | |
KEY_O = 79, | |
KEY_P = 80, | |
KEY_Q = 81, | |
KEY_R = 82, | |
KEY_S = 83, | |
KEY_T = 84, | |
KEY_U = 85, | |
KEY_V = 86, | |
KEY_W = 87, | |
KEY_X = 88, | |
KEY_Y = 89, | |
KEY_Z = 90, | |
KEY_SPACE = 32, | |
KEY_ESCAPE = 256, | |
KEY_ENTER = 257, | |
KEY_TAB = 258, | |
KEY_BACKSPACE = 259, | |
KEY_INSERT = 260, | |
KEY_DELETE = 261, | |
KEY_RIGHT = 262, | |
KEY_LEFT = 263, | |
KEY_DOWN = 264, | |
KEY_UP = 265, | |
KEY_PAGE_UP = 266, | |
KEY_PAGE_DOWN = 267, | |
KEY_HOME = 268, | |
KEY_END = 269, | |
KEY_CAPS_LOCK = 280, | |
KEY_SCROLL_LOCK = 281, | |
KEY_NUM_LOCK = 282, | |
KEY_PRINT_SCREEN = 283, | |
KEY_PAUSE = 284, | |
KEY_F1 = 290, | |
KEY_F2 = 291, | |
KEY_F3 = 292, | |
KEY_F4 = 293, | |
KEY_F5 = 294, | |
KEY_F6 = 295, | |
KEY_F7 = 296, | |
KEY_F8 = 297, | |
KEY_F9 = 298, | |
KEY_F10 = 299, | |
KEY_F11 = 300, | |
KEY_F12 = 301, | |
KEY_LEFT_SHIFT = 340, | |
KEY_LEFT_CONTROL = 341, | |
KEY_LEFT_ALT = 342, | |
KEY_LEFT_SUPER = 343, | |
KEY_RIGHT_SHIFT = 344, | |
KEY_RIGHT_CONTROL = 345, | |
KEY_RIGHT_ALT = 346, | |
KEY_RIGHT_SUPER = 347, | |
KEY_KB_MENU = 348, | |
KEY_LEFT_BRACKET = 91, | |
KEY_BACKSLASH = 92, | |
KEY_RIGHT_BRACKET = 93, | |
KEY_GRAVE = 96, | |
KEY_KP_0 = 320, | |
KEY_KP_1 = 321, | |
KEY_KP_2 = 322, | |
KEY_KP_3 = 323, | |
KEY_KP_4 = 324, | |
KEY_KP_5 = 325, | |
KEY_KP_6 = 326, | |
KEY_KP_7 = 327, | |
KEY_KP_8 = 328, | |
KEY_KP_9 = 329, | |
KEY_KP_DECIMAL = 330, | |
KEY_KP_DIVIDE = 331, | |
KEY_KP_MULTIPLY = 332, | |
KEY_KP_SUBTRACT = 333, | |
KEY_KP_ADD = 334, | |
KEY_KP_ENTER = 335, | |
KEY_KP_EQUAL = 336 | |
} | |
@foreign enum AndroidButton { | |
KEY_BACK = 4, | |
KEY_MENU = 82, | |
KEY_VOLUME_UP = 24, | |
KEY_VOLUME_DOWN = 25 | |
} | |
@foreign enum MouseButton { | |
MOUSE_LEFT_BUTTON = 0, | |
MOUSE_RIGHT_BUTTON = 1, | |
MOUSE_MIDDLE_BUTTON = 2 | |
} | |
@foreign enum MouseCursor { | |
MOUSE_CURSOR_DEFAULT = 0, | |
MOUSE_CURSOR_ARROW = 1, | |
MOUSE_CURSOR_IBEAM = 2, | |
MOUSE_CURSOR_CROSSHAIR = 3, | |
MOUSE_CURSOR_POINTING_HAND = 4, | |
MOUSE_CURSOR_RESIZE_EW = 5, | |
MOUSE_CURSOR_RESIZE_NS = 6, | |
MOUSE_CURSOR_RESIZE_NWSE = 7, | |
MOUSE_CURSOR_RESIZE_NESW = 8, | |
MOUSE_CURSOR_RESIZE_ALL = 9, | |
MOUSE_CURSOR_NOT_ALLOWED = 10 | |
} | |
@foreign enum GamepadNumber { | |
GAMEPAD_PLAYER1 = 0, | |
GAMEPAD_PLAYER2 = 1, | |
GAMEPAD_PLAYER3 = 2, | |
GAMEPAD_PLAYER4 = 3 | |
} | |
@foreign enum GamepadButton { | |
GAMEPAD_BUTTON_UNKNOWN = 0, | |
GAMEPAD_BUTTON_LEFT_FACE_UP, | |
GAMEPAD_BUTTON_LEFT_FACE_RIGHT, | |
GAMEPAD_BUTTON_LEFT_FACE_DOWN, | |
GAMEPAD_BUTTON_LEFT_FACE_LEFT, | |
GAMEPAD_BUTTON_RIGHT_FACE_UP, | |
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, | |
GAMEPAD_BUTTON_RIGHT_FACE_DOWN, | |
GAMEPAD_BUTTON_RIGHT_FACE_LEFT, | |
GAMEPAD_BUTTON_LEFT_TRIGGER_1, | |
GAMEPAD_BUTTON_LEFT_TRIGGER_2, | |
GAMEPAD_BUTTON_RIGHT_TRIGGER_1, | |
GAMEPAD_BUTTON_RIGHT_TRIGGER_2, | |
GAMEPAD_BUTTON_MIDDLE_LEFT, | |
GAMEPAD_BUTTON_MIDDLE, | |
GAMEPAD_BUTTON_MIDDLE_RIGHT, | |
GAMEPAD_BUTTON_LEFT_THUMB, | |
GAMEPAD_BUTTON_RIGHT_THUMB | |
} | |
@foreign enum GamepadAxis { | |
GAMEPAD_AXIS_LEFT_X = 0, | |
GAMEPAD_AXIS_LEFT_Y = 1, | |
GAMEPAD_AXIS_RIGHT_X = 2, | |
GAMEPAD_AXIS_RIGHT_Y = 3, | |
GAMEPAD_AXIS_LEFT_TRIGGER = 4, | |
GAMEPAD_AXIS_RIGHT_TRIGGER = 5 | |
} | |
@foreign enum ShaderLocationIndex { | |
LOC_VERTEX_POSITION = 0, | |
LOC_VERTEX_TEXCOORD01, | |
LOC_VERTEX_TEXCOORD02, | |
LOC_VERTEX_NORMAL, | |
LOC_VERTEX_TANGENT, | |
LOC_VERTEX_COLOR, | |
LOC_MATRIX_MVP, | |
LOC_MATRIX_MODEL, | |
LOC_MATRIX_VIEW, | |
LOC_MATRIX_PROJECTION, | |
LOC_VECTOR_VIEW, | |
LOC_COLOR_DIFFUSE, | |
LOC_COLOR_SPECULAR, | |
LOC_COLOR_AMBIENT, | |
LOC_MAP_ALBEDO, | |
LOC_MAP_METALNESS, | |
LOC_MAP_NORMAL, | |
LOC_MAP_ROUGHNESS, | |
LOC_MAP_OCCLUSION, | |
LOC_MAP_EMISSION, | |
LOC_MAP_HEIGHT, | |
LOC_MAP_CUBEMAP, | |
LOC_MAP_IRRADIANCE, | |
LOC_MAP_PREFILTER, | |
LOC_MAP_BRDF | |
} | |
@foreign const LOC_MAP_DIFFUSE = LOC_MAP_ALBEDO; | |
@foreign const LOC_MAP_SPECULAR = LOC_MAP_METALNESS; | |
@foreign enum ShaderUniformDataType { | |
UNIFORM_FLOAT = 0, | |
UNIFORM_VEC2, | |
UNIFORM_VEC3, | |
UNIFORM_VEC4, | |
UNIFORM_INT, | |
UNIFORM_IVEC2, | |
UNIFORM_IVEC3, | |
UNIFORM_IVEC4, | |
UNIFORM_SAMPLER2D | |
} | |
@foreign enum MaterialMapType { | |
MAP_ALBEDO = 0, | |
MAP_METALNESS = 1, | |
MAP_NORMAL = 2, | |
MAP_ROUGHNESS = 3, | |
MAP_OCCLUSION, | |
MAP_EMISSION, | |
MAP_HEIGHT, | |
MAP_CUBEMAP, | |
MAP_IRRADIANCE, | |
MAP_PREFILTER, | |
MAP_BRDF | |
} | |
@foreign const MAP_DIFFUSE = MAP_ALBEDO; | |
@foreign const MAP_SPECULAR = MAP_METALNESS; | |
@foreign enum PixelFormat { | |
UNCOMPRESSED_GRAYSCALE = 1, | |
UNCOMPRESSED_GRAY_ALPHA, | |
UNCOMPRESSED_R5G6B5, | |
UNCOMPRESSED_R8G8B8, | |
UNCOMPRESSED_R5G5B5A1, | |
UNCOMPRESSED_R4G4B4A4, | |
UNCOMPRESSED_R8G8B8A8, | |
UNCOMPRESSED_R32, | |
UNCOMPRESSED_R32G32B32, | |
UNCOMPRESSED_R32G32B32A32, | |
COMPRESSED_DXT1_RGB, | |
COMPRESSED_DXT1_RGBA, | |
COMPRESSED_DXT3_RGBA, | |
COMPRESSED_DXT5_RGBA, | |
COMPRESSED_ETC1_RGB, | |
COMPRESSED_ETC2_RGB, | |
COMPRESSED_ETC2_EAC_RGBA, | |
COMPRESSED_PVRT_RGB, | |
COMPRESSED_PVRT_RGBA, | |
COMPRESSED_ASTC_4x4_RGBA, | |
COMPRESSED_ASTC_8x8_RGBA | |
} | |
@foreign enum TextureFilterMode { | |
FILTER_POINT = 0, | |
FILTER_BILINEAR, | |
FILTER_TRILINEAR, | |
FILTER_ANISOTROPIC_4X, | |
FILTER_ANISOTROPIC_8X, | |
FILTER_ANISOTROPIC_16X, | |
} | |
@foreign enum TextureWrapMode { | |
WRAP_REPEAT = 0, | |
WRAP_CLAMP, | |
WRAP_MIRROR_REPEAT, | |
WRAP_MIRROR_CLAMP | |
} | |
@foreign enum CubemapLayoutType { | |
CUBEMAP_AUTO_DETECT = 0, | |
CUBEMAP_LINE_VERTICAL, | |
CUBEMAP_LINE_HORIZONTAL, | |
CUBEMAP_CROSS_THREE_BY_FOUR, | |
CUBEMAP_CROSS_FOUR_BY_THREE, | |
CUBEMAP_PANORAMA | |
} | |
@foreign enum FontType { | |
FONT_DEFAULT = 0, | |
FONT_BITMAP, | |
FONT_SDF | |
} | |
@foreign enum BlendMode { | |
BLEND_ALPHA = 0, | |
BLEND_ADDITIVE, | |
BLEND_MULTIPLIED, | |
BLEND_ADD_COLORS, | |
BLEND_SUBTRACT_COLORS, | |
BLEND_CUSTOM | |
} | |
@foreign enum GestureType { | |
GESTURE_NONE = 0, | |
GESTURE_TAP = 1, | |
GESTURE_DOUBLETAP = 2, | |
GESTURE_HOLD = 4, | |
GESTURE_DRAG = 8, | |
GESTURE_SWIPE_RIGHT = 16, | |
GESTURE_SWIPE_LEFT = 32, | |
GESTURE_SWIPE_UP = 64, | |
GESTURE_SWIPE_DOWN = 128, | |
GESTURE_PINCH_IN = 256, | |
GESTURE_PINCH_OUT = 512 | |
} | |
@foreign enum CameraMode { | |
CAMERA_CUSTOM = 0, | |
CAMERA_FREE, | |
CAMERA_ORBITAL, | |
CAMERA_FIRST_PERSON, | |
CAMERA_THIRD_PERSON | |
} | |
@foreign enum CameraType { | |
CAMERA_PERSPECTIVE = 0, | |
CAMERA_ORTHOGRAPHIC | |
} | |
@foreign enum NPatchType { | |
NPT_9PATCH = 0, | |
NPT_3PATCH_VERTICAL, | |
NPT_3PATCH_HORIZONTAL | |
} | |
@foreign | |
typedef TraceLogCallback = func(logType: int, text: char* const, args: libc.va_list); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loading: Shader/unloading functions | |
@foreign func LoadShader(vsFileName: char* const, fsFileName: char* const): Shader; | |
@foreign func LoadShaderCode(vsCode: char* const, fsCode: char* const): Shader; | |
@foreign func UnloadShader(shader: Shader); | |
@foreign func GetShaderDefault(): Shader; | |
@foreign func GetTextureDefault(): Texture2D; | |
@foreign func GetShapesTexture(): Texture2D; | |
@foreign func GetShapesTextureRec(): Rectangle; | |
@foreign func SetShapesTexture(texture: Texture2D, source: Rectangle); | |
// configuration: Shader functions | |
@foreign func GetShaderLocation(shader: Shader, uniformName: char* const): int; | |
@foreign func GetShaderLocationAttrib(shader: Shader, attribName: char* const): int; | |
@foreign func SetShaderValue(shader: Shader, uniformLoc: int, value: void* const, uniformType: int); | |
@foreign func SetShaderValueV(shader: Shader, uniformLoc: int, value: void* const, uniformType: int, count: int); | |
@foreign func SetShaderValueMatrix(shader: Shader, uniformLoc: int, mat: Matrix); | |
@foreign func SetShaderValueTexture(shader: Shader, uniformLoc: int, texture: Texture2D); | |
@foreign func SetMatrixProjection(proj: Matrix); | |
@foreign func SetMatrixModelview(view: Matrix); | |
@foreign func GetMatrixModelview(): Matrix; | |
@foreign func GetMatrixProjection(): Matrix; | |
// Shading begin/end functions | |
@foreign func BeginShaderMode(shader: Shader); | |
@foreign func EndShaderMode(); | |
@foreign func BeginBlendMode(mode: int); | |
@foreign func EndBlendMode(); | |
// VR control functions | |
@foreign func InitVrSimulator(); | |
@foreign func CloseVrSimulator(); | |
@foreign func UpdateVrTracking(camera: Camera*); | |
@foreign func SetVrConfiguration(info: VrDeviceInfo, distortion: Shader); | |
@foreign func IsVrSimulatorReady(): bool; | |
@foreign func ToggleVrMode(); | |
@foreign func BeginVrDrawing(); | |
@foreign func EndVrDrawing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic shapes drawing functions | |
@foreign func DrawPixel(posX: int, posY: int, color: Color); | |
@foreign func DrawPixelV(position: Vector2, color: Color); | |
@foreign func DrawLine(startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color); | |
@foreign func DrawLineV(startPos: Vector2, endPos: Vector2, color: Color); | |
@foreign func DrawLineEx(startPos: Vector2, endPos: Vector2, thick: float, color: Color); | |
@foreign func DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: float, color: Color); | |
@foreign func DrawLineStrip(points: Vector2*, pointsCount: int, color: Color); | |
@foreign func DrawCircle(centerX: int, centerY: int, radius: float, color: Color); | |
@foreign func DrawCircleSector(center: Vector2, radius: float, startAngle: int, endAngle: int, segments: int, color: Color); | |
@foreign func DrawCircleSectorLines(center: Vector2, radius: float, startAngle: int, endAngle: int, segments: int, color: Color); | |
@foreign func DrawCircleGradient(centerX: int, centerY: int, radius: float, color1: Color, color2: Color); | |
@foreign func DrawCircleV(center: Vector2, radius: float, color: Color); | |
@foreign func DrawCircleLines(centerX: int, centerY: int, radius: float, color: Color); | |
@foreign func DrawEllipse(centerX: int, centerY: int, radiusH: float, radiusV: float, color: Color); | |
@foreign func DrawEllipseLines(centerX: int, centerY: int, radiusH: float, radiusV: float, color: Color); | |
@foreign func DrawRing(center: Vector2, innerRadius: float, outerRadius: float, startAngle: int, endAngle: int, segments: int, color: Color); | |
@foreign func DrawRingLines(center: Vector2, innerRadius: float, outerRadius: float, startAngle: int, endAngle: int, segments: int, color: Color); | |
@foreign func DrawRectangle(posX: int, posY: int, width: int, height: int, color: Color); | |
@foreign func DrawRectangleV(position: Vector2, size: Vector2, color: Color); | |
@foreign func DrawRectangleRec(rec: Rectangle, color: Color); | |
@foreign func DrawRectanglePro(rec: Rectangle, origin: Vector2, rotation: float, color: Color); | |
@foreign func DrawRectangleGradientV(posX: int, posY: int, width: int, height: int, color1: Color, color2: Color); | |
@foreign func DrawRectangleGradientH(posX: int, posY: int, width: int, height: int, color1: Color, color2: Color); | |
@foreign func DrawRectangleGradientEx(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color); | |
@foreign func DrawRectangleLines(posX: int, posY: int, width: int, height: int, color: Color); | |
@foreign func DrawRectangleLinesEx(rec: Rectangle, lineThick: int, color: Color); | |
@foreign func DrawRectangleRounded(rec: Rectangle, roundness: float, segments: int, color: Color); | |
@foreign func DrawRectangleRoundedLines(rec: Rectangle, roundness: float, segments: int, lineThick: int, color: Color); | |
@foreign func DrawTriangle(v1: Vector2, v2: Vector2, v3: Vector2, color: Color); | |
@foreign func DrawTriangleLines(v1: Vector2, v2: Vector2, v3: Vector2, color: Color); | |
@foreign func DrawTriangleFan(points: Vector2*, pointsCount: int, color: Color); | |
@foreign func DrawTriangleStrip(points: Vector2*, pointsCount: int, color: Color); | |
@foreign func DrawPoly(center: Vector2, sides: int, radius: float, rotation: float, color: Color); | |
@foreign func DrawPolyLines(center: Vector2, sides: int, radius: float, rotation: float, color: Color); | |
// Basic shapes collision detection functions | |
@foreign func CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle): bool; | |
@foreign func CheckCollisionCircles(center1: Vector2, radius1: float, center2: Vector2, radius2: float): bool; | |
@foreign func CheckCollisionCircleRec(center: Vector2, radius: float, rec: Rectangle): bool; | |
@foreign func CheckCollisionPointRec(point: Vector2, rec: Rectangle): bool; | |
@foreign func CheckCollisionPointCircle(point: Vector2, center: Vector2, radius: float): bool; | |
@foreign func CheckCollisionPointTriangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2): bool; | |
@foreign func CheckCollisionLines(startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint: Vector2*): bool; | |
@foreign func GetCollisionRec(rec1: Rectangle, rec2: Rectangle): Rectangle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loading: Font/unloading functions | |
@foreign func GetFontDefault(): Font; | |
@foreign func LoadFont(fileName: char* const): Font; | |
@foreign func LoadFontEx(fileName: char* const, fontSize: int, fontChars: int*, charsCount: int): Font; | |
@foreign func LoadFontFromImage(image: Image, key: Color, firstChar: int): Font; | |
@foreign func LoadFontFromMemory(fileType: char* const, fileData: uchar* const, dataSize: int, fontSize: int, fontChars: int*, charsCount: int): Font; | |
@foreign func LoadFontData(fileData: uchar* const, dataSize: int, fontSize: int, fontChars: int*, charsCount: int, type: int): CharInfo*; | |
@foreign func GenImageFontAtlas(chars: CharInfo* const, recs: Rectangle**, charsCount: int, fontSize: int, padding: int, packMethod: int): Image; | |
@foreign func UnloadFontData(chars: CharInfo*, charsCount: int); | |
@foreign func UnloadFont(font: Font); | |
// Text drawing functions | |
@foreign func DrawFPS(posX: int, posY: int); | |
@foreign func DrawText(text: char* const, posX: int, posY: int, fontSize: int, color: Color); | |
@foreign func DrawTextEx(font: Font, text: char* const, position: Vector2, fontSize: float, spacing: float, tint: Color); | |
@foreign func DrawTextRec(font: Font, text: char* const, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color); | |
@foreign func DrawTextRecEx(font: Font, text: char* const, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color, selectStart: int, selectLength: int, selectTint: Color, selectBackTint: Color); | |
@foreign func DrawTextCodepoint(font: Font, codepoint: int, position: Vector2, fontSize: float, tint: Color); | |
// Text misc. functions | |
@foreign func MeasureText(text: char* const, fontSize: int): int; | |
@foreign func MeasureTextEx(font: Font, text: char* const, fontSize: float, spacing: float): Vector2; | |
@foreign func GetGlyphIndex(font: Font, codepoint: int): int; | |
// Text strings management functions (no utf8 strings, only byte chars) | |
// NOTE: Some strings allocate memory internally for returned strings, just be careful! | |
@foreign func TextCopy(dst: char*, src: char* const): int; | |
@foreign func TextIsEqual(text1: char* const, text2: char* const): bool; | |
@foreign func TextLength(text: char* const): uint; | |
@foreign func TextFormat(text: char* const, ...): char* const; | |
@foreign func TextSubtext(text: char* const, position: int, length: int): char* const; | |
@foreign func TextReplace(text: char*, replace: char* const, by: char* const): char*; | |
@foreign func TextInsert(text: char* const, insert: char* const, position: int): char*; | |
@foreign func TextJoin(textList: char** const, count: int, delimiter: char* const): char* const; | |
@foreign func TextSplit(text: char* const, delimiter: char, count: int*): char** const ; | |
@foreign func TextAppend(text: char*, append: char* const, position: int*); | |
@foreign func TextFindIndex(text: char* const, find: char* const): int; | |
@foreign func TextToUpper(text: char* const): char* const; | |
@foreign func TextToLower(text: char* const): char* const ; | |
@foreign func TextToPascal(text: char* const): char* const; | |
@foreign func TextToInteger(text: char* const): int; | |
@foreign func TextToUtf8(codepoints: int*, length: int): char*; | |
// UTF8 text strings management functions | |
@foreign func GetCodepoints(text: char* const, count: int*): int*; | |
@foreign func GetCodepointsCount(text: char* const): int; | |
@foreign func GetNextCodepoint(text: char* const, bytesProcessed: int*): int; | |
@foreign func CodepointToUtf8(codepoint: int, byteLength: int*): char* const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loading: Image functions | |
// NOTE: This functions do not require GPU access | |
@foreign func LoadImage(fileName: char* const): Image; | |
@foreign func LoadImageRaw(fileName: char* const, width: int, height: int, format: int, headerSize: int): Image; | |
@foreign func LoadImageAnim(fileName: char* const, frames: int*): Image; | |
@foreign func LoadImageFromMemory(fileType: char* const, fileData: uchar* const, dataSize: int): Image; | |
@foreign func UnloadImage(image: Image); | |
@foreign func ExportImage(image: Image, fileName: char* const): bool; | |
@foreign func ExportImageAsCode(image: Image, fileName: char* const): bool; | |
// generation: Image functions | |
@foreign func GenImageColor(width: int, height: int, color: Color): Image; | |
@foreign func GenImageGradientV(width: int, height: int, top: Color, bottom: Color): Image; | |
@foreign func GenImageGradientH(width: int, height: int, left: Color, right: Color): Image; | |
@foreign func GenImageGradientRadial(width: int, height: int, density: float, inner: Color, outer: Color): Image; | |
@foreign func GenImageChecked(width: int, height: int, checksX: int, checksY: int, col1: Color, col2: Color): Image; | |
@foreign func GenImageWhiteNoise(width: int, height: int, factor: float): Image; | |
@foreign func GenImagePerlinNoise(width: int, height: int, offsetX: int, offsetY: int, scale: float): Image; | |
@foreign func GenImageCellular(width: int, height: int, tileSize: int): Image; | |
// manipulation: Image functions | |
@foreign func ImageCopy(image: Image): Image; | |
@foreign func ImageFromImage(image: Image, rec: Rectangle): Image; | |
@foreign func ImageText(text: char* const, fontSize: int, color: Color): Image; | |
@foreign func ImageTextEx(font: Font, text: char* const, fontSize: float, spacing: float, tint: Color): Image; | |
@foreign func ImageFormat(image: Image*, newFormat: int); | |
@foreign func ImageToPOT(image: Image*, fill: Color); | |
@foreign func ImageCrop(image: Image*, crop: Rectangle); | |
@foreign func ImageAlphaCrop(image: Image*, threshold: float); | |
@foreign func ImageAlphaClear(image: Image*, color: Color, threshold: float); | |
@foreign func ImageAlphaMask(image: Image*, alphaMask: Image); | |
@foreign func ImageAlphaPremultiply(image: Image*); | |
@foreign func ImageResize(image: Image*, newWidth: int, newHeight: int); | |
@foreign func ImageResizeNN(image: Image*, newWidth: int, newHeight: int); | |
@foreign func ImageResizeCanvas(image: Image*, newWidth: int, newHeight: int, offsetX: int, offsetY: int, fill: Color); | |
@foreign func ImageMipmaps(image: Image*); | |
@foreign func ImageDither(image: Image*, rBpp: int, gBpp: int, bBpp: int, aBpp: int); | |
@foreign func ImageFlipVertical(image: Image*); | |
@foreign func ImageFlipHorizontal(image: Image*); | |
@foreign func ImageRotateCW(image: Image*); | |
@foreign func ImageRotateCCW(image: Image*); | |
@foreign func ImageColorTint(image: Image*, color: Color); | |
@foreign func ImageColorInvert(image: Image*); | |
@foreign func ImageColorGrayscale(image: Image*); | |
@foreign func ImageColorContrast(image: Image*, contrast: float); | |
@foreign func ImageColorBrightness(image: Image*, brightness: int); | |
@foreign func ImageColorReplace(image: Image*, color: Color, replace: Color); | |
@foreign func LoadImageColors(image: Image): Color*; | |
@foreign func LoadImagePalette(image: Image, maxPaletteSize: int, colorsCount: int*): Color*; | |
@foreign func UnloadImageColors(colors: Color*); | |
@foreign func UnloadImagePalette(colors: Color*); | |
@foreign func GetImageAlphaBorder(image: Image, threshold: float): Rectangle; | |
// drawing: Image functions | |
// NOTE: software: Image-rendering functions (CPU) | |
@foreign func ImageClearBackground(dst: Image*, color: Color); | |
@foreign func ImageDrawPixel(dst: Image*, posX: int, posY: int, color: Color); | |
@foreign func ImageDrawPixelV(dst: Image*, position: Vector2, color: Color); | |
@foreign func ImageDrawLine(dst: Image*, startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color); | |
@foreign func ImageDrawLineV(dst: Image*, start: Vector2, end: Vector2, color: Color); | |
@foreign func ImageDrawCircle(dst: Image*, centerX: int, centerY: int, radius: int, color: Color); | |
@foreign func ImageDrawCircleV(dst: Image*, center: Vector2, radius: int, color: Color); | |
@foreign func ImageDrawRectangle(dst: Image*, posX: int, posY: int, width: int, height: int, color: Color); | |
@foreign func ImageDrawRectangleV(dst: Image*, position: Vector2, size: Vector2, color: Color); | |
@foreign func ImageDrawRectangleRec(dst: Image*, rec: Rectangle, color: Color); | |
@foreign func ImageDrawRectangleLines(dst: Image*, rec: Rectangle, thick: int, color: Color); | |
@foreign func ImageDraw(dst: Image*, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color); | |
@foreign func ImageDrawText(dst: Image*, text: char* const, posX: int, posY: int, fontSize: int, color: Color); | |
@foreign func ImageDrawTextEx(dst: Image*, font: Font, text: char* const, position: Vector2, fontSize: float, spacing: float, tint: Color); | |
// Texture loading functions | |
// NOTE: These functions require GPU access | |
@foreign func LoadTexture(fileName: char* const): Texture2D; | |
@foreign func LoadTextureFromImage(image: Image): Texture2D; | |
@foreign func LoadTextureCubemap(image: Image, layoutType: int): TextureCubemap; | |
@foreign func LoadRenderTexture(width: int, height: int): RenderTexture2D; | |
@foreign func UnloadTexture(texture: Texture2D); | |
@foreign func UnloadRenderTexture(Rendertarget: Texture2D); | |
@foreign func UpdateTexture(texture: Texture2D, pixels: void* const); | |
@foreign func UpdateTextureRec(texture: Texture2D, rec: Rectangle, pixels: void* const); | |
@foreign func GetTextureData(texture: Texture2D): Image; | |
@foreign func GetScreenData(): Image; | |
// Texture configuration functions | |
@foreign func GenTextureMipmaps(texture: Texture2D*); | |
@foreign func SetTextureFilter(texture: Texture2D, filterMode: int); | |
@foreign func SetTextureWrap(texture: Texture2D, wrapMode: int); | |
// Texture drawing functions | |
@foreign func DrawTexture(texture: Texture2D, posX: int, posY: int, tint: Color); | |
@foreign func DrawTextureV(texture: Texture2D, position: Vector2, tint: Color); | |
@foreign func DrawTextureEx(texture: Texture2D, position: Vector2, rotation: float, scale: float, tint: Color); | |
@foreign func DrawTextureRec(texture: Texture2D, source: Rectangle, position: Vector2, tint: Color); | |
@foreign func DrawTextureQuad(texture: Texture2D, tiling: Vector2, offset: Vector2, quad: Rectangle, tint: Color); | |
@foreign func DrawTextureTiled(texture: Texture2D, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, scale: float, tint: Color); | |
@foreign func DrawTexturePro(texture: Texture2D, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, tint: Color); | |
@foreign func DrawTextureNPatch(texture: Texture2D, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: float, tint: Color); | |
// Color/pixel related functions | |
@foreign func Fade(color: Color, alpha: float): Color; | |
@foreign func ColorToInt(color: Color): int; | |
@foreign func ColorNormalize(color: Color): Vector4; | |
@foreign func ColorFromNormalized(normalized: Vector4): Color; | |
@foreign func ColorToHSV(color: Color): Vector3; | |
@foreign func ColorFromHSV(hue: float, saturation: float, value: float): Color; | |
@foreign func ColorAlpha(color: Color, alpha: float): Color; | |
@foreign func ColorAlphaBlend(dst: Color, src: Color, tint: Color): Color; | |
@foreign func GetColor(hexValue: int): Color; | |
@foreign func GetPixelColor(srcPtr: void*, format: int): Color; | |
@foreign func SetPixelColor(dstPtr: void*, color: Color, format: int); | |
@foreign func GetPixelDataSize(width: int, height: int, format: int): int; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment