mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-15 10:48:04 +00:00
Updated Raylib jai bindings and switch example project to clay video demo
This commit is contained in:
parent
678bcf2ad0
commit
1936afd184
Binary file not shown.
@ -1,30 +0,0 @@
|
||||
using Basic :: #import "Basic";
|
||||
|
||||
Clay :: #import,file "../module.jai";
|
||||
Raylib :: #import "raylib-jai";
|
||||
|
||||
#load "clay_renderer_raylib.jai";
|
||||
|
||||
window_width: s32 = 1024;
|
||||
window_height: s32 = 768;
|
||||
|
||||
main :: () {
|
||||
min_memory_size := Clay.MinMemorySize();
|
||||
memory := alloc(min_memory_size);
|
||||
arena := Clay.CreateArenaWithCapacityAndMemory(min_memory_size, memory);
|
||||
Clay.SetMeasureTextFunction(measure_text);
|
||||
Clay.Initialize(arena, .{cast(float)Raylib.GetScreenWidth(), cast(float)Raylib.GetScreenHeight()});
|
||||
|
||||
Raylib.SetConfigFlags(.VSYNC_HINT | .WINDOW_RESIZABLE | .WINDOW_HIGHDPI | .MSAA_4X_HINT);
|
||||
Raylib.InitWindow(window_width, window_height, "raylib Jai Example");
|
||||
// Raylib.SetTargetFPS(60);
|
||||
|
||||
while !Raylib.WindowShouldClose() {
|
||||
Raylib.BeginDrawing();
|
||||
Raylib.ClearBackground(Raylib.RAYWHITE);
|
||||
Raylib.DrawText("HELLO", 190, 200, 20, Raylib.LIGHTGRAY);
|
||||
Raylib.EndDrawing();
|
||||
}
|
||||
|
||||
Raylib.CloseWindow();
|
||||
}
|
@ -44,4 +44,16 @@ measure_text :: (text: *Clay.String, config: *Clay.TextElementConfig) -> Clay.Di
|
||||
text_size.height = text_height;
|
||||
|
||||
return text_size;
|
||||
}
|
||||
}
|
||||
|
||||
clay_raylib_render :: (render_commands: *Clay.RenderCommandArray) {
|
||||
for i in 0..render_commands.length - 1 {
|
||||
render_command := Clay.RenderCommandArray_Get(render_commands, i);
|
||||
bounding_box := render_command.boundingBox;
|
||||
|
||||
if render_command.commandType == {
|
||||
case .Text;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
13
bindings/jai/examples/introducing_clay_video_demo/main.jai
Normal file
13
bindings/jai/examples/introducing_clay_video_demo/main.jai
Normal file
@ -0,0 +1,13 @@
|
||||
using Basic :: #import "Basic";
|
||||
|
||||
Clay :: #import,file "../module.jai";
|
||||
Raylib :: #import "raylib-jai";
|
||||
|
||||
#load "clay_renderer_raylib.jai";
|
||||
|
||||
window_width: s32 = 1024;
|
||||
window_height: s32 = 768;
|
||||
|
||||
main :: () {
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
|
||||
Vector2 :: Math.Vector2;
|
||||
Vector3 :: Math.Vector3;
|
||||
Vector4 :: Math.Vector4;
|
||||
Quaternion :: Math.Quaternion;
|
||||
Matrix :: Math.Matrix4;
|
||||
PI :: Math.PI;
|
||||
|
||||
LIGHTGRAY :: Color.{ 200, 200, 200, 255 };
|
||||
GRAY :: Color.{ 130, 130, 130, 255 };
|
||||
DARKGRAY :: Color.{ 80, 80, 80, 255 };
|
||||
YELLOW :: Color.{ 253, 249, 0, 255 };
|
||||
GOLD :: Color.{ 255, 203, 0, 255 };
|
||||
ORANGE :: Color.{ 255, 161, 0, 255 };
|
||||
PINK :: Color.{ 255, 109, 194, 255 };
|
||||
RED :: Color.{ 230, 41, 55, 255 };
|
||||
MAROON :: Color.{ 190, 33, 55, 255 };
|
||||
GREEN :: Color.{ 0, 228, 48, 255 };
|
||||
LIME :: Color.{ 0, 158, 47, 255 };
|
||||
DARKGREEN :: Color.{ 0, 117, 44, 255 };
|
||||
SKYBLUE :: Color.{ 102, 191, 255, 255 };
|
||||
BLUE :: Color.{ 0, 121, 241, 255 };
|
||||
DARKBLUE :: Color.{ 0, 82, 172, 255 };
|
||||
PURPLE :: Color.{ 200, 122, 255, 255 };
|
||||
VIOLET :: Color.{ 135, 60, 190, 255 };
|
||||
DARKPURPLE :: Color.{ 112, 31, 126, 255 };
|
||||
BEIGE :: Color.{ 211, 176, 131, 255 };
|
||||
BROWN :: Color.{ 127, 106, 79, 255 };
|
||||
DARKBROWN :: Color.{ 76, 63, 47, 255 };
|
||||
WHITE :: Color.{ 255, 255, 255, 255 };
|
||||
BLACK :: Color.{ 0, 0, 0, 255 };
|
||||
BLANK :: Color.{ 0, 0, 0, 0 };
|
||||
MAGENTA :: Color.{ 255, 0, 255, 255 };
|
||||
RAYWHITE :: Color.{ 245, 245, 245, 255 };
|
||||
|
||||
GetGamepadButtonPressed :: () -> GamepadButton #foreign raylib;
|
||||
|
||||
IsMouseButtonPressed :: (button: MouseButton) -> bool { return IsMouseButtonPressed(cast(s32) button); }
|
||||
IsMouseButtonDown :: (button: MouseButton) -> bool { return IsMouseButtonDown(cast(s32) button); }
|
||||
IsMouseButtonReleased :: (button: MouseButton) -> bool { return IsMouseButtonReleased(cast(s32) button); }
|
||||
IsMouseButtonUp :: (button: MouseButton) -> bool { return IsMouseButtonUp(cast(s32) button); }
|
||||
|
||||
IsKeyPressed :: (key: KeyboardKey) -> bool { return IsKeyPressed(cast(s32) key); }
|
||||
IsKeyPressedRepeat :: (key: KeyboardKey) -> bool { return IsKeyPressedRepeat(cast(s32) key); }
|
||||
IsKeyDown :: (key: KeyboardKey) -> bool { return IsKeyDown(cast(s32) key); }
|
||||
IsKeyReleased :: (key: KeyboardKey) -> bool { return IsKeyReleased(cast(s32) key); }
|
||||
IsKeyUp :: (key: KeyboardKey) -> bool { return IsKeyUp(cast(s32) key); }
|
||||
SetExitKey :: (key: KeyboardKey) -> void { return SetExitKey(cast(s32) key); }
|
||||
|
||||
SetConfigFlags :: (flags: ConfigFlags) -> void { return SetConfigFlags(cast(u32) flags); }
|
||||
|
||||
SetGesturesEnabled :: (flags: Gesture) -> void { return SetGesturesEnabled(cast(u32) flags); }
|
||||
IsGestureDetected :: (gesture: Gesture) -> bool { return IsGestureDetected(cast(u32) gesture); }
|
||||
|
||||
IsWindowState :: (flag: ConfigFlags) -> bool { return IsWindowState(cast(u32) flag); }
|
||||
SetWindowState :: (flags: ConfigFlags) -> void { return SetWindowState(cast(u32) flags); }
|
||||
ClearWindowState :: (flags: ConfigFlags) -> void { return ClearWindowState(cast(u32) flags); }
|
||||
|
||||
UpdateCamera :: (camera: *Camera, mode: CameraMode) -> void { return UpdateCamera(camera, cast(s32) mode); }
|
||||
|
||||
SetTraceLogLevel :: (logLevel: TraceLogLevel) -> void { return SetTraceLogLevel(cast(s32) logLevel); }
|
||||
TraceLog :: (logLevel: TraceLogLevel, text: string, __args: ..Any) { TraceLog(cast(s32) logLevel, text, __args); }
|
||||
|
||||
SetShaderValue :: (shader: Shader, locIndex: s32, value: *void, uniformType: ShaderUniformDataType) -> void {
|
||||
return SetShaderValue(shader, locIndex, value, cast(s32) uniformType);
|
||||
}
|
||||
SetShaderValueV :: (shader: Shader, locIndex: s32, value: *void, uniformType: ShaderUniformDataType, count: s32) -> void {
|
||||
return SetShaderValue(shader, locIndex, value, cast(s32) uniformType, count);
|
||||
}
|
||||
|
||||
IsGamepadButtonPressed :: (gamepad: s32, button: GamepadButton) -> bool { return IsGamepadButtonPressed(gamepad, cast(s32) button); }
|
||||
IsGamepadButtonDown :: (gamepad: s32, button: GamepadButton) -> bool { return IsGamepadButtonDown(gamepad, cast(s32) button); }
|
||||
IsGamepadButtonReleased :: (gamepad: s32, button: GamepadButton) -> bool { return IsGamepadButtonReleased(gamepad, cast(s32) button); }
|
||||
IsGamepadButtonUp :: (gamepad: s32, button: GamepadButton) -> bool { return IsGamepadButtonUp(gamepad, cast(s32) button); }
|
||||
|
||||
GetGamepadAxisMovement :: (gamepad: s32, axis: GamepadAxis) -> float { return GetGamepadAxisMovement(gamepad, cast(s32) axis); }
|
||||
|
||||
SetTextureFilter :: (texture: Texture2D, filter: TextureFilter) -> void { return SetTextureFilter(texture, cast(s32) filter); }
|
||||
SetTextureWrap :: (texture: Texture2D, wrap: TextureWrap) -> void { return SetTextureWrap(textuer, cast(s32) wrap); }
|
||||
|
||||
BeginBlendMode :: (mode: BlendMode) -> void { return BeginBlendMode(cast(s32) mode); }
|
||||
|
||||
ImageFormat :: (image: *Image, newFormat: PixelFormat) -> void { return ImageFormat(image, cast(s32) newFormat); }
|
||||
|
||||
LoadImageRaw :: (fileName: *u8, width: s32, height: s32, format: PixelFormat, headerSize: s32) -> Image {
|
||||
return LoadImageRaw(fileName, width, height, cast(s32) format, headerSize);
|
||||
}
|
||||
|
||||
LoadFontData :: (fileData: *u8, dataSize: s32, fontSize: s32, codepoints: *s32, codepointCount: s32, type: FontType) -> *GlyphInfo {
|
||||
return LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, cast(s32) type);
|
||||
}
|
||||
|
||||
SetMouseCursor :: (cursor: MouseCursor) -> void { return SetMouseCursor(cast(s32) cursor); }
|
||||
|
||||
LoadTexture :: (data: *void, width: s32, height: s32, format: PixelFormat, mipmapCount: s32) -> u32 {
|
||||
return LoadTexture(data, width, height, cast(s32) format, mipmapCount);
|
||||
}
|
||||
|
||||
FramebufferAttach :: (fboId: u32, texId: u32, attachType: FramebufferAttachType, texType: FramebufferAttachTextureType, mipLevel: s32) -> void {
|
||||
return FramebufferAttach(fbiId, texId, cast(s32) attachType, cast(s32) texType, mipLevel);
|
||||
}
|
||||
|
||||
SetUniform :: (locIndex: s32, value: *void, uniformType: ShaderUniformDataType, count: s32) -> void { return SetUniform(locIndex, value, cast(s32) uniformType, count); }
|
||||
|
||||
SetMaterialTexture :: (material: *Material, mapType: MaterialMapIndex, texture: Texture2D) -> void { return SetMaterialTexture(material, mapType, texture); }
|
||||
|
||||
Camera3D :: struct {
|
||||
position: Vector3; // Camera position
|
||||
target: Vector3; // Camera target it looks-at
|
||||
up: Vector3; // Camera up vector (rotation over its axis)
|
||||
fovy: float; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
|
||||
projection: CameraProjection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
||||
}
|
||||
|
||||
TraceLogCallback :: #type (logLevel: TraceLogLevel, text: *u8, args: .. Any) #c_call;
|
||||
|
||||
#scope_module
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
user32 :: #system_library,link_always "user32";
|
||||
gdi32 :: #system_library,link_always "gdi32";
|
||||
shell32 :: #system_library,link_always "shell32";
|
||||
winmm :: #system_library,link_always "winmm";
|
||||
|
||||
raylib :: #library,no_dll "windows/raylib";
|
||||
|
||||
#load "windows.jai";
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
#import "Basic";
|
||||
Math :: #import "Math";
|
@ -11,7 +11,7 @@ SUPPORT_MODULE_RTEXTURES :: 1;
|
||||
SUPPORT_MODULE_RTEXT :: 1;
|
||||
SUPPORT_MODULE_RMODELS :: 1;
|
||||
SUPPORT_MODULE_RAUDIO :: 1;
|
||||
PLATFORM_DESKTOP_RGFW :: 1;
|
||||
PLATFORM_DESKTOP_GLFW :: 1;
|
||||
GRAPHICS_API_OPENGL_43 :: 1;
|
||||
RAYLIB_VERSION_MAJOR :: 5;
|
||||
RAYLIB_VERSION_MINOR :: 5;
|
||||
@ -24,6 +24,8 @@ RAD2DEG :: 180.0/PI;
|
||||
|
||||
GetMouseRay :: GetScreenToWorldRay;
|
||||
|
||||
EPSILON :: 0.000001;
|
||||
|
||||
RLGL_VERSION :: "5.0";
|
||||
|
||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192;
|
||||
@ -212,15 +214,6 @@ Font :: struct {
|
||||
glyphs: *GlyphInfo; // Glyphs info data
|
||||
}
|
||||
|
||||
// Camera, defines position/orientation in 3d space
|
||||
Camera3D :: struct {
|
||||
position: Vector3; // Camera position
|
||||
target: Vector3; // Camera target it looks-at
|
||||
up: Vector3; // Camera up vector (rotation over its axis)
|
||||
fovy: float; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
|
||||
projection: s32; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
||||
}
|
||||
|
||||
Camera :: Camera3D;
|
||||
|
||||
// Camera2D, defines position/orientation in 2d space
|
||||
@ -460,7 +453,7 @@ ConfigFlags :: enum_flags u32 {
|
||||
|
||||
// Trace log level
|
||||
// NOTE: Organized by priority level
|
||||
TraceLogLevel :: enum u32 {
|
||||
TraceLogLevel :: enum s32 {
|
||||
ALL :: 0;
|
||||
TRACE :: 1;
|
||||
DEBUG :: 2;
|
||||
@ -483,7 +476,7 @@ TraceLogLevel :: enum u32 {
|
||||
// Keyboard keys (US keyboard layout)
|
||||
// NOTE: Use GetKeyPressed() to allow redefining
|
||||
// required keys for alternative layouts
|
||||
KeyboardKey :: enum u32 {
|
||||
KeyboardKey :: enum s32 {
|
||||
NULL :: 0;
|
||||
|
||||
APOSTROPHE :: 39;
|
||||
@ -716,7 +709,7 @@ KeyboardKey :: enum u32 {
|
||||
}
|
||||
|
||||
// Mouse buttons
|
||||
MouseButton :: enum u32 {
|
||||
MouseButton :: enum s32 {
|
||||
LEFT :: 0;
|
||||
RIGHT :: 1;
|
||||
MIDDLE :: 2;
|
||||
@ -735,7 +728,7 @@ MouseButton :: enum u32 {
|
||||
}
|
||||
|
||||
// Mouse cursor
|
||||
MouseCursor :: enum u32 {
|
||||
MouseCursor :: enum s32 {
|
||||
DEFAULT :: 0;
|
||||
ARROW :: 1;
|
||||
IBEAM :: 2;
|
||||
@ -762,7 +755,7 @@ MouseCursor :: enum u32 {
|
||||
}
|
||||
|
||||
// Gamepad buttons
|
||||
GamepadButton :: enum u32 {
|
||||
GamepadButton :: enum s32 {
|
||||
UNKNOWN :: 0;
|
||||
LEFT_FACE_UP :: 1;
|
||||
LEFT_FACE_RIGHT :: 2;
|
||||
@ -803,7 +796,7 @@ GamepadButton :: enum u32 {
|
||||
}
|
||||
|
||||
// Gamepad axis
|
||||
GamepadAxis :: enum u32 {
|
||||
GamepadAxis :: enum s32 {
|
||||
LEFT_X :: 0;
|
||||
LEFT_Y :: 1;
|
||||
RIGHT_X :: 2;
|
||||
@ -820,7 +813,7 @@ GamepadAxis :: enum u32 {
|
||||
}
|
||||
|
||||
// Material map index
|
||||
MaterialMapIndex :: enum u32 {
|
||||
MaterialMapIndex :: enum s32 {
|
||||
ALBEDO :: 0;
|
||||
METALNESS :: 1;
|
||||
NORMAL :: 2;
|
||||
@ -847,7 +840,7 @@ MaterialMapIndex :: enum u32 {
|
||||
}
|
||||
|
||||
// Shader location index
|
||||
ShaderLocationIndex :: enum u32 {
|
||||
ShaderLocationIndex :: enum s32 {
|
||||
VERTEX_POSITION :: 0;
|
||||
VERTEX_TEXCOORD01 :: 1;
|
||||
VERTEX_TEXCOORD02 :: 2;
|
||||
@ -910,7 +903,7 @@ ShaderLocationIndex :: enum u32 {
|
||||
}
|
||||
|
||||
// Shader uniform data type
|
||||
ShaderUniformDataType :: enum u32 {
|
||||
ShaderUniformDataType :: enum s32 {
|
||||
FLOAT :: 0;
|
||||
VEC2 :: 1;
|
||||
VEC3 :: 2;
|
||||
@ -933,7 +926,7 @@ ShaderUniformDataType :: enum u32 {
|
||||
}
|
||||
|
||||
// Shader attribute data types
|
||||
ShaderAttributeDataType :: enum u32 {
|
||||
ShaderAttributeDataType :: enum s32 {
|
||||
FLOAT :: 0;
|
||||
VEC2 :: 1;
|
||||
VEC3 :: 2;
|
||||
@ -947,7 +940,7 @@ ShaderAttributeDataType :: enum u32 {
|
||||
|
||||
// Pixel formats
|
||||
// NOTE: Support depends on OpenGL version and platform
|
||||
PixelFormat :: enum u32 {
|
||||
PixelFormat :: enum s32 {
|
||||
UNCOMPRESSED_GRAYSCALE :: 1;
|
||||
UNCOMPRESSED_GRAY_ALPHA :: 2;
|
||||
UNCOMPRESSED_R5G6B5 :: 3;
|
||||
@ -1002,7 +995,7 @@ PixelFormat :: enum u32 {
|
||||
// Texture parameters: filter mode
|
||||
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||
TextureFilter :: enum u32 {
|
||||
TextureFilter :: enum s32 {
|
||||
POINT :: 0;
|
||||
BILINEAR :: 1;
|
||||
TRILINEAR :: 2;
|
||||
@ -1019,7 +1012,7 @@ TextureFilter :: enum u32 {
|
||||
}
|
||||
|
||||
// Texture parameters: wrap mode
|
||||
TextureWrap :: enum u32 {
|
||||
TextureWrap :: enum s32 {
|
||||
REPEAT :: 0;
|
||||
CLAMP :: 1;
|
||||
MIRROR_REPEAT :: 2;
|
||||
@ -1032,7 +1025,7 @@ TextureWrap :: enum u32 {
|
||||
}
|
||||
|
||||
// Cubemap layouts
|
||||
CubemapLayout :: enum u32 {
|
||||
CubemapLayout :: enum s32 {
|
||||
AUTO_DETECT :: 0;
|
||||
LINE_VERTICAL :: 1;
|
||||
LINE_HORIZONTAL :: 2;
|
||||
@ -1047,7 +1040,7 @@ CubemapLayout :: enum u32 {
|
||||
}
|
||||
|
||||
// Font type, defines generation method
|
||||
FontType :: enum u32 {
|
||||
FontType :: enum s32 {
|
||||
DEFAULT :: 0;
|
||||
BITMAP :: 1;
|
||||
SDF :: 2;
|
||||
@ -1058,7 +1051,7 @@ FontType :: enum u32 {
|
||||
}
|
||||
|
||||
// Color blending modes (pre-defined)
|
||||
BlendMode :: enum u32 {
|
||||
BlendMode :: enum s32 {
|
||||
ALPHA :: 0;
|
||||
ADDITIVE :: 1;
|
||||
MULTIPLIED :: 2;
|
||||
@ -1107,7 +1100,7 @@ Gesture :: enum_flags u32 {
|
||||
}
|
||||
|
||||
// Camera system modes
|
||||
CameraMode :: enum u32 {
|
||||
CameraMode :: enum s32 {
|
||||
CUSTOM :: 0;
|
||||
FREE :: 1;
|
||||
ORBITAL :: 2;
|
||||
@ -1122,7 +1115,7 @@ CameraMode :: enum u32 {
|
||||
}
|
||||
|
||||
// Camera projection
|
||||
CameraProjection :: enum u32 {
|
||||
CameraProjection :: enum s32 {
|
||||
PERSPECTIVE :: 0;
|
||||
ORTHOGRAPHIC :: 1;
|
||||
|
||||
@ -1131,7 +1124,7 @@ CameraProjection :: enum u32 {
|
||||
}
|
||||
|
||||
// N-patch layout
|
||||
NPatchLayout :: enum u32 {
|
||||
NPatchLayout :: enum s32 {
|
||||
NINE_PATCH :: 0;
|
||||
THREE_PATCH_VERTICAL :: 1;
|
||||
THREE_PATCH_HORIZONTAL :: 2;
|
||||
@ -1141,9 +1134,6 @@ NPatchLayout :: enum u32 {
|
||||
NPATCH_THREE_PATCH_HORIZONTAL :: THREE_PATCH_HORIZONTAL;
|
||||
}
|
||||
|
||||
// Callbacks to hook some internal functions
|
||||
// WARNING: These callbacks are intended for advanced users
|
||||
TraceLogCallback :: *void /* function type contained C va_list argument */;
|
||||
LoadFileDataCallback :: #type (fileName: *u8, dataSize: *s32) -> *u8 #c_call;
|
||||
SaveFileDataCallback :: #type (fileName: *u8, data: *void, dataSize: s32) -> bool #c_call;
|
||||
LoadFileTextCallback :: #type (fileName: *u8) -> *u8 #c_call;
|
||||
@ -1371,10 +1361,11 @@ IsGamepadButtonPressed :: (gamepad: s32, button: s32) -> bool #foreign raylib;
|
||||
IsGamepadButtonDown :: (gamepad: s32, button: s32) -> bool #foreign raylib;
|
||||
IsGamepadButtonReleased :: (gamepad: s32, button: s32) -> bool #foreign raylib;
|
||||
IsGamepadButtonUp :: (gamepad: s32, button: s32) -> bool #foreign raylib;
|
||||
GetGamepadButtonPressed :: () -> s32 #foreign raylib;
|
||||
|
||||
GetGamepadAxisCount :: (gamepad: s32) -> s32 #foreign raylib;
|
||||
GetGamepadAxisMovement :: (gamepad: s32, axis: s32) -> float #foreign raylib;
|
||||
SetGamepadMappings :: (mappings: *u8) -> s32 #foreign raylib;
|
||||
SetGamepadVibration :: (gamepad: s32, leftMotor: float, rightMotor: float, duration: float) -> void #foreign raylib;
|
||||
|
||||
// Input-related functions: mouse
|
||||
IsMouseButtonPressed :: (button: s32) -> bool #foreign raylib;
|
||||
@ -1877,6 +1868,467 @@ DetachAudioStreamProcessor :: (stream: AudioStream, processor: AudioCallback) ->
|
||||
AttachAudioMixedProcessor :: (processor: AudioCallback) -> void #foreign raylib;
|
||||
DetachAudioMixedProcessor :: (processor: AudioCallback) -> void #foreign raylib;
|
||||
|
||||
// NOTE: Helper types to be used instead of array return types for *ToFloat functions
|
||||
float3 :: struct {
|
||||
v: [3] float;
|
||||
}
|
||||
|
||||
float16 :: struct {
|
||||
v: [16] float;
|
||||
}
|
||||
|
||||
// Clamp float value
|
||||
Clamp :: (value: float, min: float, max: float) -> float #foreign raylib;
|
||||
|
||||
// Calculate linear interpolation between two floats
|
||||
Lerp :: (start: float, end: float, amount: float) -> float #foreign raylib;
|
||||
|
||||
// Normalize input value within input range
|
||||
Normalize :: (value: float, start: float, end: float) -> float #foreign raylib;
|
||||
|
||||
// Remap input value within input range to output range
|
||||
Remap :: (value: float, inputStart: float, inputEnd: float, outputStart: float, outputEnd: float) -> float #foreign raylib;
|
||||
|
||||
// Wrap input value from min to max
|
||||
Wrap :: (value: float, min: float, max: float) -> float #foreign raylib;
|
||||
|
||||
// Check whether two given floats are almost equal
|
||||
FloatEquals :: (x: float, y: float) -> s32 #foreign raylib;
|
||||
|
||||
// Vector with components value 0.0f
|
||||
Vector2Zero :: () -> Vector2 #foreign raylib;
|
||||
|
||||
// Vector with components value 1.0f
|
||||
Vector2One :: () -> Vector2 #foreign raylib;
|
||||
|
||||
// Add two vectors (v1 + v2)
|
||||
Vector2Add :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Add vector and float value
|
||||
Vector2AddValue :: (v: Vector2, add: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Subtract two vectors (v1 - v2)
|
||||
Vector2Subtract :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Subtract vector by float value
|
||||
Vector2SubtractValue :: (v: Vector2, sub: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Calculate vector length
|
||||
Vector2Length :: (v: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate vector square length
|
||||
Vector2LengthSqr :: (v: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate two vectors dot product
|
||||
Vector2DotProduct :: (v1: Vector2, v2: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate distance between two vectors
|
||||
Vector2Distance :: (v1: Vector2, v2: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate square distance between two vectors
|
||||
Vector2DistanceSqr :: (v1: Vector2, v2: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate angle between two vectors
|
||||
// NOTE: Angle is calculated from origin point (0, 0)
|
||||
Vector2Angle :: (v1: Vector2, v2: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Calculate angle defined by a two vectors line
|
||||
// NOTE: Parameters need to be normalized
|
||||
// Current implementation should be aligned with glm::angle
|
||||
Vector2LineAngle :: (start: Vector2, end: Vector2) -> float #foreign raylib;
|
||||
|
||||
// Scale vector (multiply by value)
|
||||
Vector2Scale :: (v: Vector2, scale: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Multiply vector by vector
|
||||
Vector2Multiply :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Negate vector
|
||||
Vector2Negate :: (v: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Divide vector by vector
|
||||
Vector2Divide :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Normalize provided vector
|
||||
Vector2Normalize :: (v: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Transforms a Vector2 by a given Matrix
|
||||
Vector2Transform :: (v: Vector2, mat: Matrix) -> Vector2 #foreign raylib;
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
Vector2Lerp :: (v1: Vector2, v2: Vector2, amount: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Calculate reflected vector to normal
|
||||
Vector2Reflect :: (v: Vector2, normal: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Get min value for each pair of components
|
||||
Vector2Min :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Get max value for each pair of components
|
||||
Vector2Max :: (v1: Vector2, v2: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Rotate vector by angle
|
||||
Vector2Rotate :: (v: Vector2, angle: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Move Vector towards target
|
||||
Vector2MoveTowards :: (v: Vector2, target: Vector2, maxDistance: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Invert the given vector
|
||||
Vector2Invert :: (v: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Clamp the components of the vector between
|
||||
// min and max values specified by the given vectors
|
||||
Vector2Clamp :: (v: Vector2, min: Vector2, max: Vector2) -> Vector2 #foreign raylib;
|
||||
|
||||
// Clamp the magnitude of the vector between two min and max values
|
||||
Vector2ClampValue :: (v: Vector2, min: float, max: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Check whether two given vectors are almost equal
|
||||
Vector2Equals :: (p: Vector2, q: Vector2) -> s32 #foreign raylib;
|
||||
|
||||
// Compute the direction of a refracted ray
|
||||
// v: normalized direction of the incoming ray
|
||||
// n: normalized normal vector of the interface of two optical media
|
||||
// r: ratio of the refractive index of the medium from where the ray comes
|
||||
// to the refractive index of the medium on the other side of the surface
|
||||
Vector2Refract :: (v: Vector2, n: Vector2, r: float) -> Vector2 #foreign raylib;
|
||||
|
||||
// Vector with components value 0.0f
|
||||
Vector3Zero :: () -> Vector3 #foreign raylib;
|
||||
|
||||
// Vector with components value 1.0f
|
||||
Vector3One :: () -> Vector3 #foreign raylib;
|
||||
|
||||
// Add two vectors
|
||||
Vector3Add :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Add vector and float value
|
||||
Vector3AddValue :: (v: Vector3, add: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Subtract two vectors
|
||||
Vector3Subtract :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Subtract vector by float value
|
||||
Vector3SubtractValue :: (v: Vector3, sub: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Multiply vector by scalar
|
||||
Vector3Scale :: (v: Vector3, scalar: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Multiply vector by vector
|
||||
Vector3Multiply :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate two vectors cross product
|
||||
Vector3CrossProduct :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate one vector perpendicular vector
|
||||
Vector3Perpendicular :: (v: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate vector length
|
||||
Vector3Length :: (v: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Calculate vector square length
|
||||
Vector3LengthSqr :: (v: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Calculate two vectors dot product
|
||||
Vector3DotProduct :: (v1: Vector3, v2: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Calculate distance between two vectors
|
||||
Vector3Distance :: (v1: Vector3, v2: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Calculate square distance between two vectors
|
||||
Vector3DistanceSqr :: (v1: Vector3, v2: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Calculate angle between two vectors
|
||||
Vector3Angle :: (v1: Vector3, v2: Vector3) -> float #foreign raylib;
|
||||
|
||||
// Negate provided vector (invert direction)
|
||||
Vector3Negate :: (v: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Divide vector by vector
|
||||
Vector3Divide :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Normalize provided vector
|
||||
Vector3Normalize :: (v: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
//Calculate the projection of the vector v1 on to v2
|
||||
Vector3Project :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
//Calculate the rejection of the vector v1 on to v2
|
||||
Vector3Reject :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Orthonormalize provided vectors
|
||||
// Makes vectors normalized and orthogonal to each other
|
||||
// Gram-Schmidt function implementation
|
||||
Vector3OrthoNormalize :: (v1: *Vector3, v2: *Vector3) -> void #foreign raylib;
|
||||
|
||||
// Transforms a Vector3 by a given Matrix
|
||||
Vector3Transform :: (v: Vector3, mat: Matrix) -> Vector3 #foreign raylib;
|
||||
|
||||
// Transform a vector by quaternion rotation
|
||||
Vector3RotateByQuaternion :: (v: Vector3, q: Quaternion) -> Vector3 #foreign raylib;
|
||||
|
||||
// Rotates a vector around an axis
|
||||
Vector3RotateByAxisAngle :: (v: Vector3, axis: Vector3, angle: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Move Vector towards target
|
||||
Vector3MoveTowards :: (v: Vector3, target: Vector3, maxDistance: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
Vector3Lerp :: (v1: Vector3, v2: Vector3, amount: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate cubic hermite interpolation between two vectors and their tangents
|
||||
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
Vector3CubicHermite :: (v1: Vector3, tangent1: Vector3, v2: Vector3, tangent2: Vector3, amount: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Calculate reflected vector to normal
|
||||
Vector3Reflect :: (v: Vector3, normal: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Get min value for each pair of components
|
||||
Vector3Min :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Get max value for each pair of components
|
||||
Vector3Max :: (v1: Vector3, v2: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
|
||||
// NOTE: Assumes P is on the plane of the triangle
|
||||
Vector3Barycenter :: (p: Vector3, a: Vector3, b: Vector3, c: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Projects a Vector3 from screen space into object space
|
||||
// NOTE: We are avoiding calling other raymath functions despite available
|
||||
Vector3Unproject :: (source: Vector3, projection: Matrix, view: Matrix) -> Vector3 #foreign raylib;
|
||||
|
||||
// Get Vector3 as float array
|
||||
Vector3ToFloatV :: (v: Vector3) -> float3 #foreign raylib;
|
||||
|
||||
// Invert the given vector
|
||||
Vector3Invert :: (v: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Clamp the components of the vector between
|
||||
// min and max values specified by the given vectors
|
||||
Vector3Clamp :: (v: Vector3, min: Vector3, max: Vector3) -> Vector3 #foreign raylib;
|
||||
|
||||
// Clamp the magnitude of the vector between two values
|
||||
Vector3ClampValue :: (v: Vector3, min: float, max: float) -> Vector3 #foreign raylib;
|
||||
|
||||
// Check whether two given vectors are almost equal
|
||||
Vector3Equals :: (p: Vector3, q: Vector3) -> s32 #foreign raylib;
|
||||
|
||||
// Compute the direction of a refracted ray
|
||||
// v: normalized direction of the incoming ray
|
||||
// n: normalized normal vector of the interface of two optical media
|
||||
// r: ratio of the refractive index of the medium from where the ray comes
|
||||
// to the refractive index of the medium on the other side of the surface
|
||||
Vector3Refract :: (v: Vector3, n: Vector3, r: float) -> Vector3 #foreign raylib;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector4 math
|
||||
//----------------------------------------------------------------------------------
|
||||
Vector4Zero :: () -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4One :: () -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4Add :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4AddValue :: (v: Vector4, add: float) -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4Subtract :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4SubtractValue :: (v: Vector4, add: float) -> Vector4 #foreign raylib;
|
||||
|
||||
Vector4Length :: (v: Vector4) -> float #foreign raylib;
|
||||
|
||||
Vector4LengthSqr :: (v: Vector4) -> float #foreign raylib;
|
||||
|
||||
Vector4DotProduct :: (v1: Vector4, v2: Vector4) -> float #foreign raylib;
|
||||
|
||||
// Calculate distance between two vectors
|
||||
Vector4Distance :: (v1: Vector4, v2: Vector4) -> float #foreign raylib;
|
||||
|
||||
// Calculate square distance between two vectors
|
||||
Vector4DistanceSqr :: (v1: Vector4, v2: Vector4) -> float #foreign raylib;
|
||||
|
||||
Vector4Scale :: (v: Vector4, scale: float) -> Vector4 #foreign raylib;
|
||||
|
||||
// Multiply vector by vector
|
||||
Vector4Multiply :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Negate vector
|
||||
Vector4Negate :: (v: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Divide vector by vector
|
||||
Vector4Divide :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Normalize provided vector
|
||||
Vector4Normalize :: (v: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Get min value for each pair of components
|
||||
Vector4Min :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Get max value for each pair of components
|
||||
Vector4Max :: (v1: Vector4, v2: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
Vector4Lerp :: (v1: Vector4, v2: Vector4, amount: float) -> Vector4 #foreign raylib;
|
||||
|
||||
// Move Vector towards target
|
||||
Vector4MoveTowards :: (v: Vector4, target: Vector4, maxDistance: float) -> Vector4 #foreign raylib;
|
||||
|
||||
// Invert the given vector
|
||||
Vector4Invert :: (v: Vector4) -> Vector4 #foreign raylib;
|
||||
|
||||
// Check whether two given vectors are almost equal
|
||||
Vector4Equals :: (p: Vector4, q: Vector4) -> s32 #foreign raylib;
|
||||
|
||||
// Compute matrix determinant
|
||||
MatrixDeterminant :: (mat: Matrix) -> float #foreign raylib;
|
||||
|
||||
// Get the trace of the matrix (sum of the values along the diagonal)
|
||||
MatrixTrace :: (mat: Matrix) -> float #foreign raylib;
|
||||
|
||||
// Transposes provided matrix
|
||||
MatrixTranspose :: (mat: Matrix) -> Matrix #foreign raylib;
|
||||
|
||||
// Invert provided matrix
|
||||
MatrixInvert :: (mat: Matrix) -> Matrix #foreign raylib;
|
||||
|
||||
// Get identity matrix
|
||||
MatrixIdentity :: () -> Matrix #foreign raylib;
|
||||
|
||||
// Add two matrices
|
||||
MatrixAdd :: (left: Matrix, right: Matrix) -> Matrix #foreign raylib;
|
||||
|
||||
// Subtract two matrices (left - right)
|
||||
MatrixSubtract :: (left: Matrix, right: Matrix) -> Matrix #foreign raylib;
|
||||
|
||||
// Get two matrix multiplication
|
||||
// NOTE: When multiplying matrices... the order matters!
|
||||
MatrixMultiply :: (left: Matrix, right: Matrix) -> Matrix #foreign raylib;
|
||||
|
||||
// Get translation matrix
|
||||
MatrixTranslate :: (x: float, y: float, z: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Create rotation matrix from axis and angle
|
||||
// NOTE: Angle should be provided in radians
|
||||
MatrixRotate :: (axis: Vector3, angle: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Get x-rotation matrix
|
||||
// NOTE: Angle must be provided in radians
|
||||
MatrixRotateX :: (angle: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Get y-rotation matrix
|
||||
// NOTE: Angle must be provided in radians
|
||||
MatrixRotateY :: (angle: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Get z-rotation matrix
|
||||
// NOTE: Angle must be provided in radians
|
||||
MatrixRotateZ :: (angle: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Get xyz-rotation matrix
|
||||
// NOTE: Angle must be provided in radians
|
||||
MatrixRotateXYZ :: (angle: Vector3) -> Matrix #foreign raylib;
|
||||
|
||||
// Get zyx-rotation matrix
|
||||
// NOTE: Angle must be provided in radians
|
||||
MatrixRotateZYX :: (angle: Vector3) -> Matrix #foreign raylib;
|
||||
|
||||
// Get scaling matrix
|
||||
MatrixScale :: (x: float, y: float, z: float) -> Matrix #foreign raylib;
|
||||
|
||||
// Get perspective projection matrix
|
||||
MatrixFrustum :: (left: float64, right: float64, bottom: float64, top: float64, nearPlane: float64, farPlane: float64) -> Matrix #foreign raylib;
|
||||
|
||||
// Get perspective projection matrix
|
||||
// NOTE: Fovy angle must be provided in radians
|
||||
MatrixPerspective :: (fovY: float64, aspect: float64, nearPlane: float64, farPlane: float64) -> Matrix #foreign raylib;
|
||||
|
||||
// Get orthographic projection matrix
|
||||
MatrixOrtho :: (left: float64, right: float64, bottom: float64, top: float64, nearPlane: float64, farPlane: float64) -> Matrix #foreign raylib;
|
||||
|
||||
// Get camera look-at matrix (view matrix)
|
||||
MatrixLookAt :: (eye: Vector3, target: Vector3, up: Vector3) -> Matrix #foreign raylib;
|
||||
|
||||
// Get float array of matrix data
|
||||
MatrixToFloatV :: (mat: Matrix) -> float16 #foreign raylib;
|
||||
|
||||
// Add two quaternions
|
||||
QuaternionAdd :: (q1: Quaternion, q2: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Add quaternion and float value
|
||||
QuaternionAddValue :: (q: Quaternion, add: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Subtract two quaternions
|
||||
QuaternionSubtract :: (q1: Quaternion, q2: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Subtract quaternion and float value
|
||||
QuaternionSubtractValue :: (q: Quaternion, sub: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Get identity quaternion
|
||||
QuaternionIdentity :: () -> Quaternion #foreign raylib;
|
||||
|
||||
// Computes the length of a quaternion
|
||||
QuaternionLength :: (q: Quaternion) -> float #foreign raylib;
|
||||
|
||||
// Normalize provided quaternion
|
||||
QuaternionNormalize :: (q: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Invert provided quaternion
|
||||
QuaternionInvert :: (q: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculate two quaternion multiplication
|
||||
QuaternionMultiply :: (q1: Quaternion, q2: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Scale quaternion by float value
|
||||
QuaternionScale :: (q: Quaternion, mul: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Divide two quaternions
|
||||
QuaternionDivide :: (q1: Quaternion, q2: Quaternion) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculate linear interpolation between two quaternions
|
||||
QuaternionLerp :: (q1: Quaternion, q2: Quaternion, amount: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculate slerp-optimized interpolation between two quaternions
|
||||
QuaternionNlerp :: (q1: Quaternion, q2: Quaternion, amount: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculates spherical linear interpolation between two quaternions
|
||||
QuaternionSlerp :: (q1: Quaternion, q2: Quaternion, amount: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculate quaternion cubic spline interpolation using Cubic Hermite Spline algorithm
|
||||
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
QuaternionCubicHermiteSpline :: (q1: Quaternion, outTangent1: Quaternion, q2: Quaternion, inTangent2: Quaternion, t: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Calculate quaternion based on the rotation from one vector to another
|
||||
QuaternionFromVector3ToVector3 :: (from: Vector3, to: Vector3) -> Quaternion #foreign raylib;
|
||||
|
||||
// Get a quaternion for a given rotation matrix
|
||||
QuaternionFromMatrix :: (mat: Matrix) -> Quaternion #foreign raylib;
|
||||
|
||||
// Get a matrix for a given quaternion
|
||||
QuaternionToMatrix :: (q: Quaternion) -> Matrix #foreign raylib;
|
||||
|
||||
// Get rotation quaternion for an angle and axis
|
||||
// NOTE: Angle must be provided in radians
|
||||
QuaternionFromAxisAngle :: (axis: Vector3, angle: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Get the rotation angle and axis for a given quaternion
|
||||
QuaternionToAxisAngle :: (q: Quaternion, outAxis: *Vector3, outAngle: *float) -> void #foreign raylib;
|
||||
|
||||
// Get the quaternion equivalent to Euler angles
|
||||
// NOTE: Rotation order is ZYX
|
||||
QuaternionFromEuler :: (pitch: float, yaw: float, roll: float) -> Quaternion #foreign raylib;
|
||||
|
||||
// Get the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
||||
// NOTE: Angles are returned in a Vector3 struct in radians
|
||||
QuaternionToEuler :: (q: Quaternion) -> Vector3 #foreign raylib;
|
||||
|
||||
// Transform a quaternion given a transformation matrix
|
||||
QuaternionTransform :: (q: Quaternion, mat: Matrix) -> Quaternion #foreign raylib;
|
||||
|
||||
// Check whether two given quaternions are almost equal
|
||||
QuaternionEquals :: (p: Quaternion, q: Quaternion) -> s32 #foreign raylib;
|
||||
|
||||
// Decompose a transformation matrix into its rotational, translational and scaling components
|
||||
MatrixDecompose :: (mat: Matrix, translation: *Vector3, rotation: *Quaternion, scale: *Vector3) -> void #foreign raylib;
|
||||
|
||||
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||
VertexBuffer :: struct {
|
||||
elementCount: s32; // Number of elements in the buffer (QUADS)
|
||||
@ -1916,7 +2368,7 @@ RenderBatch :: struct {
|
||||
}
|
||||
|
||||
// OpenGL version
|
||||
GlVersion :: enum u32 {
|
||||
GlVersion :: enum s32 {
|
||||
_11 :: 1;
|
||||
_21 :: 2;
|
||||
_33 :: 3;
|
||||
@ -1934,7 +2386,7 @@ GlVersion :: enum u32 {
|
||||
|
||||
// Framebuffer attachment type
|
||||
// NOTE: By default up to 8 color channels defined, but it can be more
|
||||
FramebufferAttachType :: enum u32 {
|
||||
FramebufferAttachType :: enum s32 {
|
||||
COLOR_CHANNEL0 :: 0;
|
||||
COLOR_CHANNEL1 :: 1;
|
||||
COLOR_CHANNEL2 :: 2;
|
||||
@ -1959,7 +2411,7 @@ FramebufferAttachType :: enum u32 {
|
||||
}
|
||||
|
||||
// Framebuffer texture attachment type
|
||||
FramebufferAttachTextureType :: enum u32 {
|
||||
FramebufferAttachTextureType :: enum s32 {
|
||||
CUBEMAP_POSITIVE_X :: 0;
|
||||
CUBEMAP_NEGATIVE_X :: 1;
|
||||
CUBEMAP_POSITIVE_Y :: 2;
|
||||
@ -1980,7 +2432,7 @@ FramebufferAttachTextureType :: enum u32 {
|
||||
}
|
||||
|
||||
// Face culling mode
|
||||
CullMode :: enum u32 {
|
||||
CullMode :: enum s32 {
|
||||
FRONT :: 0;
|
||||
BACK :: 1;
|
||||
|
||||
@ -2191,7 +2643,6 @@ LoadDrawQuad :: () -> void #foreign raylib "rlLoadDrawQuad";
|
||||
|
||||
#import "Basic"; // For assert, push_context
|
||||
|
||||
raylib :: #library,no_dll "windows/raylib";
|
||||
|
||||
#run {
|
||||
{
|
||||
@ -2310,21 +2761,6 @@ raylib :: #library,no_dll "windows/raylib";
|
||||
assert(size_of(Font) == 48, "Font has size % instead of 48", size_of(Font));
|
||||
}
|
||||
|
||||
{
|
||||
instance: Camera3D;
|
||||
assert(((cast(*void)(*instance.position)) - cast(*void)(*instance)) == 0, "Camera3D.position has unexpected offset % instead of 0", ((cast(*void)(*instance.position)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Camera3D.position)) == 12, "Camera3D.position has unexpected size % instead of 12", size_of(type_of(Camera3D.position)));
|
||||
assert(((cast(*void)(*instance.target)) - cast(*void)(*instance)) == 12, "Camera3D.target has unexpected offset % instead of 12", ((cast(*void)(*instance.target)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Camera3D.target)) == 12, "Camera3D.target has unexpected size % instead of 12", size_of(type_of(Camera3D.target)));
|
||||
assert(((cast(*void)(*instance.up)) - cast(*void)(*instance)) == 24, "Camera3D.up has unexpected offset % instead of 24", ((cast(*void)(*instance.up)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Camera3D.up)) == 12, "Camera3D.up has unexpected size % instead of 12", size_of(type_of(Camera3D.up)));
|
||||
assert(((cast(*void)(*instance.fovy)) - cast(*void)(*instance)) == 36, "Camera3D.fovy has unexpected offset % instead of 36", ((cast(*void)(*instance.fovy)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Camera3D.fovy)) == 4, "Camera3D.fovy has unexpected size % instead of 4", size_of(type_of(Camera3D.fovy)));
|
||||
assert(((cast(*void)(*instance.projection)) - cast(*void)(*instance)) == 40, "Camera3D.projection has unexpected offset % instead of 40", ((cast(*void)(*instance.projection)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Camera3D.projection)) == 4, "Camera3D.projection has unexpected size % instead of 4", size_of(type_of(Camera3D.projection)));
|
||||
assert(size_of(Camera3D) == 44, "Camera3D has size % instead of 44", size_of(Camera3D));
|
||||
}
|
||||
|
||||
{
|
||||
instance: Camera2D;
|
||||
assert(((cast(*void)(*instance.offset)) - cast(*void)(*instance)) == 0, "Camera2D.offset has unexpected offset % instead of 0", ((cast(*void)(*instance.offset)) - cast(*void)(*instance)));
|
||||
@ -2628,6 +3064,20 @@ raylib :: #library,no_dll "windows/raylib";
|
||||
assert(size_of(AutomationEventList) == 16, "AutomationEventList has size % instead of 16", size_of(AutomationEventList));
|
||||
}
|
||||
|
||||
{
|
||||
instance: float3;
|
||||
assert(((cast(*void)(*instance.v)) - cast(*void)(*instance)) == 0, "float3.v has unexpected offset % instead of 0", ((cast(*void)(*instance.v)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(float3.v)) == 12, "float3.v has unexpected size % instead of 12", size_of(type_of(float3.v)));
|
||||
assert(size_of(float3) == 12, "float3 has size % instead of 12", size_of(float3));
|
||||
}
|
||||
|
||||
{
|
||||
instance: float16;
|
||||
assert(((cast(*void)(*instance.v)) - cast(*void)(*instance)) == 0, "float16.v has unexpected offset % instead of 0", ((cast(*void)(*instance.v)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(float16.v)) == 64, "float16.v has unexpected size % instead of 64", size_of(type_of(float16.v)));
|
||||
assert(size_of(float16) == 64, "float16 has size % instead of 64", size_of(float16));
|
||||
}
|
||||
|
||||
{
|
||||
instance: VertexBuffer;
|
||||
assert(((cast(*void)(*instance.elementCount)) - cast(*void)(*instance)) == 0, "VertexBuffer.elementCount has unexpected offset % instead of 0", ((cast(*void)(*instance.elementCount)) - cast(*void)(*instance)));
|
Binary file not shown.
@ -1,170 +0,0 @@
|
||||
AT_COMPILE_TIME :: true;
|
||||
|
||||
RAYLIB_PATH :: "raylib";
|
||||
|
||||
DECLARATIONS_TO_OMIT :: string.[
|
||||
// These have custom declarations in module.jai
|
||||
"Vector2",
|
||||
"Vector3",
|
||||
"Vector4",
|
||||
"Quaternion",
|
||||
"Matrix",
|
||||
"PI",
|
||||
];
|
||||
|
||||
DUPLICATE_DECLARATIONS :: string.[
|
||||
"rlTraceLogLevel",
|
||||
"rlPixelFormat",
|
||||
"rlTextureFilter",
|
||||
"rlBlendMode",
|
||||
"rlShaderLocationIndex",
|
||||
"rlShaderAttributeDataType",
|
||||
"rlShaderUniformDataType",
|
||||
];
|
||||
|
||||
#if AT_COMPILE_TIME {
|
||||
#run,stallable {
|
||||
Compiler.set_build_options_dc(.{do_output=false});
|
||||
root_options := Compiler.get_build_options();
|
||||
args := root_options.compile_time_command_line;
|
||||
if !generate_bindings(args) {
|
||||
Compiler.compiler_set_workspace_status(.FAILED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#import "System";
|
||||
|
||||
main :: () {
|
||||
set_working_directory(path_strip_filename(get_path_of_running_executable()));
|
||||
args := get_command_line_arguments();
|
||||
if !generate_bindings(args) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generate_bindings :: (args: [] string) -> bool
|
||||
{
|
||||
compile := array_find(args, "-compile");
|
||||
compile_debug := array_find(args, "-debug");
|
||||
|
||||
if compile {
|
||||
raylib_source_files: [..] string;
|
||||
array_add(*raylib_source_files, tprint("%/src/rcore.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/utils.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/rshapes.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/rtextures.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/rtext.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/rmodels.c", RAYLIB_PATH));
|
||||
array_add(*raylib_source_files, tprint("%/src/raudio.c", RAYLIB_PATH));
|
||||
|
||||
success := true;
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
File.make_directory_if_it_does_not_exist("windows");
|
||||
|
||||
success &&= BuildCpp.build_cpp_static_lib(
|
||||
"windows/raylib",
|
||||
..raylib_source_files,
|
||||
extra = .[
|
||||
"/w",
|
||||
"/DSUPPORT_MODULE_RSHAPES",
|
||||
"/DSUPPORT_MODULE_RTEXTURES",
|
||||
"/DSUPPORT_MODULE_RTEXT",
|
||||
"/DSUPPORT_MODULE_RMODELS",
|
||||
"/DSUPPORT_MODULE_RAUDIO",
|
||||
"/D_CRT_SECURE_NO_WARNINGS",
|
||||
"/DPLATFORM_DESKTOP_RGFW",
|
||||
"/DGRAPHICS_API_OPENGL_43",
|
||||
]
|
||||
);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
output_filename: string;
|
||||
opts: Generator.Generate_Bindings_Options;
|
||||
{
|
||||
using opts;
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
array_add(*libpaths, "windows");
|
||||
output_filename = "windows.jai";
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
array_add(*libnames, "raylib");
|
||||
array_add(*include_paths, RAYLIB_PATH);
|
||||
array_add(*source_files, tprint("%/src/raylib.h", RAYLIB_PATH));
|
||||
// Can't be compiled on windows because of missing math.h ? Leaving it out for now since Jai has the functions we need
|
||||
// array_add(*source_files, tprint("%/src/raymath.h", RAYLIB_PATH));
|
||||
array_add(*source_files, tprint("%/src/rlgl.h", RAYLIB_PATH));
|
||||
array_add(
|
||||
*extra_clang_arguments,
|
||||
"-c",
|
||||
"-DSUPPORT_MODULE_RSHAPES",
|
||||
"-DSUPPORT_MODULE_RTEXTURES",
|
||||
"-DSUPPORT_MODULE_RTEXT",
|
||||
"-DSUPPORT_MODULE_RMODELS",
|
||||
"-DSUPPORT_MODULE_RAUDIO",
|
||||
"-DPLATFORM_DESKTOP_RGFW",
|
||||
"-DGRAPHICS_API_OPENGL_43",
|
||||
);
|
||||
array_add(*strip_prefixes, "rl");
|
||||
|
||||
// auto_detect_enum_prefixes = true;
|
||||
// log_stripped_declarations = false;
|
||||
// generate_compile_time_struct_checks = true;
|
||||
|
||||
visitor = raylib_visitor;
|
||||
}
|
||||
|
||||
return Generator.generate_bindings(opts, output_filename);
|
||||
}
|
||||
|
||||
raylib_visitor :: (decl: *Generator.Declaration, parent_decl: *Generator.Declaration) -> Generator.Declaration_Visit_Result
|
||||
{
|
||||
if !parent_decl && array_find(DECLARATIONS_TO_OMIT, decl.name)
|
||||
{
|
||||
decl.decl_flags |= .OMIT_FROM_OUTPUT;
|
||||
return .STOP;
|
||||
}
|
||||
|
||||
if decl.kind == .ENUM {
|
||||
en := cast(*Generator.Enum)decl;
|
||||
if String.contains(decl.name, "Flags") || decl.name == "Gesture" {
|
||||
en.flags |= .IS_ENUM_FLAGS;
|
||||
en.flags |= .VALUES_IN_HEX;
|
||||
}
|
||||
|
||||
if array_find(DUPLICATE_DECLARATIONS, decl.name) {
|
||||
decl.decl_flags |= .OMIT_FROM_OUTPUT;
|
||||
return .STOP;
|
||||
}
|
||||
|
||||
if en.type {
|
||||
if en.type.size == {
|
||||
case 1;
|
||||
en.type = context.generator.type_def_u8;
|
||||
case 2;
|
||||
en.type = context.generator.type_def_u16;
|
||||
case 4;
|
||||
en.type = context.generator.type_def_u32;
|
||||
case 8;
|
||||
en.type = context.generator.type_def_u64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .RECURSE;
|
||||
}
|
||||
|
||||
using Basic :: #import "Basic";
|
||||
Generator :: #import "Bindings_Generator";
|
||||
Compiler :: #import "Compiler";
|
||||
String :: #import "String";
|
||||
BuildCpp :: #import "BuildCpp";
|
||||
File :: #import "File";
|
||||
WindowsResources :: #import "Windows_Resources";
|
@ -1,71 +0,0 @@
|
||||
|
||||
Vector2 :: Math.Vector2;
|
||||
Vector3 :: Math.Vector3;
|
||||
Vector4 :: Math.Vector4;
|
||||
Quaternion :: Math.Quaternion;
|
||||
Matrix :: Math.Matrix4;
|
||||
PI :: Math.PI;
|
||||
|
||||
LIGHTGRAY :: Color.{ 200, 200, 200, 255 };
|
||||
GRAY :: Color.{ 130, 130, 130, 255 };
|
||||
DARKGRAY :: Color.{ 80, 80, 80, 255 };
|
||||
YELLOW :: Color.{ 253, 249, 0, 255 };
|
||||
GOLD :: Color.{ 255, 203, 0, 255 };
|
||||
ORANGE :: Color.{ 255, 161, 0, 255 };
|
||||
PINK :: Color.{ 255, 109, 194, 255 };
|
||||
RED :: Color.{ 230, 41, 55, 255 };
|
||||
MAROON :: Color.{ 190, 33, 55, 255 };
|
||||
GREEN :: Color.{ 0, 228, 48, 255 };
|
||||
LIME :: Color.{ 0, 158, 47, 255 };
|
||||
DARKGREEN :: Color.{ 0, 117, 44, 255 };
|
||||
SKYBLUE :: Color.{ 102, 191, 255, 255 };
|
||||
BLUE :: Color.{ 0, 121, 241, 255 };
|
||||
DARKBLUE :: Color.{ 0, 82, 172, 255 };
|
||||
PURPLE :: Color.{ 200, 122, 255, 255 };
|
||||
VIOLET :: Color.{ 135, 60, 190, 255 };
|
||||
DARKPURPLE :: Color.{ 112, 31, 126, 255 };
|
||||
BEIGE :: Color.{ 211, 176, 131, 255 };
|
||||
BROWN :: Color.{ 127, 106, 79, 255 };
|
||||
DARKBROWN :: Color.{ 76, 63, 47, 255 };
|
||||
WHITE :: Color.{ 255, 255, 255, 255 };
|
||||
BLACK :: Color.{ 0, 0, 0, 255 };
|
||||
BLANK :: Color.{ 0, 0, 0, 0 };
|
||||
MAGENTA :: Color.{ 255, 0, 255, 255 };
|
||||
RAYWHITE :: Color.{ 245, 245, 245, 255 };
|
||||
|
||||
IsMouseButtonPressed :: (button: MouseButton) -> bool { return IsMouseButtonPressed(cast(s32) button); }
|
||||
IsMouseButtonDown :: (button: MouseButton) -> bool { return IsMouseButtonDown(cast(s32) button); }
|
||||
IsMouseButtonReleased :: (button: MouseButton) -> bool { return IsMouseButtonReleased(cast(s32) button); }
|
||||
IsMouseButtonUp :: (button: MouseButton) -> bool { return IsMouseButtonUp(cast(s32) button); }
|
||||
|
||||
IsKeyPressed :: (key: KeyboardKey) -> bool { return IsKeyPressed(cast(s32) key); }
|
||||
IsKeyPressedRepeat :: (key: KeyboardKey) -> bool { return IsKeyPressedRepeat(cast(s32) key); }
|
||||
IsKeyDown :: (key: KeyboardKey) -> bool { return IsKeyDown(cast(s32) key); }
|
||||
IsKeyReleased :: (key: KeyboardKey) -> bool { return IsKeyReleased(cast(s32) key); }
|
||||
IsKeyUp :: (key: KeyboardKey) -> bool { return IsKeyUp(cast(s32) key); }
|
||||
SetExitKey :: (key: KeyboardKey) -> void { return SetExitKey(cast(s32) key); }
|
||||
|
||||
SetConfigFlags :: (flags: ConfigFlags) -> void { return SetConfigFlags(cast(u32) flags); }
|
||||
SetGesturesEnabled :: (flags: Gesture) -> void { return SetGesturesEnabled(cast(u32) flags); }
|
||||
IsGestureDetected :: (gesture: Gesture) -> bool { return IsGestureDetected(cast(u32) gesture); }
|
||||
IsWindowState :: (flag: ConfigFlags) -> bool { return IsWindowState(cast(u32) flag); }
|
||||
SetWindowState :: (flags: ConfigFlags) -> void { return SetWindowState(cast(u32) flags); }
|
||||
ClearWindowState :: (flags: ConfigFlags) -> void { return ClearWindowState(cast(u32) flags); }
|
||||
|
||||
#scope_module
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
#load "windows.jai";
|
||||
winmm :: #system_library,link_always "winmm";
|
||||
user32 :: #system_library,link_always "user32";
|
||||
opengl32 :: #system_library,link_always "opengl32";
|
||||
gdi32 :: #system_library,link_always "gdi32";
|
||||
shell32 :: #system_library,link_always "shell32";
|
||||
shcore :: #system_library,link_always "shcore";
|
||||
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
#import "Basic";
|
||||
Math :: #import "Math";
|
Binary file not shown.
@ -31,10 +31,10 @@ generate_bindings :: (args: [] string, minimum_os_version: type_of(Compiler.Buil
|
||||
compile := array_find(args, "-compile");
|
||||
compile_debug := array_find(args, "-debug");
|
||||
|
||||
if compile {
|
||||
could_copy := FileUtils.copy_file("../../clay.h", "source/clay.h");
|
||||
if !could_copy then return false;
|
||||
could_copy := FileUtils.copy_file("../../clay.h", "source/clay.h");
|
||||
if !could_copy then return false;
|
||||
|
||||
if compile {
|
||||
source_file := tprint("%/clay.c", SOURCE_PATH);
|
||||
|
||||
success := true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// This file was auto-generated using the following command:
|
||||
//
|
||||
// jai ./generate.jai - -compile
|
||||
// jai d:/c/clay//bindings/jai/generate.jai jails_diagnostics modules import_dir c:/Users/Stowy/scoop/apps/vscode/1.96.2/data/extensions/apparentlystudio.jails-0.0.11/out/metaprogram
|
||||
//
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ StringArray :: struct {
|
||||
}
|
||||
|
||||
Arena :: struct {
|
||||
label: String;
|
||||
nextAllocation: u64;
|
||||
capacity: u64;
|
||||
memory: *u8;
|
||||
@ -125,10 +124,10 @@ SizingMinMax :: struct {
|
||||
}
|
||||
|
||||
SizingAxis :: struct {
|
||||
union {
|
||||
sizeMinMax: SizingMinMax;
|
||||
sizePercent: float;
|
||||
}
|
||||
size: union {
|
||||
minMax: SizingMinMax;
|
||||
percent: float;
|
||||
};
|
||||
|
||||
type: SizingType;
|
||||
}
|
||||
@ -337,32 +336,64 @@ PointerData :: struct {
|
||||
state: PointerDataInteractionState;
|
||||
}
|
||||
|
||||
ErrorType :: enum s32 {
|
||||
TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED :: 0;
|
||||
ARENA_CAPACITY_EXCEEDED :: 1;
|
||||
ELEMENTS_CAPACITY_EXCEEDED :: 2;
|
||||
TEXT_MEASUREMENT_CAPACITY_EXCEEDED :: 3;
|
||||
DUPLICATE_ID :: 4;
|
||||
FLOATING_CONTAINER_PARENT_NOT_FOUND :: 5;
|
||||
INTERNAL_ERROR :: 6;
|
||||
|
||||
CLAY_ERROR_TYPE_TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED :: TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED;
|
||||
CLAY_ERROR_TYPE_ARENA_CAPACITY_EXCEEDED :: ARENA_CAPACITY_EXCEEDED;
|
||||
CLAY_ERROR_TYPE_ELEMENTS_CAPACITY_EXCEEDED :: ELEMENTS_CAPACITY_EXCEEDED;
|
||||
CLAY_ERROR_TYPE_TEXT_MEASUREMENT_CAPACITY_EXCEEDED :: TEXT_MEASUREMENT_CAPACITY_EXCEEDED;
|
||||
CLAY_ERROR_TYPE_DUPLICATE_ID :: DUPLICATE_ID;
|
||||
CLAY_ERROR_TYPE_FLOATING_CONTAINER_PARENT_NOT_FOUND :: FLOATING_CONTAINER_PARENT_NOT_FOUND;
|
||||
CLAY_ERROR_TYPE_INTERNAL_ERROR :: INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
ErrorData :: struct {
|
||||
errorType: ErrorType;
|
||||
errorText: String;
|
||||
userData: u64;
|
||||
}
|
||||
|
||||
ErrorHandler :: struct {
|
||||
errorHandlerFunction: #type (errorText: ErrorData) -> void #c_call;
|
||||
userData: u64;
|
||||
}
|
||||
|
||||
// Function Forward Declarations ---------------------------------
|
||||
// Public API functions ---
|
||||
MinMemorySize :: (__args: ..Any) -> u32 #foreign clay "Clay_MinMemorySize";
|
||||
MinMemorySize :: () -> u32 #foreign clay "Clay_MinMemorySize";
|
||||
CreateArenaWithCapacityAndMemory :: (capacity: u32, offset: *void) -> Arena #foreign clay "Clay_CreateArenaWithCapacityAndMemory";
|
||||
SetPointerState :: (position: Vector2, pointerDown: bool) -> void #foreign clay "Clay_SetPointerState";
|
||||
Initialize :: (arena: Arena, layoutDimensions: Dimensions) -> void #foreign clay "Clay_Initialize";
|
||||
Initialize :: (arena: Arena, layoutDimensions: Dimensions, errorHandler: ErrorHandler) -> void #foreign clay "Clay_Initialize";
|
||||
UpdateScrollContainers :: (enableDragScrolling: bool, scrollDelta: Vector2, deltaTime: float) -> void #foreign clay "Clay_UpdateScrollContainers";
|
||||
SetLayoutDimensions :: (dimensions: Dimensions) -> void #foreign clay "Clay_SetLayoutDimensions";
|
||||
BeginLayout :: (__args: ..Any) -> void #foreign clay "Clay_BeginLayout";
|
||||
EndLayout :: (__args: ..Any) -> RenderCommandArray #foreign clay "Clay_EndLayout";
|
||||
BeginLayout :: () -> void #foreign clay "Clay_BeginLayout";
|
||||
EndLayout :: () -> RenderCommandArray #foreign clay "Clay_EndLayout";
|
||||
GetElementId :: (idString: String) -> ElementId #foreign clay "Clay_GetElementId";
|
||||
GetElementIdWithIndex :: (idString: String, index: u32) -> ElementId #foreign clay "Clay_GetElementIdWithIndex";
|
||||
Hovered :: (__args: ..Any) -> bool #foreign clay "Clay_Hovered";
|
||||
Hovered :: () -> bool #foreign clay "Clay_Hovered";
|
||||
OnHover :: (onHoverFunction: #type (elementId: ElementId, pointerData: PointerData, userData: s64) -> void #c_call, userData: s64) -> void #foreign clay "Clay_OnHover";
|
||||
PointerOver :: (elementId: ElementId) -> bool #foreign clay "Clay_PointerOver";
|
||||
GetScrollContainerData :: (id: ElementId) -> ScrollContainerData #foreign clay "Clay_GetScrollContainerData";
|
||||
SetMeasureTextFunction :: (measureTextFunction: #type (text: *String, config: *TextElementConfig) -> Dimensions #c_call) -> void #foreign clay "Clay_SetMeasureTextFunction";
|
||||
SetQueryScrollOffsetFunction :: (queryScrollOffsetFunction: #type (elementId: u32) -> Vector2 #c_call) -> void #foreign clay "Clay_SetQueryScrollOffsetFunction";
|
||||
RenderCommandArray_Get :: (array: *RenderCommandArray, index: s32) -> *RenderCommand #foreign clay "Clay_RenderCommandArray_Get";
|
||||
SetDebugModeEnabled :: (enabled: bool) -> void #foreign clay "Clay_SetDebugModeEnabled";
|
||||
SetCullingEnabled :: (enabled: bool) -> void #foreign clay "Clay_SetCullingEnabled";
|
||||
SetMaxElementCount :: (maxElementCount: u32) -> void #foreign clay "Clay_SetMaxElementCount";
|
||||
SetMaxMeasureTextCacheWordCount :: (maxMeasureTextCacheWordCount: u32) -> void #foreign clay "Clay_SetMaxMeasureTextCacheWordCount";
|
||||
|
||||
// Internal API functions required by macros
|
||||
OpenElement :: (__args: ..Any) -> void #foreign clay "Clay__OpenElement";
|
||||
CloseElement :: (__args: ..Any) -> void #foreign clay "Clay__CloseElement";
|
||||
OpenElement :: () -> void #foreign clay "Clay__OpenElement";
|
||||
CloseElement :: () -> void #foreign clay "Clay__CloseElement";
|
||||
StoreLayoutConfig :: (config: LayoutConfig) -> *LayoutConfig #foreign clay "Clay__StoreLayoutConfig";
|
||||
ElementPostConfiguration :: (__args: ..Any) -> void #foreign clay "Clay__ElementPostConfiguration";
|
||||
ElementPostConfiguration :: () -> void #foreign clay "Clay__ElementPostConfiguration";
|
||||
AttachId :: (id: ElementId) -> void #foreign clay "Clay__AttachId";
|
||||
AttachLayoutConfig :: (config: *LayoutConfig) -> void #foreign clay "Clay__AttachLayoutConfig";
|
||||
AttachElementConfig :: (config: ElementConfigUnion, type: ElementConfigType) -> void #foreign clay "Clay__AttachElementConfig";
|
||||
@ -374,12 +405,11 @@ StoreCustomElementConfig :: (config: CustomElementConfig) -> *CustomElementConfi
|
||||
StoreScrollElementConfig :: (config: ScrollElementConfig) -> *ScrollElementConfig #foreign clay "Clay__StoreScrollElementConfig";
|
||||
StoreBorderElementConfig :: (config: BorderElementConfig) -> *BorderElementConfig #foreign clay "Clay__StoreBorderElementConfig";
|
||||
HashString :: (key: String, offset: u32, seed: u32) -> ElementId #foreign clay "Clay__HashString";
|
||||
Noop :: (__args: ..Any) -> void #foreign clay "Clay__Noop";
|
||||
Noop :: () -> void #foreign clay "Clay__Noop";
|
||||
OpenTextElement :: (text: String, textConfig: *TextElementConfig) -> void #foreign clay "Clay__OpenTextElement";
|
||||
|
||||
Clay__debugViewHighlightColor: Color #elsewhere clay;
|
||||
Clay__debugViewWidth: u32 #elsewhere clay;
|
||||
Clay__debugMaxElementsLatch: bool #elsewhere clay;
|
||||
|
||||
#scope_file
|
||||
|
||||
@ -410,15 +440,13 @@ clay :: #library,no_dll "clay-jai/windows/clay";
|
||||
|
||||
{
|
||||
instance: Arena;
|
||||
assert(((cast(*void)(*instance.label)) - cast(*void)(*instance)) == 0, "Arena.label has unexpected offset % instead of 0", ((cast(*void)(*instance.label)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Arena.label)) == 16, "Arena.label has unexpected size % instead of 16", size_of(type_of(Arena.label)));
|
||||
assert(((cast(*void)(*instance.nextAllocation)) - cast(*void)(*instance)) == 16, "Arena.nextAllocation has unexpected offset % instead of 16", ((cast(*void)(*instance.nextAllocation)) - cast(*void)(*instance)));
|
||||
assert(((cast(*void)(*instance.nextAllocation)) - cast(*void)(*instance)) == 0, "Arena.nextAllocation has unexpected offset % instead of 0", ((cast(*void)(*instance.nextAllocation)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Arena.nextAllocation)) == 8, "Arena.nextAllocation has unexpected size % instead of 8", size_of(type_of(Arena.nextAllocation)));
|
||||
assert(((cast(*void)(*instance.capacity)) - cast(*void)(*instance)) == 24, "Arena.capacity has unexpected offset % instead of 24", ((cast(*void)(*instance.capacity)) - cast(*void)(*instance)));
|
||||
assert(((cast(*void)(*instance.capacity)) - cast(*void)(*instance)) == 8, "Arena.capacity has unexpected offset % instead of 8", ((cast(*void)(*instance.capacity)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Arena.capacity)) == 8, "Arena.capacity has unexpected size % instead of 8", size_of(type_of(Arena.capacity)));
|
||||
assert(((cast(*void)(*instance.memory)) - cast(*void)(*instance)) == 32, "Arena.memory has unexpected offset % instead of 32", ((cast(*void)(*instance.memory)) - cast(*void)(*instance)));
|
||||
assert(((cast(*void)(*instance.memory)) - cast(*void)(*instance)) == 16, "Arena.memory has unexpected offset % instead of 16", ((cast(*void)(*instance.memory)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(Arena.memory)) == 8, "Arena.memory has unexpected size % instead of 8", size_of(type_of(Arena.memory)));
|
||||
assert(size_of(Arena) == 40, "Arena has size % instead of 40", size_of(Arena));
|
||||
assert(size_of(Arena) == 24, "Arena has size % instead of 24", size_of(Arena));
|
||||
}
|
||||
|
||||
{
|
||||
@ -489,6 +517,8 @@ clay :: #library,no_dll "clay-jai/windows/clay";
|
||||
|
||||
{
|
||||
instance: SizingAxis;
|
||||
assert(((cast(*void)(*instance.size)) - cast(*void)(*instance)) == 0, "SizingAxis.size has unexpected offset % instead of 0", ((cast(*void)(*instance.size)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(SizingAxis.size)) == 8, "SizingAxis.size has unexpected size % instead of 8", size_of(type_of(SizingAxis.size)));
|
||||
assert(((cast(*void)(*instance.type)) - cast(*void)(*instance)) == 8, "SizingAxis.type has unexpected offset % instead of 8", ((cast(*void)(*instance.type)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(SizingAxis.type)) == 4, "SizingAxis.type has unexpected size % instead of 4", size_of(type_of(SizingAxis.type)));
|
||||
assert(size_of(SizingAxis) == 12, "SizingAxis has size % instead of 12", size_of(SizingAxis));
|
||||
@ -707,5 +737,25 @@ clay :: #library,no_dll "clay-jai/windows/clay";
|
||||
assert(size_of(type_of(PointerData.state)) == 4, "PointerData.state has unexpected size % instead of 4", size_of(type_of(PointerData.state)));
|
||||
assert(size_of(PointerData) == 12, "PointerData has size % instead of 12", size_of(PointerData));
|
||||
}
|
||||
|
||||
{
|
||||
instance: ErrorData;
|
||||
assert(((cast(*void)(*instance.errorType)) - cast(*void)(*instance)) == 0, "ErrorData.errorType has unexpected offset % instead of 0", ((cast(*void)(*instance.errorType)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(ErrorData.errorType)) == 4, "ErrorData.errorType has unexpected size % instead of 4", size_of(type_of(ErrorData.errorType)));
|
||||
assert(((cast(*void)(*instance.errorText)) - cast(*void)(*instance)) == 8, "ErrorData.errorText has unexpected offset % instead of 8", ((cast(*void)(*instance.errorText)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(ErrorData.errorText)) == 16, "ErrorData.errorText has unexpected size % instead of 16", size_of(type_of(ErrorData.errorText)));
|
||||
assert(((cast(*void)(*instance.userData)) - cast(*void)(*instance)) == 24, "ErrorData.userData has unexpected offset % instead of 24", ((cast(*void)(*instance.userData)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(ErrorData.userData)) == 8, "ErrorData.userData has unexpected size % instead of 8", size_of(type_of(ErrorData.userData)));
|
||||
assert(size_of(ErrorData) == 32, "ErrorData has size % instead of 32", size_of(ErrorData));
|
||||
}
|
||||
|
||||
{
|
||||
instance: ErrorHandler;
|
||||
assert(((cast(*void)(*instance.errorHandlerFunction)) - cast(*void)(*instance)) == 0, "ErrorHandler.errorHandlerFunction has unexpected offset % instead of 0", ((cast(*void)(*instance.errorHandlerFunction)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(ErrorHandler.errorHandlerFunction)) == 8, "ErrorHandler.errorHandlerFunction has unexpected size % instead of 8", size_of(type_of(ErrorHandler.errorHandlerFunction)));
|
||||
assert(((cast(*void)(*instance.userData)) - cast(*void)(*instance)) == 8, "ErrorHandler.userData has unexpected offset % instead of 8", ((cast(*void)(*instance.userData)) - cast(*void)(*instance)));
|
||||
assert(size_of(type_of(ErrorHandler.userData)) == 8, "ErrorHandler.userData has unexpected size % instead of 8", size_of(type_of(ErrorHandler.userData)));
|
||||
assert(size_of(ErrorHandler) == 16, "ErrorHandler has size % instead of 16", size_of(ErrorHandler));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user