### Start Application Source: https://kha.tech/api/kha/System Initializes and starts the application with specified options and a callback function that receives a `Window` object. This is the primary method for launching the application lifecycle. ```kha staticstart(options:SystemOptions, callback:Window ‑> Void):Void ``` -------------------------------- ### Start Schedule Source: https://kha.tech/api/kha/Scheduler Starts the schedule system. Optionally, it can restart timers if 'restartTimers' is set to true. ```haxe staticstart(restartTimers:Bool = false):Void ``` -------------------------------- ### Netsync Example Entity - Kha.netsync Source: https://kha.tech/api/kha/netsync/Example Demonstrates the 'Example' entity class within the 'kha.netsync' package. This class implements the 'Entity' interface and utilizes 'EntityBuilder' for automatic build processes and ID generation. It includes a constructor and a method to retrieve the entity's ID. ```Haxe class Example implements Entity { @:build(kha.netsync.EntityBuilder.build()) @:autoBuild(kha.netsync.EntityBuilder.build()) public function new() { } @:value(kha.netsync.EntityBuilder.nextId++) private var __id:Int = kha.netsync.EntityBuilder.nextId++; public function _id():Int { return __id; } } ``` -------------------------------- ### Get Real Time Source: https://kha.tech/api/kha/Scheduler Returns the amount of time in fractional seconds that has elapsed since the game started. This value is optimized for achieving smooth framerates. ```haxe staticrealTime():Float ``` -------------------------------- ### System.start Initialization Source: https://kha.tech/api/kha/SystemOptions This endpoint details the parameters used to initialize the Kha system, controlling aspects like the application title, window size, and optional configurations for audio and framebuffers. ```APIDOC ## System.start Initialization ### Description Initializes the Kha application with specified parameters for title, dimensions, and optional system configurations. ### Method N/A (Constructor/Initialization function) ### Endpoint N/A (Internal initialization) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **title** (String) - Optional - The application title, used as the default window title and for save data locations. - **width** (Int) - Optional - A shortcut to overwrite `window.width`. - **height** (Int) - Optional - A shortcut to overwrite `window.height`. - **window** (WindowOptions) - Optional - Provides options for the application window. - **framebuffer** (FramebufferOptions) - Optional - Provides options for the framebuffer. - **audio** (AudioOptions) - Optional - Provides options for the audio system. ### Request Example ```json { "title": "My Awesome Game", "width": 1280, "height": 720, "window": { "title": "My Game Window" }, "audio": { "channels": 2 } } ``` ### Response #### Success Response (N/A) N/A (This is an initialization function, not a request/response API) #### Response Example N/A ``` -------------------------------- ### Shader Constant and Texture Setup Source: https://kha.tech/api/kha/graphics1/Graphics4 Functions for setting various types of constants to shaders and configuring textures. ```APIDOC ## setBool(location:ConstantLocation, value:Bool):Void ### Description Sets a boolean constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setBool(myBoolLocation, true) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setComputeShader(shader:ComputeShader):Void ### Description Sets the compute shader to be used for computation. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setComputeShader(myComputeShader) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setCubeMap(stage:TextureUnit, cubeMap:CubeMap):Void ### Description Binds a cubemap texture to a specific texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setCubeMap(TextureUnit.UNIT0, myCubeMap) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setCubeMapCompareMode(texunit:TextureUnit, enabled:Bool):Void ### Description Enables or disables the compare mode for a cubemap texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setCubeMapCompareMode(TextureUnit.UNIT1, true) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setCubeMapDepth(stage:TextureUnit, cubeMap:CubeMap):Void ### Description Binds a cubemap texture for depth comparison to a specific texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setCubeMapDepth(TextureUnit.UNIT2, myDepthCubeMap) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloat(location:ConstantLocation, value:FastFloat):Void ### Description Sets a float constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setFloat(myFloatLocation, 3.14) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloat2(location:ConstantLocation, value1:FastFloat, value2:FastFloat):Void ### Description Sets a 2D float vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setFloat2(myFloat2Location, 1.0, 2.0) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloat3(location:ConstantLocation, value1:FastFloat, value2:FastFloat, value3:FastFloat):Void ### Description Sets a 3D float vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setFloat3(myFloat3Location, 1.0, 2.0, 3.0) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloat4(location:ConstantLocation, value1:FastFloat, value2:FastFloat, value3:FastFloat, value4:FastFloat):Void ### Description Sets a 4D float vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setFloat4(myFloat4Location, 1.0, 2.0, 3.0, 4.0) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloat4s(location:ConstantLocation, float4s:Float32Array):Void ### Description Sets an array of 4D float vectors (float4s) to a shader constant. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` let data = new Float32Array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]) setFloat4s(myFloat4ArrayLocation, data) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setFloats(location:ConstantLocation, floats:Float32Array):Void ### Description Sets an array of floats to a shader constant. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` let data = new Float32Array([1.0, 2.0, 3.0]) setFloats(myFloatArrayLocation, data) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setImageTexture(unit:TextureUnit, texture:Image):Void ### Description Binds an image texture to a specific texture unit for image load/store operations. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```setImageTexture(TextureUnit.UNIT3, myImageTexture) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setIndexBuffer(indexBuffer:IndexBuffer):Void ### Description Binds an index buffer for indexed rendering. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setIndexBuffer(myIndexBuffer) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setInt(location:ConstantLocation, value:Int):Void ### Description Sets an integer constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setInt(myIntLocation, 42) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setInt2(location:ConstantLocation, value1:Int, value2:Int):Void ### Description Sets a 2D integer vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setInt2(myInt2Location, 10, 20) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setInt3(location:ConstantLocation, value1:Int, value2:Int, value3:Int):Void ### Description Sets a 3D integer vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setInt3(myInt3Location, 10, 20, 30) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setInt4(location:ConstantLocation, value1:Int, value2:Int, value3:Int, value4:Int):Void ### Description Sets a 4D integer vector constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setInt4(myInt4Location, 10, 20, 30, 40) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setInts(location:ConstantLocation, ints:Int32Array):Void ### Description Sets an array of integers to a shader constant. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` let data = new Int32Array([1, 2, 3]) setInts(myIntArrayLocation, data) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setMatrix(location:ConstantLocation, value:FastMatrix4):Void ### Description Sets a 4x4 matrix constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setMatrix(myMatrix4Location, myMatrix4) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setMatrix3(location:ConstantLocation, value:FastMatrix3):Void ### Description Sets a 3x3 matrix constant in a shader. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setMatrix3(myMatrix3Location, myMatrix3) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setPipeline(pipeline:PipelineState):Void ### Description Sets the graphics pipeline state. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setPipeline(myPipelineState) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setShaderStorageBuffer(buffer:ShaderStorageBuffer, index:Int):Void ### Description Binds a shader storage buffer to a specific binding point. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setShaderStorageBuffer(myStorageBuffer, 0) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setStencilReferenceValue(value:Int):Void ### Description Sets the reference value for the stencil test. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setStencilReferenceValue(128) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setTexture(unit:TextureUnit, texture:Image):Void ### Description Binds a 2D texture to a specific texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setTexture(TextureUnit.UNIT4, myTexture) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setTexture3DParameters(texunit:TextureUnit, uAddressing:TextureAddressing, vAddressing:TextureAddressing, wAddressing:TextureAddressing, minificationFilter:TextureFilter, magnificationFilter:TextureFilter, mipmapFilter:MipMapFilter):Void ### Description Sets texture parameters for a 3D texture unit, including addressing modes and filtering. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setTexture3DParameters(TextureUnit.UNIT5, TextureAddressing.CLAMP, TextureAddressing.CLAMP, TextureAddressing.CLAMP, TextureFilter.LINEAR, TextureFilter.LINEAR, MipMapFilter.NONE) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setTextureArray(unit:TextureUnit, texture:Image):Void ### Description Binds a texture array to a specific texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setTextureArray(TextureUnit.UNIT6, myTextureArray) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setTextureCompareMode(texunit:TextureUnit, enabled:Bool):Void ### Description Enables or disables the compare mode for a 2D texture unit. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` setTextureCompareMode(TextureUnit.UNIT7, false) ``` ### Response #### Success Response (Void) This function does not return a value. #### Response Example N/A ``` ```APIDOC ## setTextureDepth(unit:TextureUnit, texture:Image):Void ### Description Binds a depth texture to a specific texture unit. ### Method N/A (Function Call ``` -------------------------------- ### Kha System.start Parameters Configuration Source: https://kha.tech/api/kha/SystemOptions Defines the parameters for initializing the Kha application's system. This includes setting the application title, default window dimensions, and optional configurations for the window, framebuffer, and audio subsystems. These parameters are passed to the System.start function. ```kha @:value({ height : -1, width : -1, title : "Kha" })new(title:String = "Kha", width:Int = -1, height:Int = -1, ?window:WindowOptions, ?framebuffer:FramebufferOptions, ?audio:AudioOptions) ``` -------------------------------- ### Create Touch Event Listeners (Swift) Source: https://kha.tech/api/kha/input/Surface Creates event handlers from passed functions for touch start, touch end, and movement. Optional listeners can be provided, each with specific parameters for finger ID, and X/Y coordinates. ```swift notify(?touchStartListener:(id:Int, x:Int, y:Int) -> Void, ?touchEndListener:(id:Int, x:Int, y:Int) -> Void, ?moveListener:(id:Int, x:Int, y:Int) -> Void):Void ``` -------------------------------- ### Kha System Default Variables Source: https://kha.tech/api/kha/SystemOptions Shows the default values for various system-related variables in the Kha API. These include audio options, framebuffer options, height, title, width, and window options, all initialized to null or default values. ```kha @:value(null)audio:AudioOptions = null @:value(null)framebuffer:FramebufferOptions = null @:value(-1)height:Int = -1 @:value("Kha")title:String = "Kha" @:value(-1)width:Int = -1 @:value(null)window:WindowOptions = null ``` -------------------------------- ### Graphics4 Begin Rendering Source: https://kha.tech/api/kha/graphics1/Graphics4 Initiates rendering for the Graphics4 API. It can optionally accept additional render targets. This method is crucial for starting a new frame or rendering pass. ```haxe class Graphics4 implements Graphics { // ... @:value({ additionalRenderTargets : null }) begin(?additionalRenderTargets:Array):Void; // ... } ``` -------------------------------- ### Draw Instanced Vertices with Kha Tech API Source: https://kha.tech/api/kha/graphics5_/CommandList Draws indexed vertices with instancing support. Allows specifying the instance count, starting index, and the number of vertices to draw. The `count` parameter defaults to -1, indicating all available vertices. ```kha_tech_api drawIndexedVerticesInstanced(instanceCount:Int, start:Int = 0, count:Int = -1):Void ``` -------------------------------- ### System Initialization: Init with Options Source: https://kha.tech/api/kha/SystemImpl Initializes the system with specified options and a callback function for window events. Requires SystemOptions and a window event handler. ```haxe System.init(options, callback) ``` -------------------------------- ### System Initialization API Source: https://kha.tech/api/kha/SystemImpl Initializes the system with specified options and a callback function for window events. ```APIDOC ## POST /websites/kha_tech_api/init ### Description Initializes the system with specified options and a callback function for window events. ### Method POST ### Endpoint /websites/kha_tech_api/init ### Parameters #### Request Body - **options** (SystemOptions) - Required - System initialization options. - **callback** (Window -> Void) - Required - Callback function for window events. ### Request Example ```json { "options": { "title": "My Game", "width": 800, "height": 600 }, "callback": "function(window) { console.log('Window created'); }" } ``` ### Response #### Success Response (200) - **status** (Void) - Indicates successful initialization. #### Response Example ```json { "status": "initialized" } ``` ``` -------------------------------- ### Graphics Interface Source: https://kha.tech/api/kha/graphics4/Graphics Defines the base Graphics interface with methods for starting and clearing rendering operations. ```APIDOC ## Graphics Interface (`kha.graphics4.Graphics`) ### Description This interface defines the fundamental methods for graphics rendering operations, including starting and clearing render targets. ### Methods - **`begin(?additionalRenderTargets:Array):Void`**: Starts rendering to the default render target, optionally with additional render targets. - **`beginEye(eye:Int):Void`**: Starts rendering for a specific eye (e.g., in VR). - **`beginFace(face:Int):Void`**: Starts rendering for a specific face of a cubemap. - **`clear(?color:Color, ?depth:Float, ?stencil:Int):Void`**: Clears the current render target with specified color, depth, and stencil values. ``` -------------------------------- ### Get Number of Tasks in Schedule Source: https://kha.tech/api/kha/Scheduler Returns the total number of tasks currently present in the schedule. ```haxe staticnumTasksInSchedule():Int ``` -------------------------------- ### ByteArray.staticinlinesubarray Source: https://kha.tech/api/kha/arrays/Int32Array Creates a new Int32Array containing a subarray of the ByteArray. The subarray is defined by the start and optional end indices. ```APIDOC ## ByteArray.staticinlinesubarray ### Description Creates a new Int32Array containing a subarray of the ByteArray. The subarray is defined by the start and optional end indices. ### Method STATIC ### Endpoint N/A (Static method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin val byteArray = ByteArray(10) { it.toByte() } val subArray = ByteArray.staticinlinesubarray(byteArray, 2, 5) ``` ### Response #### Success Response (Int32Array) - **Int32Array** - A new Int32Array containing the specified subarray. #### Response Example ```json [2, 3, 4, 5] ``` ``` -------------------------------- ### System Information: Get Language Source: https://kha.tech/api/kha/SystemImpl Retrieves the current system language as a string. This method does not require any parameters. ```haxe System.getLanguage() ``` -------------------------------- ### Server Class - kha.netsync Source: https://kha.tech/api/kha/netsync/Server Documentation for the Server class in the kha.netsync module, including its constructor and methods for managing network connections. ```APIDOC ## Server Class - kha.netsync ### Description Provides functionality for creating and managing a network server to handle client connections. ### Method `new(port:Int)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Constructor `new(port:Int)` Initializes a new Server instance listening on the specified port. ### Methods #### `onConnection(connection:Client -> Void):Void` Registers a callback function to be executed when a new client connection is established. #### `reset():Void` Resets the server, closing all active connections and preparing it for new connections. ``` -------------------------------- ### kha.vr.VrInterfaceEmulated Source: https://kha.tech/api/kha/vr/VrInterfaceEmulated Documentation for the VrInterfaceEmulated class in the kha.vr module, which extends VrInterface. ```APIDOC ## class VrInterfaceEmulated #### package kha.vr #### extends VrInterface ### Constructor ### `new()` ### Variables ### `framebuffer:Framebuffer` ### Methods ### Inherited Variables ### Inherited Methods #### __Defined by VrInterface ### `GetProjectionMatrix(eye:Int):FastMatrix4` ### `GetViewMatrix(eye:Int):FastMatrix4` ``` -------------------------------- ### Get Approximate Time Source: https://kha.tech/api/kha/Scheduler Returns an approximation of the elapsed time in fractional seconds while the game was active. This value is optimized for smooth framerates. ```haxe statictime():Float ``` -------------------------------- ### SystemImpl Methods - Kha API Source: https://kha.tech/api/kha/SystemImpl Provides static methods for managing system-level functionalities within the Kha framework. These include controlling user input for display changes, checking for safe zone availability, and managing mouse locking and fullscreen capabilities. It also allows for changing screen resolution. ```Haxe class SystemImpl { @:directlyUsed public static function allowUserChange():Void; public static function automaticSafeZone():Bool; public static function canLockMouse():Bool; public static function canSwitchFullscreen():Bool; public static function changeResolution(width:Int, height:Int):Void; public static function disallowUserChange():Void; } ``` -------------------------------- ### Initialize Schedule Source: https://kha.tech/api/kha/Scheduler Initializes the schedule system. This function should be called before any tasks are added or executed. ```haxe staticinit():Void ``` -------------------------------- ### Input Device: Get Mouse Source: https://kha.tech/api/kha/SystemImpl Retrieves a Mouse object for a given number. This allows interaction with mouse input. ```haxe System.getMouse(num) ``` -------------------------------- ### Input Device: Get Keyboard Source: https://kha.tech/api/kha/SystemImpl Retrieves a Keyboard object for a given number. This allows interaction with keyboard input. ```haxe System.getKeyboard(num) ``` -------------------------------- ### SystemImpl API Source: https://kha.tech/api/kha/SystemImpl Provides methods for managing system-level functionalities such as screen resolution, fullscreen mode, and mouse locking. ```APIDOC ## SystemImpl API ### Description Provides methods for managing system-level functionalities such as screen resolution, fullscreen mode, and mouse locking. ### Method Various (static methods) ### Endpoint N/A (Class methods) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A ## Static methods for SystemImpl ### `allowUserChange():Void` Allows the user to change display settings. ### `automaticSafeZone():Bool` Checks if the automatic safe zone is enabled. ### `canLockMouse():Bool` Checks if the mouse can be locked. ### `canSwitchFullscreen():Bool` Checks if the application can switch to fullscreen mode. ### `changeResolution(width:Int, height:Int):Void` Changes the screen resolution to the specified width and height. ### `disallowUserChange():Void` Disallows the user from changing display settings. ``` -------------------------------- ### OldSystemOptions Source: https://kha.tech/api/kha/OldSystemOptions Defines options for configuring system-level settings, such as window mode, dimensions, VSync, title, and anti-aliasing samples. ```APIDOC ## OldSystemOptions ### Description Defines options for configuring system-level settings, such as window mode, dimensions, VSync, title, and anti-aliasing samples. ### Method N/A (Type Definition) ### Endpoint N/A (Type Definition) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Fields - **windowMode** (Null) - Optional: Specifies the window mode (e.g., fullscreen, windowed). - **width** (Null) - Optional: The width of the window. - **vSync** (Null) - Optional: Enables or disables vertical synchronization. - **title** (Null) - Optional: The title of the window. - **samplesPerPixel** (Null) - Optional: The number of samples per pixel for anti-aliasing. ``` -------------------------------- ### Screen Properties: Get Screen DPI Source: https://kha.tech/api/kha/SystemImpl Retrieves the Dots Per Inch (DPI) of the screen. Returns an integer value. ```haxe System.screenDpi() ``` -------------------------------- ### Window API Source: https://kha.tech/api/kha/Window Documentation for the Window class in the Kha API, including methods for creating, destroying, and accessing windows. ```APIDOC ## Window API ### Description Provides functionality for managing application windows, including creation, destruction, and retrieval. ### Method N/A (Class documentation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## Static methods ### `static create(?win:WindowOptions, ?frame:FramebufferOptions):Window` Creates a new window with optional window and framebuffer options. ### `static destroy(window:Window):Void` Destroys the specified window. ### `static get(index:Int):Window` Retrieves a window by its index. ## Static variables ### `static all:Array` An array containing all currently active windows. ``` -------------------------------- ### Screen Properties: Get Screen Rotation Source: https://kha.tech/api/kha/SystemImpl Retrieves the current screen rotation state. Returns a ScreenRotation enum value. ```haxe System.getScreenRotation() ``` -------------------------------- ### Input Device: Get Pen Source: https://kha.tech/api/kha/SystemImpl Retrieves a Pen object for a given number. This allows interaction with pen input devices. ```haxe System.getPen(num) ``` -------------------------------- ### System Information: Get VSync Status Source: https://kha.tech/api/kha/SystemImpl Checks if Vertical Synchronization (VSync) is enabled on the system. Returns a boolean value. ```haxe System.getVsync() ``` -------------------------------- ### System Class Documentation - Kha API Source: https://kha.tech/api/kha/System Documentation for the `System` class within the `kha` package. It includes static read-only properties for language and screen rotation. The `refreshRate` property is deprecated and suggests using the `kha.Display` API instead. ```haxe class System { // ... other members /** * The ISO 639 system current language identifier. */ public static var language:String; /** * Deprecated: "Use the kha.Display API instead" */ public static var refreshRate:Int; /** * The current screen rotation. */ public static var screenRotation:ScreenRotation; // ... other members } ``` -------------------------------- ### System Information: Get System ID Source: https://kha.tech/api/kha/SystemImpl Retrieves a unique identifier for the system. This static method returns a string and has no parameters. ```haxe System.getSystemId() ``` -------------------------------- ### Input Module Source: https://kha.tech/api/kha/graphics2/Graphics1 Classes for handling user input from various devices. ```APIDOC ## Input Module Classes ### Description This module provides a comprehensive set of classes for capturing and processing user input from gamepads, keyboards, mice, pens, and sensors. ### Classes - **BlockInterventions** - Manages input blocking behavior. - **Gamepad** - Represents a gamepad device. - **KeyCode** - Enumerates key codes for keyboard input. - **Keyboard** - Represents the keyboard input device. - **Mouse** - Represents the mouse input device. - **MouseCursor** - Manages the mouse cursor. - **MouseEventBlockBehavior** - Defines behavior for blocking mouse events. - **MouseImpl** - Implementation details for mouse input. - **Pen** - Represents a pen input device. - **Sensor** - Represents a sensor device. - **SensorType** - Enumerates types of sensors. - **Surface** - Represents an input surface. - **TouchDownEventBlockBehavior** - Defines behavior for blocking touch down events. ``` -------------------------------- ### Get Image Pixel Color Source: https://kha.tech/api/kha/Image Retrieves the color of a specific pixel at given x and y coordinates. Requires the image to be readable. ```Haxe at(x:Int, y:Int):Color ``` -------------------------------- ### NetSync Module Source: https://kha.tech/api/kha/graphics2/Graphics1 Classes for network synchronization of game state and entities. ```APIDOC ## NetSync Module Classes ### Description This module provides classes for implementing network synchronization in games, allowing clients and servers to maintain a consistent game state. ### Classes - **Client** - Represents a network client. - **Controller** - Base class for network controllers. - **ControllerBuilder** - Utility for building controllers. - **Entity** - Represents a network-synchronized entity. - **EntityBuilder** - Utility for building entities. - **Example** - An example class for network synchronization. - **LocalClient** - Represents a local client. - **Network** - Provides network-related functionalities. - **NodeProcessClient** - A client process node. - **Server** - Represents a network server. - **Session** - Represents a network session. - **State** - Represents the network state. - **Sync** - Base class for synchronization. - **SyncBuilder** - Utility for building synchronization. - **UdpClient** - A UDP client. - **WebSocketClient** - A WebSocket client. ``` -------------------------------- ### Graphics5 Interface Source: https://kha.tech/api/kha/graphics5_/Graphics The Graphics interface in kha.graphics5_ provides methods for managing graphics rendering operations, including starting and ending rendering to a target, and swapping buffers. ```APIDOC ## Graphics5 Interface ### Description Provides methods for managing graphics rendering operations. ### Methods #### `begin(target:RenderTarget):Void` Starts rendering to the specified render target. #### `end():Void` Ends the current rendering operation. #### `swapBuffers():Void` Swaps the front and back buffers to display the rendered content. ``` -------------------------------- ### Color Creation Methods Source: https://kha.tech/api/kha/Color This section details the static methods available for creating new Color objects with various input formats. ```APIDOC ## Static Methods for Color Creation ### `static fromBytes(r: Int, g: Int, b: Int, a: Int = 255): Color` Creates a new Color object from components in the range 0 - 255. ### `static fromFloats(r: FastFloat, g: FastFloat, b: FastFloat, a: FastFloat = 1): Color` Creates a new Color object from components in the range 0 - 1. ### `static fromString(value: String): Color` Creates a new Color object from an HTML style `#AARRGGBB` / `#RRGGBB` / `#RGB` strings. ### `static inline fromValue(value: Int): Color` Creates a new Color object from a packed 32 bit ARGB value. ``` -------------------------------- ### Get Glyph Box Information Source: https://kha.tech/api/kha/graphics2/truetype/StbTruetype Retrieve the bounding box for a given glyph. This is useful for layout calculations and determining character dimensions. ```kha staticstbtt_GetGlyphBox(info:Stbtt_fontinfo, glyph_index:Int, rect:Stbtt_temp_rect):Bool ``` -------------------------------- ### kha.input Module Source: https://kha.tech/api/kha/Canvas This section details the classes and enumerations available in the kha.input module, related to handling user input from various devices. ```APIDOC ## kha.input Module ### Description Classes and enumerations for handling user input from gamepads, keyboards, mice, and sensors. ### Classes - BlockInterventions - Gamepad - KeyCode - Keyboard - Mouse - MouseCursor - MouseEventBlockBehavior - MouseImpl - Pen - Sensor - SensorType - Surface - TouchDownEventBlockBehavior ``` -------------------------------- ### Window Management: Get Window Width Source: https://kha.tech/api/kha/SystemImpl Retrieves the width of a window identified by its ID. Takes an integer window ID as input. ```haxe System.windowWidth(id) ``` -------------------------------- ### Window Management: Get Window Height Source: https://kha.tech/api/kha/SystemImpl Retrieves the height of a window identified by its ID. Takes an integer window ID as input. ```haxe System.windowHeight(id) ``` -------------------------------- ### UdpClient Class Source: https://kha.tech/api/kha/netsync/UdpClient Documentation for the UdpClient class within the kha.netsync package, which implements the Client interface. ```APIDOC ## UdpClient Class #### package kha.netsync #### implements Client ### Description Represents a UDP client for network synchronization. ### Variables * `read only controllers: Array` - A list of controllers associated with this client. * `read only id: Int` - The unique identifier for this client. * `@:value(null) onReceive: Bytes -> Void = null` - A callback function that is executed when data is received. ### Methods * `onClose(close: () -> Void): Void` - Registers a callback function to be executed when the client connection is closed. * `receive(receiver: Bytes -> Void): Void` - Sets up a callback function to handle incoming data. * `send(bytes: Bytes, mandatory: Bool): Void` - Sends a byte array over the network. The `mandatory` flag indicates if the send operation is critical. ``` -------------------------------- ### Canvas Initialization Source: https://kha.tech/api/kha/graphics4/Graphics2 Constructor for initializing a new Canvas object. ```APIDOC ## Constructor ### `new(canvas:Canvas)` Initializes a new Canvas object. ### Method `constructor` ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "canvas": "Canvas object" } ``` ### Response #### Success Response (200) - **instance** (Canvas) - The newly created Canvas instance. #### Response Example ```json { "instance": "Canvas object" } ``` ``` -------------------------------- ### Input Device: Get Gamepad ID Source: https://kha.tech/api/kha/SystemImpl Retrieves the unique identifier for a gamepad at a given index. Takes an integer index as input. ```haxe System.getGamepadId(index) ``` -------------------------------- ### kha.netsync Source: https://kha.tech/api/kha/math/FastMatrix3 Networking synchronization utilities. ```APIDOC ## kha.netsync ### Description This module offers classes for network synchronization, including client-server architecture, entity management, and state synchronization. ### Classes - Client - Controller - ControllerBuilder - Entity - EntityBuilder - Example - LocalClient - Network - NodeProcessClient - Server - Session - State - Sync - SyncBuilder - UdpClient - WebSocketClient ``` -------------------------------- ### System Information: Get Time Source: https://kha.tech/api/kha/SystemImpl Returns the current system time as a floating-point number. This static method is useful for timing operations. ```haxe System.getTime() ``` -------------------------------- ### Get Mouse Instance Source: https://kha.tech/api/kha/input/Mouse Retrieves the current mouse instance, optionally by its ID. This is useful for accessing mouse-related properties and methods. ```haxe Mouse.get(num:Int = 0):Mouse ``` -------------------------------- ### Execute and Wait for Rendering Commands in Kha Tech API Source: https://kha.tech/api/kha/graphics5_/CommandList Executes the queued rendering commands and waits for their completion. This can be useful for synchronization purposes. ```kha_tech_api executeAndWait():Void ``` -------------------------------- ### FragmentShader API Source: https://kha.tech/api/kha/graphics4/FragmentShader Documentation for the FragmentShader class in kha.graphics4, including its constructor, static methods, variables, and instance methods. ```APIDOC ## FragmentShader API ### Description Provides functionality for creating and managing fragment shaders in Kha. ### Method `FragmentShader` ### Endpoint N/A (Class documentation) ### Parameters #### Constructor - **sources** (Array) - Required - An array of shader source code blobs. - **files** (Array) - Required - An array of file paths corresponding to the shader sources. #### Static Methods - **fromSource** (source:String):FragmentShader - Required - Creates a FragmentShader from a source string. ### Variables - **files** (Array) - The array of file paths associated with the shader. - **shader** (Dynamic) - Internal representation of the shader. - **sources** (Array) - The array of shader source code strings. - **type** (Dynamic) - The type of the shader. ### Methods (No instance methods documented in the provided text) ``` -------------------------------- ### Get Glyph Shape and Vertices Source: https://kha.tech/api/kha/graphics2/truetype/StbTruetype Extract the vector outline data for glyphs and codepoints. This allows for custom rendering or manipulation of character shapes. ```kha staticstbtt_GetCodepointShape(info:Stbtt_fontinfo, unicode_codepoint:Int):Vector staticstbtt_GetGlyphShape(info:Stbtt_fontinfo, glyph_index:Int):Vector staticstbtt__GetGlyphShapeT2(info:Stbtt_fontinfo, glyph_index:Int):Vector staticstbtt__GetGlyphShapeTT(info:Stbtt_fontinfo, glyph_index:Int):Vector ``` -------------------------------- ### Input Device: Get Gamepad Vendor Source: https://kha.tech/api/kha/SystemImpl Retrieves the vendor name of a gamepad at a specified index. Takes an integer index and returns a string. ```haxe System.getGamepadVendor(index) ``` -------------------------------- ### Audio Playback Methods Source: https://kha.tech/api/kha/audio2/ogg/vorbis/Reader This section details the methods available for manipulating and querying audio playback, including cloning, sample/millisecond conversions, and reading audio data. ```APIDOC ## Audio Playback Methods ### Description Provides methods for cloning the audio reader, converting between milliseconds and samples, and reading audio data into an output buffer. ### Methods - **clone()**: Reader - Description: Creates a clone of the current audio reader. - Returns: A new Reader instance. - **inlinemillisecondToSample(millseconds:Float)**: Int - Description: Converts a given time in milliseconds to the corresponding sample count. - Parameters: - **millseconds** (Float) - The time in milliseconds to convert. - Returns: The equivalent sample count. - **inlinesampleToMillisecond(samples:Int)**: Float - Description: Converts a given sample count to the corresponding time in milliseconds. - Parameters: - **samples** (Int) - The sample count to convert. - Returns: The equivalent time in milliseconds. - **read(output:Float32Array, ?samples:Int, ?channels:Int, ?sampleRate:Int, useFloat:Bool = false)**: Int - Description: Reads audio data into the provided output buffer. Allows specifying the number of samples, channels, and sample rate for the read operation. `useFloat` determines if the output should be in float format. - Parameters: - **output** (Float32Array) - The buffer to write the audio data into. - **samples** (Int) - Optional. The number of samples to read. - **channels** (Int) - Optional. The number of audio channels. - **sampleRate** (Int) - Optional. The sample rate of the audio. - **useFloat** (Bool) - Optional. Defaults to false. If true, reads data as floats. - Returns: The number of samples actually read. ``` -------------------------------- ### Rendering Utility Functions Source: https://kha.tech/api/kha/graphics4/Graphics Provides utility functions for rendering, such as flushing the rendering pipeline, checking for instanced rendering support, and querying hardware capabilities like the maximum number of bound textures. These functions offer insights into the rendering system's state and capabilities. ```kha flush():Void instancedRenderingAvailable():Bool maxBoundTextures():Int refreshRate():Int vsynced():Bool end():Void ``` -------------------------------- ### Get Render Targets Inverted Y Status Source: https://kha.tech/api/kha/Image Checks if render targets are created with inverted Y coordinates. This is a boolean flag that affects how coordinates are interpreted. ```Haxe static renderTargetsInvertedY():Bool ``` -------------------------------- ### VorbisDecodeState Variables - kha.audio2.ogg.vorbis Source: https://kha.tech/api/kha/audio2/ogg/vorbis/VorbisDecodeState Represents the state of a Vorbis decoder, including the number of bytes in a segment and the start and end indices for channel buffers. ```Haxe @:value(0)bytesInSeg:Int = 0 channelBufferEnd:Int channelBufferStart:Int ``` -------------------------------- ### kha.netsync.Client API Source: https://kha.tech/api/kha/netsync/Client Documentation for the Client interface in the kha.netsync module. This interface is extended by various client implementations for network synchronization. ```APIDOC ## kha.netsync.Client ### Description Represents a client in the network synchronization system. This interface is extended by specific client implementations like LocalClient, NodeProcessClient, UdpClient, and WebSocketClient. ### Method `Client` ### Variables - `id` (Int) - Read-only identifier for the client. ### Methods - `onClose(close:() -> Void):Void` Registers a callback function to be executed when the client connection is closed. - `receive(receiver:Bytes -> Void):Void` Sets up a callback function to handle incoming data (Bytes). - `send(bytes:Bytes, mandatory:Bool):Void` Sends a Bytes object over the network. The `mandatory` flag indicates if the send operation is critical. ``` -------------------------------- ### System Interaction: Login Source: https://kha.tech/api/kha/SystemImpl Initiates a login process. This static method does not take parameters and its behavior may be platform-dependent. ```haxe System.login() ``` -------------------------------- ### Screen Properties: Get Safe Zone Source: https://kha.tech/api/kha/SystemImpl Retrieves the value of the screen's safe zone. This is often used for handling notches or cutouts on displays. ```haxe System.safeZone() ``` -------------------------------- ### Get Euler Angles Source: https://kha.tech/api/kha/math/Quaternion Converts the Quaternion to Euler angles (Vector3). It allows specifying axes and order for the conversion, with default values for common use cases. ```Haxe getEulerAngles(A1:Int, A2:Int, A3:Int, S:Int = 1, D:Int = 1):Vector3 ```