commit 1e2e7840af5b5cdd538fbd8e4ea2b75d696a3738 Author: Wesley Kerfoot Date: Tue Oct 5 10:28:43 2021 -0400 initial commit diff --git a/compile_raygui.sh b/compile_raygui.sh new file mode 100755 index 0000000..d2b7b84 --- /dev/null +++ b/compile_raygui.sh @@ -0,0 +1 @@ +gcc -shared -fPIC -DRAYGUIDEF -DRAYGUI_IMPLEMENTATION -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 raygui.h -o raygui.so diff --git a/lsystem.nimble b/lsystem.nimble new file mode 100644 index 0000000..513f5e6 --- /dev/null +++ b/lsystem.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.1.0" +author = "Wesley Kerfoot" +description = "A new awesome nimble package" +license = "MIT" +srcDir = "src" +bin = @["lsystem"] + + +# Dependencies + +requires "nim >= 1.4.8" diff --git a/raygui.so b/raygui.so new file mode 100755 index 0000000..71f39d4 Binary files /dev/null and b/raygui.so differ diff --git a/src/lsystem.nim b/src/lsystem.nim new file mode 100644 index 0000000..033f7fd --- /dev/null +++ b/src/lsystem.nim @@ -0,0 +1,202 @@ +import lsystempkg/raylib, lsystempkg/raygui +import math, os +import algorithm, heapqueue, random, options, sequtils, sugar, tables, system + +# Seed RNG with current time +randomize() + +type Term = enum LeafTerm, LineTerm, GoLeft, GoRight, PushTerm, PopTerm +type Terms = seq[Term] + +iterator rewrite(terms: Terms) : Terms = + var currentTerms: Terms = terms + var newTerms: Terms + + while true: + # Reset this each iteration to gather new expansions + newTerms = @[] + for term in currentTerms: + case term: + of LeafTerm: newTerms &= @[LineTerm, LineTerm, PushTerm, GoRight, LeafTerm, PopTerm, GoLeft, LeafTerm] + else: newTerms &= @[term] + currentTerms = newTerms + yield currentTerms + +type StackControl = enum Push, Pop + +# An intruction along with a change in angle and magnitude (i.e. a vector) +type DrawInstruction = object + angle_change: float64 + magnitude: float64 + +type + InstructionKind = enum pkDraw, pkStack + Instruction = object + case kind: InstructionKind + of pkDraw: drawInstruction: DrawInstruction + of pkStack: stackInstruction: StackControl + +proc `$` (i: Instruction): string = + case i.kind: + of pkDraw: return "angle_change = " & $i.drawInstruction.angle_change & ", magnitude = " & $i.drawInstruction.magnitude + of pkStack: return "direction = " & $i.stackInstruction + +iterator axiomToInstructions(maxIterations: int) : Instruction = + let axiom = @[LeafTerm] + var n = 0 + var termsToConvert: Terms + for terms in rewrite(axiom): + n += 1 + if n == maxIterations: + termsToConvert = terms + break + + var magnitudes: seq[float64] = @[18.float64, 34.float64, 50.float64] + let magnitude_weights = [3, 6, 1] + let magnitude_cdf = math.cumsummed(magnitude_weights) + + let angles: seq[float64] = @[10 * 1.618, 20 * 1.618, 30 * 1.618] + let angle_weights = [3, 5, 2] + let angle_cdf = math.cumsummed(angle_weights) + + var angle_delta: float64 + var magnitude: float64 + # every time you encounter a push divide, and a pop multiply + # type Term = enum LeafTerm, LineTerm, GoLeft, GoRight, PushTerm, PopTerm + + # axiom + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: 180, magnitude: 180)) + for term in termsToConvert: + angle_delta = sample(angles, angle_cdf) + magnitude = sample(magnitudes, magnitude_cdf) + case term: + of LeafTerm: + magnitude = magnitude / 1.5 + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: angle_delta, magnitude: magnitude)) + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: 0, magnitude: -magnitude)) # hack + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: -(angle_delta*2), magnitude: magnitude)) + of LineTerm: + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: 0, magnitude: magnitude)) # don't change direction + of GoLeft: + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: angle_delta, magnitude: magnitude)) # change direction to left 45 degrees + of GoRight: + yield Instruction(kind: pkDraw, drawInstruction: DrawInstruction(angle_change: -angle_delta, magnitude: magnitude)) # change direction to right 45 degrees + of PushTerm: + yield Instruction(kind: pkStack, stackInstruction: Push) + of PopTerm: + magnitude = magnitude * 1.5 + yield Instruction(kind: pkStack, stackInstruction: Pop) + +# A Position along with its angle +type Position = object + x: float64 + y: float64 + angle: float64 + +proc `$` (p: Position): string = + return "x = " & $p.x & ", " & "y = " & $p.y & ", " & "angle = " & $p.angle + +# Line (along with the angle relative to origin +type DrawLine = object + start_pos: Vector2 + end_pos: Vector2 + angle: float64 + +proc `$` (d: DrawLine): string = + return "start_pos = " & $d.start_pos & ", " & "end_pos = " & $d.end_pos + +proc calculateNextLine(inst: DrawInstruction, pos: Position) : DrawLine = + # Change the angle + let new_angle = inst.angle_change + pos.angle + + # Use the same magnitude as before + let magnitude = inst.magnitude + + # Convert from polar coordinates to cartesian + let new_x = -(magnitude * cos(degToRad(new_angle))) + let new_y = magnitude * sin(degToRad(new_angle)) + + result.start_pos = Vector2(x: pos.x, y: pos.y) + + # Ending position is relative to the starting position, so add the coordinates + result.end_pos = Vector2(x: result.start_pos.x+new_x, y: result.start_pos.y+new_y) + + result.angle = new_angle + +proc executeProgram(instructions: seq[Instruction], positions: seq[Position], current_pos: Position) : seq[DrawLine] = + # each instruction will be followed by a stack control instruction + if instructions.len <= 0: + echo "Returning" + return @[] + + let inst = instructions[0] + + var nextLine: DrawLine + + case inst.kind: + of pkStack: + if inst.stackInstruction == Push: + return executeProgram(instructions[1..^1], current_pos & positions, current_pos) + elif inst.stackInstruction == Pop: + let newCurrent = positions[0] + return executeProgram(instructions[1..^1], positions[1..^1], newCurrent) + else: + return + of pkDraw: + nextLine = calculateNextLine(inst.drawInstruction, current_pos) + let new_position = Position(x: nextLine.end_pos.x, + y: nextLine.end_pos.y, + angle: nextLine.angle) + # leave the stack alone, set the current position however + return @[nextLine] & executeProgram(instructions[1..^1], positions, new_position) + +proc guiLoop*(instructions: seq[Instruction]) = + # TODO get from xlib + var screenWidth: int = 100 + var screenHeight: int = 100 + + SetConfigFlags(ord(ConfigFlags.FLAG_WINDOW_UNDECORATED)) + + InitWindow(screenWidth, screenHeight, "L-Systems") + + let monitor = GetCurrentMonitor() + screenWidth = (monitor.GetMonitorWidth()).int + screenHeight = (monitor.GetMonitorHeight()).int + + SetWindowSize(screenWidth, screenHeight) + SetWindowTitle("L-Systems") + MaximizeWindow() + + #GuiLoadStyle("styles/terminal/terminal.rgs") + + var mousePos = Vector2(x: 0, y: 0) + var windowPos = Vector2(x: screenWidth.float64, y: screenHeight.float64) + var panOffset = mousePos + + var dragWindow = false + var exitWindow = false + + var restartButton = false + + SetTargetFPS(60) + + # "axiom" + let startingPosition = Position(x: screenWidth/2, y: screenHeight.float64-100, angle: 90) + let drawLines = executeProgram(instructions, @[startingPosition], startingPosition) + + while not exitWindow and not WindowShouldClose(): + BeginDrawing() + + screenWidth = (monitor.GetMonitorWidth() / 2).int + screenHeight = (monitor.GetMonitorHeight() / 2).int + # This must come before anything else! + ClearBackground(BLACK) + for line in drawLines: + DrawLineEx(line.start_pos, line.end_pos, 3, WHITE) + + EndDrawing() + CloseWindow() + +when isMainModule: + #guiLoop() + guiLoop(toSeq(axiomToInstructions(7))) diff --git a/src/lsystempkg/raygui.nim b/src/lsystempkg/raygui.nim new file mode 100644 index 0000000..1356c55 --- /dev/null +++ b/src/lsystempkg/raygui.nim @@ -0,0 +1,354 @@ +# +# raygui v2.9-dev - A simple and easy-to-use immediate-mode gui library +# +# DESCRIPTION: +# +# raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also +# available as a standalone library, as long as input and drawing functions are provided. +# +# Controls provided: +# +# # Container/separators Controls +# - WindowBox +# - GroupBox +# - Line +# - Panel +# +# # Basic Controls +# - Label +# - Button +# - LabelButton --> Label +# - ImageButton --> Button +# - ImageButtonEx --> Button +# - Toggle +# - ToggleGroup --> Toggle +# - CheckBox +# - ComboBox +# - DropdownBox +# - TextBox +# - TextBoxMulti +# - ValueBox --> TextBox +# - Spinner --> Button, ValueBox +# - Slider +# - SliderBar --> Slider +# - ProgressBar +# - StatusBar +# - ScrollBar +# - ScrollPanel +# - DummyRec +# - Grid +# +# # Advance Controls +# - ListView +# - ColorPicker --> ColorPanel, ColorBarHue +# - MessageBox --> Window, Label, Button +# - TextInputBox --> Window, Label, TextBox, Button +# +# It also provides a set of functions for styling the controls based on its properties (size, color). +# +# CONFIGURATION: +# +# #define RAYGUI_IMPLEMENTATION +# Generates the implementation of the library into the included file. +# If not defined, the library is in header only mode and can be included in other headers +# or source files without problems. But only ONE file should hold the implementation. +# +# #define RAYGUI_STATIC (defined by default) +# The generated implementation will stay private inside implementation file and all +# internal symbols and functions will only be visible inside that file. +# +# #define RAYGUI_STANDALONE +# Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined +# internally in the library and input management and drawing functions must be provided by +# the user (check library implementation for further details). +# +# #define RAYGUI_SUPPORT_ICONS +# Includes riconsdata.h header defining a set of 128 icons (binary format) to be used on +# multiple controls and following raygui styles +# +# +# VERSIONS HISTORY: +# 2.9 (17-Mar-2021) Removed tooltip API +# 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() +# 2.7 (20-Feb-2020) Added possible tooltips API +# 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() +# REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() +# REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() +# Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties +# Added 8 new custom styles ready to use +# Multiple minor tweaks and bugs corrected +# 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() +# 2.3 (29-Apr-2019) Added rIcons auxiliar library and support for it, multiple controls reviewed +# Refactor all controls drawing mechanism to use control state +# 2.2 (05-Feb-2019) Added GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls +# 2.1 (26-Dec-2018) Redesign of GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string +# Complete redesign of style system (breaking change) +# 2.0 (08-Nov-2018) Support controls guiLock and custom fonts, reviewed GuiComboBox(), GuiListView()... +# 1.9 (09-Oct-2018) Controls review: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... +# 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout +# 1.5 (21-Jun-2017) Working in an improved styles system +# 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) +# 1.3 (12-Jun-2017) Redesigned styles system +# 1.1 (01-Jun-2017) Complete review of the library +# 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria. +# 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria. +# 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria. +# +# CONTRIBUTORS: +# Ramon Santamaria: Supervision, review, redesign, update and maintenance... +# Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) +# Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) +# Adria Arranz: Testing and Implementation of additional controls (2018) +# Jordi Jorba: Testing and Implementation of additional controls (2018) +# Albert Martos: Review and testing of the library (2015) +# Ian Eito: Review and testing of the library (2015) +# Kevin Gato: Initial implementation of basic components (2014) +# Daniel Nicolas: Initial implementation of basic components (2014) +# +# +# LICENSE: zlib/libpng +# +# Copyright (c) 2014-2020 Ramon Santamaria (@raysan5) +# +# This software is provided "as-is", without any express or implied warranty. In no event +# will the authors be held liable for any damages arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, including commercial +# applications, and to alter it and redistribute it freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim that you +# wrote the original software. If you use this software in a product, an acknowledgment +# in the product documentation would be appreciated but is not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be misrepresented +# as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution. +# +template RAYGUI_H*(): auto = RAYGUI_H +template RAYGUI_VERSION*(): auto = "2.9-dev" +import raylib +# Define functions scope to be used internally (static) or externally (extern) to the module including this file +{.pragma: RAYGUIDEF, cdecl, discardable, dynlib: "raygui" & LEXT.} +# Allow custom memory allocators +# ---------------------------------------------------------------------------------- +# Defines and Macros +# ---------------------------------------------------------------------------------- +template NUM_CONTROLS*(): auto = 16 +template NUM_PROPS_DEFAULT*(): auto = 16 +template NUM_PROPS_EXTENDED*(): auto = 8 +template TEXTEDIT_CURSOR_BLINK_FRAMES*(): auto = 20 +# ---------------------------------------------------------------------------------- +# Types and Structures Definition +# NOTE: Some types are required for RAYGUI_STANDALONE usage +# ---------------------------------------------------------------------------------- +# Style property +type GuiStyleProp* {.bycopy.} = object + controlId*: uint16 + propertyId*: uint16 + propertyValue*: int32 +# Gui control state +type GuiControlState* = enum + GUI_STATE_NORMAL = 0 + GUI_STATE_FOCUSED + GUI_STATE_PRESSED + GUI_STATE_DISABLED +converter GuiControlState2int32* (self: GuiControlState): int32 = self.int32 +# Gui control text alignment +type GuiTextAlignment* = enum + GUI_TEXT_ALIGN_LEFT = 0 + GUI_TEXT_ALIGN_CENTER + GUI_TEXT_ALIGN_RIGHT +converter GuiTextAlignment2int32* (self: GuiTextAlignment): int32 = self.int32 +# Gui controls +type GuiControl* = enum + DEFAULT = 0 + LABEL # LABELBUTTON + BUTTON # IMAGEBUTTON + TOGGLE # TOGGLEGROUP + SLIDER # SLIDERBAR + PROGRESSBAR + CHECKBOX + COMBOBOX + DROPDOWNBOX + TEXTBOX # TEXTBOXMULTI + VALUEBOX + SPINNER + LISTVIEW + COLORPICKER + SCROLLBAR + STATUSBAR +converter GuiControl2int32* (self: GuiControl): int32 = self.int32 +# Gui base properties for every control +type GuiControlProperty* = enum + BORDER_COLOR_NORMAL = 0 + BASE_COLOR_NORMAL + TEXT_COLOR_NORMAL + BORDER_COLOR_FOCUSED + BASE_COLOR_FOCUSED + TEXT_COLOR_FOCUSED + BORDER_COLOR_PRESSED + BASE_COLOR_PRESSED + TEXT_COLOR_PRESSED + BORDER_COLOR_DISABLED + BASE_COLOR_DISABLED + TEXT_COLOR_DISABLED + BORDER_WIDTH + TEXT_PADDING + TEXT_ALIGNMENT + RESERVED +converter GuiControlProperty2int32* (self: GuiControlProperty): int32 = self.int32 +# Gui extended properties depend on control +# NOTE: We reserve a fixed size of additional properties per control +# DEFAULT properties +type GuiDefaultProperty* = enum + TEXT_SIZE = 16 + TEXT_SPACING + LINE_COLOR + BACKGROUND_COLOR +converter GuiDefaultProperty2int32* (self: GuiDefaultProperty): int32 = self.int32 +# Label +# typedef enum { } GuiLabelProperty; +# Button +# typedef enum { } GuiButtonProperty; +# Toggle / ToggleGroup +type GuiToggleProperty* = enum + GROUP_PADDING = 16 +converter GuiToggleProperty2int32* (self: GuiToggleProperty): int32 = self.int32 +# Slider / SliderBar +type GuiSliderProperty* = enum + SLIDER_WIDTH = 16 + SLIDER_PADDING +converter GuiSliderProperty2int32* (self: GuiSliderProperty): int32 = self.int32 +# ProgressBar +type GuiProgressBarProperty* = enum + PROGRESS_PADDING = 16 +converter GuiProgressBarProperty2int32* (self: GuiProgressBarProperty): int32 = self.int32 +# CheckBox +type GuiCheckBoxProperty* = enum + CHECK_PADDING = 16 +converter GuiCheckBoxProperty2int32* (self: GuiCheckBoxProperty): int32 = self.int32 +# ComboBox +type GuiComboBoxProperty* = enum + COMBO_BUTTON_WIDTH = 16 + COMBO_BUTTON_PADDING +converter GuiComboBoxProperty2int32* (self: GuiComboBoxProperty): int32 = self.int32 +# DropdownBox +type GuiDropdownBoxProperty* = enum + ARROW_PADDING = 16 + DROPDOWN_ITEMS_PADDING +converter GuiDropdownBoxProperty2int32* (self: GuiDropdownBoxProperty): int32 = self.int32 +# TextBox / TextBoxMulti / ValueBox / Spinner +type GuiTextBoxProperty* = enum + TEXT_INNER_PADDING = 16 + TEXT_LINES_PADDING + COLOR_SELECTED_FG + COLOR_SELECTED_BG +converter GuiTextBoxProperty2int32* (self: GuiTextBoxProperty): int32 = self.int32 +# Spinner +type GuiSpinnerProperty* = enum + SPIN_BUTTON_WIDTH = 16 + SPIN_BUTTON_PADDING +converter GuiSpinnerProperty2int32* (self: GuiSpinnerProperty): int32 = self.int32 +# ScrollBar +type GuiScrollBarProperty* = enum + ARROWS_SIZE = 16 + ARROWS_VISIBLE + SCROLL_SLIDER_PADDING + SCROLL_SLIDER_SIZE + SCROLL_PADDING + SCROLL_SPEED +converter GuiScrollBarProperty2int32* (self: GuiScrollBarProperty): int32 = self.int32 +# ScrollBar side +type GuiScrollBarSide* = enum + SCROLLBAR_LEFT_SIDE = 0 + SCROLLBAR_RIGHT_SIDE +converter GuiScrollBarSide2int32* (self: GuiScrollBarSide): int32 = self.int32 +# ListView +type GuiListViewProperty* = enum + LIST_ITEMS_HEIGHT = 16 + LIST_ITEMS_PADDING + SCROLLBAR_WIDTH + SCROLLBAR_SIDE +converter GuiListViewProperty2int32* (self: GuiListViewProperty): int32 = self.int32 +# ColorPicker +type GuiColorPickerProperty* = enum + COLOR_SELECTOR_SIZE = 16 + HUEBAR_WIDTH # Right hue bar width + HUEBAR_PADDING # Right hue bar separation from panel + HUEBAR_SELECTOR_HEIGHT # Right hue bar selector height + HUEBAR_SELECTOR_OVERFLOW # Right hue bar selector overflow +converter GuiColorPickerProperty2int32* (self: GuiColorPickerProperty): int32 = self.int32 +# ---------------------------------------------------------------------------------- +# Global Variables Definition +# ---------------------------------------------------------------------------------- +# ... +# ---------------------------------------------------------------------------------- +# Module Functions Declaration +# ---------------------------------------------------------------------------------- +# State modification functions +proc GuiEnable*() {.RAYGUIDEF, importc: "GuiEnable".} # Enable gui controls (global state) +proc GuiDisable*() {.RAYGUIDEF, importc: "GuiDisable".} # Disable gui controls (global state) +proc GuiLock*() {.RAYGUIDEF, importc: "GuiLock".} # Lock gui controls (global state) +proc GuiUnlock*() {.RAYGUIDEF, importc: "GuiUnlock".} # Unlock gui controls (global state) +proc GuiFade*(alpha: float32) {.RAYGUIDEF, importc: "GuiFade".} # Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +proc GuiSetState*(state: int32) {.RAYGUIDEF, importc: "GuiSetState".} # Set gui state (global state) +proc GuiGetState*(): int32 {.RAYGUIDEF, importc: "GuiGetState".} # Get gui state (global state) +# Font set/get functions +proc GuiSetFont*(font: Font) {.RAYGUIDEF, importc: "GuiSetFont".} # Set gui custom font (global state) +proc GuiGetFont*(): Font {.RAYGUIDEF, importc: "GuiGetFont".} # Get gui custom font (global state) +# Style set/get functions +proc GuiSetStyle*(control: int32; property: int32; value: int32) {.RAYGUIDEF, importc: "GuiSetStyle".} # Set one style property +proc GuiGetStyle*(control: int32; property: int32): int32 {.RAYGUIDEF, importc: "GuiGetStyle".} # Get one style property +# Container/separator controls, useful for controls organization +proc GuiWindowBox*(bounds: Rectangle; title: cstring): bool {.RAYGUIDEF, importc: "GuiWindowBox".} # Window Box control, shows a window that can be closed +proc GuiGroupBox*(bounds: Rectangle; text: cstring) {.RAYGUIDEF, importc: "GuiGroupBox".} # Group Box control with text name +proc GuiLine*(bounds: Rectangle; text: cstring) {.RAYGUIDEF, importc: "GuiLine".} # Line separator control, could contain text +proc GuiPanel*(bounds: Rectangle) {.RAYGUIDEF, importc: "GuiPanel".} # Panel control, useful to group controls +proc GuiScrollPanel*(bounds: Rectangle; content: Rectangle; scroll: ptr Vector2): Rectangle {.RAYGUIDEF, importc: "GuiScrollPanel".} # Scroll Panel control +# Basic controls set +proc GuiLabel*(bounds: Rectangle; text: cstring) {.RAYGUIDEF, importc: "GuiLabel".} # Label control, shows text +proc GuiButton*(bounds: Rectangle; text: cstring): bool {.RAYGUIDEF, importc: "GuiButton".} # Button control, returns true when clicked +proc GuiLabelButton*(bounds: Rectangle; text: cstring): bool {.RAYGUIDEF, importc: "GuiLabelButton".} # Label button control, show true when clicked +proc GuiImageButton*(bounds: Rectangle; text: cstring; texture: Texture2D): bool {.RAYGUIDEF, importc: "GuiImageButton".} # Image button control, returns true when clicked +proc GuiImageButtonEx*(bounds: Rectangle; text: cstring; texture: Texture2D; texSource: Rectangle): bool {.RAYGUIDEF, importc: "GuiImageButtonEx".} # Image button extended control, returns true when clicked +proc GuiToggle*(bounds: Rectangle; text: cstring; active: bool): bool {.RAYGUIDEF, importc: "GuiToggle".} # Toggle Button control, returns true when active +proc GuiToggleGroup*(bounds: Rectangle; text: cstring; active: int32): int32 {.RAYGUIDEF, importc: "GuiToggleGroup".} # Toggle Group control, returns active toggle index +proc GuiCheckBox*(bounds: Rectangle; text: cstring; checked: bool): bool {.RAYGUIDEF, importc: "GuiCheckBox".} # Check Box control, returns true when active +proc GuiComboBox*(bounds: Rectangle; text: cstring; active: int32): int32 {.RAYGUIDEF, importc: "GuiComboBox".} # Combo Box control, returns selected item index +proc GuiDropdownBox*(bounds: Rectangle; text: cstring; active: pointer; editMode: bool): bool {.RAYGUIDEF, importc: "GuiDropdownBox".} # Dropdown Box control, returns selected item +proc GuiSpinner*(bounds: Rectangle; text: cstring; value: pointer; minValue: int32; maxValue: int32; editMode: bool): bool {.RAYGUIDEF, importc: "GuiSpinner".} # Spinner control, returns selected value +proc GuiValueBox*(bounds: Rectangle; text: cstring; value: pointer; minValue: int32; maxValue: int32; editMode: bool): bool {.RAYGUIDEF, importc: "GuiValueBox".} # Value Box control, updates input text with numbers +proc GuiTextBox*(bounds: Rectangle; text: ptr char; textSize: int32; editMode: bool): bool {.RAYGUIDEF, importc: "GuiTextBox".} # Text Box control, updates input text +proc GuiTextBoxMulti*(bounds: Rectangle; text: ptr char; textSize: int32; editMode: bool): bool {.RAYGUIDEF, importc: "GuiTextBoxMulti".} # Text Box control with multiple lines +proc GuiSlider*(bounds: Rectangle; textLeft: cstring; textRight: cstring; value: float32; minValue: float32; maxValue: float32): float32 {.RAYGUIDEF, importc: "GuiSlider".} # Slider control, returns selected value +proc GuiSliderBar*(bounds: Rectangle; textLeft: cstring; textRight: cstring; value: float32; minValue: float32; maxValue: float32): float32 {.RAYGUIDEF, importc: "GuiSliderBar".} # Slider Bar control, returns selected value +proc GuiProgressBar*(bounds: Rectangle; textLeft: cstring; textRight: cstring; value: float32; minValue: float32; maxValue: float32): float32 {.RAYGUIDEF, importc: "GuiProgressBar".} # Progress Bar control, shows current progress value +proc GuiStatusBar*(bounds: Rectangle; text: cstring) {.RAYGUIDEF, importc: "GuiStatusBar".} # Status Bar control, shows info text +proc GuiDummyRec*(bounds: Rectangle; text: cstring) {.RAYGUIDEF, importc: "GuiDummyRec".} # Dummy control for placeholders +proc GuiScrollBar*(bounds: Rectangle; value: int32; minValue: int32; maxValue: int32): int32 {.RAYGUIDEF, importc: "GuiScrollBar".} # Scroll Bar control +proc GuiGrid*(bounds: Rectangle; spacing: float32; subdivs: int32): Vector2 {.RAYGUIDEF, importc: "GuiGrid".} # Grid control +# Advance controls set +proc GuiListView*(bounds: Rectangle; text: cstring; scrollIndex: pointer; active: int32): int32 {.RAYGUIDEF, importc: "GuiListView".} # List View control, returns selected list item index +proc GuiListViewEx*(bounds: Rectangle; text: cstring; count: int32; focus: pointer; scrollIndex: pointer; active: int32): int32 {.RAYGUIDEF, importc: "GuiListViewEx".} # List View with extended parameters +proc GuiMessageBox*(bounds: Rectangle; title: cstring; message: cstring; buttons: cstring): int32 {.RAYGUIDEF, importc: "GuiMessageBox".} # Message Box control, displays a message +proc GuiTextInputBox*(bounds: Rectangle; title: cstring; message: cstring; buttons: cstring; text: ptr char): int32 {.RAYGUIDEF, importc: "GuiTextInputBox".} # Text Input Box control, ask for text +proc GuiColorPicker*(bounds: Rectangle; color: Color): Color {.RAYGUIDEF, importc: "GuiColorPicker".} # Color Picker control (multiple color controls) +proc GuiColorPanel*(bounds: Rectangle; color: Color): Color {.RAYGUIDEF, importc: "GuiColorPanel".} # Color Panel control +proc GuiColorBarAlpha*(bounds: Rectangle; alpha: float32): float32 {.RAYGUIDEF, importc: "GuiColorBarAlpha".} # Color Bar Alpha control +proc GuiColorBarHue*(bounds: Rectangle; value: float32): float32 {.RAYGUIDEF, importc: "GuiColorBarHue".} # Color Bar Hue control +# Styles loading functions +proc GuiLoadStyle*(fileName: cstring) {.RAYGUIDEF, importc: "GuiLoadStyle".} # Load style file (.rgs) +proc GuiLoadStyleDefault*() {.RAYGUIDEF, importc: "GuiLoadStyleDefault".} # Load style default over global style +proc GuiIconText*(iconId: int32; text: cstring): cstring {.RAYGUIDEF, importc: "GuiIconText".} # Get text with icon id prepended (if supported) +# Gui icons functionality +proc GuiDrawIcon*(iconId: int32; position: Vector2; pixelSize: int32; color: Color) {.RAYGUIDEF, importc: "GuiDrawIcon".} +proc GuiGetIcons*(): uint32 {.RAYGUIDEF, importc: "GuiGetIcons".} # Get full icons data pointer +proc GuiGetIconData*(iconId: int32): uint32 {.RAYGUIDEF, importc: "GuiGetIconData".} # Get icon bit data +proc GuiSetIconData*(iconId: int32; data: uint32) {.RAYGUIDEF, importc: "GuiSetIconData".} # Set icon bit data +proc GuiSetIconPixel*(iconId: int32; x: int32; y: int32) {.RAYGUIDEF, importc: "GuiSetIconPixel".} # Set icon pixel value +proc GuiClearIconPixel*(iconId: int32; x: int32; y: int32) {.RAYGUIDEF, importc: "GuiClearIconPixel".} # Clear icon pixel value +proc GuiCheckIconPixel*(iconId: int32; x: int32; y: int32): bool {.RAYGUIDEF, importc: "GuiCheckIconPixel".} # Check icon pixel value +# +# RAYGUI IMPLEMENTATION +# diff --git a/src/lsystempkg/raylib.nim b/src/lsystempkg/raylib.nim new file mode 100644 index 0000000..a7c772a --- /dev/null +++ b/src/lsystempkg/raylib.nim @@ -0,0 +1,1291 @@ +# +# raylib - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) +# +# FEATURES: +# - NO external dependencies, all required libraries included with raylib +# - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, +# MacOS, Haiku, UWP, Android, Raspberry Pi, HTML5. +# - Written in plain C code (C99) in PascalCase/camelCase notation +# - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile) +# - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] +# - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts) +# - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC) +# - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more! +# - Flexible Materials system, supporting classic maps and PBR maps +# - Animated 3D models supported (skeletal bones animation) (IQM, glTF) +# - Shaders support, including Model shaders and Postprocessing shaders +# - Powerful math module for Vector, Matrix and Quaternion operations: [raymath] +# - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) +# - VR stereo rendering with configurable HMD device parameters +# - Bindings to multiple programming languages available! +# +# NOTES: +# One default Font is loaded on InitWindow()->LoadFontDefault() [core, text] +# One default Texture2D is loaded on rlglInit() [rlgl] (OpenGL 3.3 or ES2) +# One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2) +# One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2) +# +# DEPENDENCIES (included): +# [core] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP) +# [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP) +# [raudio] miniaudio (David Reid - github.com/dr-soft/miniaudio) for audio device/context management +# +# OPTIONAL DEPENDENCIES (included): +# [core] msf_gif (Miles Fogle) for GIF recording +# [core] sinfl (Micha Mettke) for DEFLATE decompression algorythm +# [core] sdefl (Micha Mettke) for DEFLATE compression algorythm +# [textures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...) +# [textures] stb_image_write (Sean Barret) for image writting (BMP, TGA, PNG, JPG) +# [textures] stb_image_resize (Sean Barret) for image resizing algorithms +# [textures] stb_perlin (Sean Barret) for Perlin noise image generation +# [text] stb_truetype (Sean Barret) for ttf fonts loading +# [text] stb_rect_pack (Sean Barret) for rectangles packing +# [models] par_shapes (Philip Rideout) for parametric 3d shapes generation +# [models] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL) +# [models] cgltf (Johannes Kuhlmann) for models loading (glTF) +# [raudio] dr_wav (David Reid) for WAV audio file loading +# [raudio] dr_flac (David Reid) for FLAC audio file loading +# [raudio] dr_mp3 (David Reid) for MP3 audio file loading +# [raudio] stb_vorbis (Sean Barret) for OGG audio loading +# [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading +# [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading +# +# +# LICENSE: zlib/libpng +# +# raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, +# BSD-like license that allows static linking with closed source software: +# +# Copyright (c) 2013-2021 Ramon Santamaria (@raysan5) +# +# This software is provided "as-is", without any express or implied warranty. In no event +# will the authors be held liable for any damages arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, including commercial +# applications, and to alter it and redistribute it freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim that you +# wrote the original software. If you use this software in a product, an acknowledgment +# in the product documentation would be appreciated but is not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be misrepresented +# as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution. +# +converter int2in32* (self: int): int32 = self.int32 +const LEXT* = when defined(windows):".dll" +elif defined(macosx): ".dylib" +else: ".so" +template RAYLIB_VERSION*(): auto = "3.8-dev" +{.pragma: RLAPI, cdecl, discardable, dynlib: "libraylib" & LEXT.} +# ---------------------------------------------------------------------------------- +# Some basic Defines +# ---------------------------------------------------------------------------------- +template DEG2RAD*(): auto = (PI/180.0f) +template RAD2DEG*(): auto = (180.0f/PI) +# Allow custom memory allocators +# NOTE: MSVC C++ compiler does not support compound literals (C99 feature) +# Plain structures in C++ (without constructors) can be initialized with { } +# Some Basic Colors +# NOTE: Custom raylib color palette for amazing visuals on WHITE background +template LIGHTGRAY*(): auto = Color(r: 200, g: 200, b: 200, a: 255) # Light Gray +template GRAY*(): auto = Color(r: 130, g: 130, b: 130, a: 255) # Gray +template DARKGRAY*(): auto = Color(r: 80, g: 80, b: 80, a: 255) # Dark Gray +template YELLOW*(): auto = Color(r: 253, g: 249, b: 0, a: 255) # Yellow +template GOLD*(): auto = Color(r: 255, g: 203, b: 0, a: 255) # Gold +template ORANGE*(): auto = Color(r: 255, g: 161, b: 0, a: 255) # Orange +template PINK*(): auto = Color(r: 255, g: 109, b: 194, a: 255) # Pink +template RED*(): auto = Color(r: 230, g: 41, b: 55, a: 255) # Red +template MAROON*(): auto = Color(r: 190, g: 33, b: 55, a: 255) # Maroon +template GREEN*(): auto = Color(r: 0, g: 228, b: 48, a: 255) # Green +template LIME*(): auto = Color(r: 0, g: 158, b: 47, a: 255) # Lime +template DARKGREEN*(): auto = Color(r: 0, g: 117, b: 44, a: 255) # Dark Green +template SKYBLUE*(): auto = Color(r: 102, g: 191, b: 255, a: 255) # Sky Blue +template BLUE*(): auto = Color(r: 0, g: 121, b: 241, a: 255) # Blue +template DARKBLUE*(): auto = Color(r: 0, g: 82, b: 172, a: 255) # Dark Blue +template PURPLE*(): auto = Color(r: 200, g: 122, b: 255, a: 255) # Purple +template VIOLET*(): auto = Color(r: 135, g: 60, b: 190, a: 255) # Violet +template DARKPURPLE*(): auto = Color(r: 112, g: 31, b: 126, a: 255) # Dark Purple +template BEIGE*(): auto = Color(r: 211, g: 176, b: 131, a: 255) # Beige +template BROWN*(): auto = Color(r: 127, g: 106, b: 79, a: 255) # Brown +template DARKBROWN*(): auto = Color(r: 76, g: 63, b: 47, a: 255) # Dark Brown +template WHITE*(): auto = Color(r: 255, g: 255, b: 255, a: 255) # White +template BLACK*(): auto = Color(r: 0, g: 0, b: 0, a: 255) # Black +template BLANK*(): auto = Color(r: 0, g: 0, b: 0, a: 0) # Blank (Transparent) +template MAGENTA*(): auto = Color(r: 255, g: 0, b: 255, a: 255) # Magenta +template RAYWHITE*(): auto = Color(r: 245, g: 245, b: 245, a: 255) # My own White (raylib logo) +# WARNING: Temporal hacks to avoid breaking old codebases using +# deprecated raylib implementations or definitions +# Definition of GetImageData was moved to EOF. +template FILTER_POINT*(): auto = TEXTURE_FILTER_POINT +template FILTER_BILINEAR*(): auto = TEXTURE_FILTER_BILINEAR +template MAP_DIFFUSE*(): auto = MATERIAL_MAP_DIFFUSE +template UNCOMPRESSED_R8G8B8A8*(): auto = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 +# ---------------------------------------------------------------------------------- +# Structures Definition +# ---------------------------------------------------------------------------------- +# Boolean type +# Vector2, 2 components +type Vector2* {.bycopy.} = object + x*: float32 # Vector x component + y*: float32 # Vector y component +# Vector3, 3 components +type Vector3* {.bycopy.} = object + x*: float32 # Vector x component + y*: float32 # Vector y component + z*: float32 # Vector z component +# Vector4, 4 components +type Vector4* {.bycopy.} = object + x*: float32 # Vector x component + y*: float32 # Vector y component + z*: float32 # Vector z component + w*: float32 # Vector w component +# Quaternion, 4 components (Vector4 alias) +type Quaternion* = Vector4 +# Matrix, 4x4 components, column major, OpenGL style, right handed +type Matrix* {.bycopy.} = object + m0*, m4*, m8*, m12*: float32 # Matrix first row (4 components) + m1*, m5*, m9*, m13*: float32 # Matrix second row (4 components) + m2*, m6*, m10*, m14*: float32 # Matrix third row (4 components) + m3*, m7*, m11*, m15*: float32 # Matrix fourth row (4 components) +# Color, 4 components, R8G8B8A8 (32bit) +type Color* {.bycopy.} = object + r*: uint8 # Color red value + g*: uint8 # Color green value + b*: uint8 # Color blue value + a*: uint8 # Color alpha value +# Rectangle, 4 components +type Rectangle* {.bycopy.} = object + x*: float32 # Rectangle top-left corner position x + y*: float32 # Rectangle top-left corner position y + width*: float32 # Rectangle width + height*: float32 # Rectangle height +# Image, pixel data stored in CPU memory (RAM) +type Image* {.bycopy.} = object + data*: pointer # Image raw data + width*: int32 # Image base width + height*: int32 # Image base height + mipmaps*: int32 # Mipmap levels, 1 by default + format*: int32 # Data format (PixelFormat type) +# Texture, tex data stored in GPU memory (VRAM) +type Texture* {.bycopy.} = object + id*: uint32 # OpenGL texture id + width*: int32 # Texture base width + height*: int32 # Texture base height + mipmaps*: int32 # Mipmap levels, 1 by default + format*: int32 # Data format (PixelFormat type) +# Texture2D, same as Texture +type Texture2D* = Texture +# TextureCubemap, same as Texture +type TextureCubemap* = Texture +# RenderTexture, fbo for texture rendering +type RenderTexture* {.bycopy.} = object + id*: uint32 # OpenGL framebuffer object id + texture*: Texture # Color buffer attachment texture + depth*: Texture # Depth buffer attachment texture +# RenderTexture2D, same as RenderTexture +type RenderTexture2D* = RenderTexture +# NPatchInfo, n-patch layout info +type NPatchInfo* {.bycopy.} = object + source*: Rectangle # Texture source rectangle + left*: int32 # Left border offset + top*: int32 # Top border offset + right*: int32 # Right border offset + bottom*: int32 # Bottom border offset + layout*: int32 # Layout of the n-patch: 3x3, 1x3 or 3x1 +# CharInfo, font character info +type CharInfo* {.bycopy.} = object + value*: int32 # Character value (Unicode) + offsetX*: int32 # Character offset X when drawing + offsetY*: int32 # Character offset Y when drawing + advanceX*: int32 # Character advance position X + image*: Image # Character image data +# Font, font texture and CharInfo array data +type Font* {.bycopy.} = object + baseSize*: int32 # Base size (default chars height) + charsCount*: int32 # Number of characters + charsPadding*: int32 # Padding around the chars + texture*: Texture2D # Characters texture atlas + recs*: ptr Rectangle # Characters rectangles in texture + chars*: ptr CharInfo # Characters info data +# Camera, defines position/orientation in 3d space +type Camera3D* {.bycopy.} = object + position*: Vector3 # Camera position + target*: Vector3 # Camera target it looks-at + up*: Vector3 # Camera up vector (rotation over its axis) + fovy*: float32 # Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic + projection*: int32 # Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC +type Camera* = Camera3D +# Camera2D, defines position/orientation in 2d space +type Camera2D* {.bycopy.} = object + offset*: Vector2 # Camera offset (displacement from target) + target*: Vector2 # Camera target (rotation and zoom origin) + rotation*: float32 # Camera rotation in degrees + zoom*: float32 # Camera zoom (scaling), should be 1.0f by default +# Mesh, vertex data and vao/vbo +type Mesh* {.bycopy.} = object + vertexCount*: int32 # Number of vertices stored in arrays + triangleCount*: int32 # Number of triangles stored (indexed or not) + vertices*: float32 # Vertex position (XYZ - 3 components per vertex) (shader-location = 0) + texcoords*: float32 # Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) + texcoords2*: float32 # Vertex second texture coordinates (useful for lightmaps) (shader-location = 5) + normals*: float32 # Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) + tangents*: float32 # Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) + colors*: uint8 # Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) + indices*: uint16 # Vertex indices (in case vertex data comes indexed) + animVertices*: float32 # Animated vertex positions (after bones transformations) + animNormals*: float32 # Animated normals (after bones transformations) + boneIds*: pointer # Vertex bone ids, up to 4 bones influence by vertex (skinning) + boneWeights*: float32 # Vertex bone weight, up to 4 bones influence by vertex (skinning) + vaoId*: uint32 # OpenGL Vertex Array Object id + vboId*: uint32 # OpenGL Vertex Buffer Objects id (default vertex data) +# Shader +type Shader* {.bycopy.} = object + id*: uint32 # Shader program id + locs*: pointer # Shader locations array (MAX_SHADER_LOCATIONS) +# MaterialMap +type MaterialMap* {.bycopy.} = object + texture*: Texture2D # Material map texture + color*: Color # Material map color + value*: float32 # Material map value +# Material, includes shader and maps +type Material* {.bycopy.} = object + shader*: Shader # Material shader + maps*: ptr MaterialMap # Material maps array (MAX_MATERIAL_MAPS) + params*: array[0..3, float32] # Material generic parameters (if required) +# Transform, vectex transformation data +type Transform* {.bycopy.} = object + translation*: Vector3 # Translation + rotation*: Quaternion # Rotation + scale*: Vector3 # Scale +# Bone, skeletal animation bone +type BoneInfo* {.bycopy.} = object + name*: array[0..31, char] # Bone name + parent*: int32 # Bone parent +# Model, meshes, materials and animation data +type Model* {.bycopy.} = object + transform*: Matrix # Local transform matrix + meshCount*: int32 # Number of meshes + materialCount*: int32 # Number of materials + meshes*: ptr Mesh # Meshes array + materials*: ptr Material # Materials array + meshMaterial*: pointer # Mesh material number + boneCount*: int32 # Number of bones + bones*: ptr BoneInfo # Bones information (skeleton) + bindPose*: ptr Transform # Bones base transformation (pose) +# ModelAnimation +type ModelAnimation* {.bycopy.} = object + boneCount*: int32 # Number of bones + frameCount*: int32 # Number of animation frames + bones*: ptr BoneInfo # Bones information (skeleton) + framePoses*: ptr Transform # Poses array by frame +# Ray, ray for raycasting +type Ray* {.bycopy.} = object + position*: Vector3 # Ray position (origin) + direction*: Vector3 # Ray direction +# RayCollision, ray hit information +type RayCollision* {.bycopy.} = object + hit*: bool # Did the ray hit something? + distance*: float32 # Distance to nearest hit + point*: Vector3 # Point of nearest hit + normal*: Vector3 # Surface normal of hit +# BoundingBox +type BoundingBox* {.bycopy.} = object + min*: Vector3 # Minimum vertex box-corner + max*: Vector3 # Maximum vertex box-corner +# Wave, audio wave data +type Wave* {.bycopy.} = object + sampleCount*: uint32 # Total number of samples (considering channels!) + sampleRate*: uint32 # Frequency (samples per second) + sampleSize*: uint32 # Bit depth (bits per sample): 8, 16, 32 (24 not supported) + channels*: uint32 # Number of channels (1-mono, 2-stereo) + data*: pointer # Buffer data pointer +type rAudioBuffer* {.bycopy.} = object +# AudioStream, custom audio stream +type AudioStream* {.bycopy.} = object + buffer*: ptr rAudioBuffer # Pointer to internal data used by the audio system + sampleRate*: uint32 # Frequency (samples per second) + sampleSize*: uint32 # Bit depth (bits per sample): 8, 16, 32 (24 not supported) + channels*: uint32 # Number of channels (1-mono, 2-stereo) +# Sound +type Sound* {.bycopy.} = object + stream*: AudioStream # Audio stream + sampleCount*: uint32 # Total number of samples +# Music, audio stream, anything longer than ~10 seconds should be streamed +type Music* {.bycopy.} = object + stream*: AudioStream # Audio stream + sampleCount*: uint32 # Total number of samples + looping*: bool # Music looping enable + ctxType*: int32 # Type of music context (audio filetype) + ctxData*: pointer # Audio context data, depends on type +# VrDeviceInfo, Head-Mounted-Display device parameters +type VrDeviceInfo* {.bycopy.} = object + hResolution*: int32 # Horizontal resolution in pixels + vResolution*: int32 # Vertical resolution in pixels + hScreenSize*: float32 # Horizontal size in meters + vScreenSize*: float32 # Vertical size in meters + vScreenCenter*: float32 # Screen center in meters + eyeToScreenDistance*: float32 # Distance between eye and display in meters + lensSeparationDistance*: float32 # Lens separation distance in meters + interpupillaryDistance*: float32 # IPD (distance between pupils) in meters + lensDistortionValues*: array[0..3, float32] # Lens distortion constant parameters + chromaAbCorrection*: array[0..3, float32] # Chromatic aberration correction parameters +# VrStereoConfig, VR stereo rendering configuration for simulator +type VrStereoConfig* {.bycopy.} = object + projection*: array[0..1, Matrix] # VR projection matrices (per eye) + viewOffset*: array[0..1, Matrix] # VR view offset matrices (per eye) + leftLensCenter*: array[0..1, float32] # VR left lens center + rightLensCenter*: array[0..1, float32] # VR right lens center + leftScreenCenter*: array[0..1, float32] # VR left screen center + rightScreenCenter*: array[0..1, float32] # VR right screen center + scale*: array[0..1, float32] # VR distortion scale + scaleIn*: array[0..1, float32] # VR distortion scale in +# ---------------------------------------------------------------------------------- +# Enumerators Definition +# ---------------------------------------------------------------------------------- +# System/Window config flags +# NOTE: Every bit registers one state (use it with bit masks) +# By default all flags are set to 0 +type ConfigFlags* = enum + FLAG_FULLSCREEN_MODE = 0x00000002 # Set to run program in fullscreen + FLAG_WINDOW_RESIZABLE = 0x00000004 # Set to allow resizable window + FLAG_WINDOW_UNDECORATED = 0x00000008 # Set to disable window decoration (frame and buttons) + FLAG_WINDOW_TRANSPARENT = 0x00000010 # Set to allow transparent framebuffer + FLAG_MSAA_4X_HINT = 0x00000020 # Set to try enabling MSAA 4X + FLAG_VSYNC_HINT = 0x00000040 # Set to try enabling V-Sync on GPU + FLAG_WINDOW_HIDDEN = 0x00000080 # Set to hide window + FLAG_WINDOW_ALWAYS_RUN = 0x00000100 # Set to allow windows running while minimized + FLAG_WINDOW_MINIMIZED = 0x00000200 # Set to minimize window (iconify) + FLAG_WINDOW_MAXIMIZED = 0x00000400 # Set to maximize window (expanded to monitor) + FLAG_WINDOW_UNFOCUSED = 0x00000800 # Set to window non focused + FLAG_WINDOW_TOPMOST = 0x00001000 # Set to window always on top + FLAG_WINDOW_HIGHDPI = 0x00002000 # Set to support HighDPI + FLAG_INTERLACED_HINT = 0x00010000 # Set to try enabling interlaced video format (for V3D) +converter ConfigFlags2int32* (self: ConfigFlags): int32 = self.int32 +# Trace log level +# NOTE: Organized by priority level +type TraceLogLevel* = enum + LOG_ALL = 0 # Display all logs + LOG_TRACE # Trace logging, intended for internal use only + LOG_DEBUG # Debug logging, used for internal debugging, it should be disabled on release builds + LOG_INFO # Info logging, used for program execution info + LOG_WARNING # Warning logging, used on recoverable failures + LOG_ERROR # Error logging, used on unrecoverable failures + LOG_FATAL # Fatal logging, used to abort program: exit(EXIT_FAILURE) + LOG_NONE # Disable logging +converter TraceLogLevel2int32* (self: TraceLogLevel): int32 = self.int32 +# Keyboard keys (US keyboard layout) +# NOTE: Use GetKeyPressed() to allow redefining +# required keys for alternative layouts +type KeyboardKey* = enum + KEY_NULL = 0 # Key: NULL, used for no key pressed + KEY_BACK = 4 # Key: Android back button + KEY_VOLUME_UP = 24 # Key: Android volume up button + KEY_VOLUME_DOWN = 25 # Key: Android volume down button + KEY_SPACE = 32 # Key: Space + KEY_APOSTROPHE = 39 # Key: ' + KEY_COMMA = 44 # Key: , + KEY_MINUS = 45 # Key: - + KEY_PERIOD = 46 # Key: . + KEY_SLASH = 47 # Key: / + KEY_ZERO = 48 # Key: 0 + KEY_ONE = 49 # Key: 1 + KEY_TWO = 50 # Key: 2 + KEY_THREE = 51 # Key: 3 + KEY_FOUR = 52 # Key: 4 + KEY_FIVE = 53 # Key: 5 + KEY_SIX = 54 # Key: 6 + KEY_SEVEN = 55 # Key: 7 + KEY_EIGHT = 56 # Key: 8 + KEY_NINE = 57 # Key: 9 + KEY_SEMICOLON = 59 # Key: ; + KEY_EQUAL = 61 # Key: = + KEY_A = 65 # Key: A | a + KEY_B = 66 # Key: B | b + KEY_C = 67 # Key: C | c + KEY_D = 68 # Key: D | d + KEY_E = 69 # Key: E | e + KEY_F = 70 # Key: F | f + KEY_G = 71 # Key: G | g + KEY_H = 72 # Key: H | h + KEY_I = 73 # Key: I | i + KEY_J = 74 # Key: J | j + KEY_K = 75 # Key: K | k + KEY_L = 76 # Key: L | l + KEY_M = 77 # Key: M | m + KEY_N = 78 # Key: N | n + KEY_O = 79 # Key: O | o + KEY_P = 80 # Key: P | p + KEY_Q = 81 # Key: Q | q + KEY_R = 82 # Key: R | r + KEY_S = 83 # Key: S | s + KEY_T = 84 # Key: T | t + KEY_U = 85 # Key: U | u + KEY_V = 86 # Key: V | v + KEY_W = 87 # Key: W | w + KEY_X = 88 # Key: X | x + KEY_Y = 89 # Key: Y | y + KEY_Z = 90 # Key: Z | z + KEY_LEFT_BRACKET = 91 # Key: [ + KEY_BACKSLASH = 92 # Key: '\' + KEY_RIGHT_BRACKET = 93 # Key: ] + KEY_GRAVE = 96 # Key: ` + KEY_ESCAPE = 256 # Key: Esc + KEY_ENTER = 257 # Key: Enter + KEY_TAB = 258 # Key: Tab + KEY_BACKSPACE = 259 # Key: Backspace + KEY_INSERT = 260 # Key: Ins + KEY_DELETE = 261 # Key: Del + KEY_RIGHT = 262 # Key: Cursor right + KEY_LEFT = 263 # Key: Cursor left + KEY_DOWN = 264 # Key: Cursor down + KEY_UP = 265 # Key: Cursor up + KEY_PAGE_UP = 266 # Key: Page up + KEY_PAGE_DOWN = 267 # Key: Page down + KEY_HOME = 268 # Key: Home + KEY_END = 269 # Key: End + KEY_CAPS_LOCK = 280 # Key: Caps lock + KEY_SCROLL_LOCK = 281 # Key: Scroll down + KEY_NUM_LOCK = 282 # Key: Num lock + KEY_PRINT_SCREEN = 283 # Key: Print screen + KEY_PAUSE = 284 # Key: Pause + KEY_F1 = 290 # Key: F1 + KEY_F2 = 291 # Key: F2 + KEY_F3 = 292 # Key: F3 + KEY_F4 = 293 # Key: F4 + KEY_F5 = 294 # Key: F5 + KEY_F6 = 295 # Key: F6 + KEY_F7 = 296 # Key: F7 + KEY_F8 = 297 # Key: F8 + KEY_F9 = 298 # Key: F9 + KEY_F10 = 299 # Key: F10 + KEY_F11 = 300 # Key: F11 + KEY_F12 = 301 # Key: F12 + KEY_KP_0 = 320 # Key: Keypad 0 + KEY_KP_1 = 321 # Key: Keypad 1 + KEY_KP_2 = 322 # Key: Keypad 2 + KEY_KP_3 = 323 # Key: Keypad 3 + KEY_KP_4 = 324 # Key: Keypad 4 + KEY_KP_5 = 325 # Key: Keypad 5 + KEY_KP_6 = 326 # Key: Keypad 6 + KEY_KP_7 = 327 # Key: Keypad 7 + KEY_KP_8 = 328 # Key: Keypad 8 + KEY_KP_9 = 329 # Key: Keypad 9 + KEY_KP_DECIMAL = 330 # Key: Keypad . + KEY_KP_DIVIDE = 331 # Key: Keypad / + KEY_KP_MULTIPLY = 332 # Key: Keypad * + KEY_KP_SUBTRACT = 333 # Key: Keypad - + KEY_KP_ADD = 334 # Key: Keypad + + KEY_KP_ENTER = 335 # Key: Keypad Enter + KEY_KP_EQUAL = 336 # Key: Keypad = + KEY_LEFT_SHIFT = 340 # Key: Shift left + KEY_LEFT_CONTROL = 341 # Key: Control left + KEY_LEFT_ALT = 342 # Key: Alt left + KEY_LEFT_SUPER = 343 # Key: Super left + KEY_RIGHT_SHIFT = 344 # Key: Shift right + KEY_RIGHT_CONTROL = 345 # Key: Control right + KEY_RIGHT_ALT = 346 # Key: Alt right + KEY_RIGHT_SUPER = 347 # Key: Super right + KEY_KB_MENU = 348 # Key: KB menu +converter KeyboardKey2int32* (self: KeyboardKey): int32 = self.int32 +# Add backwards compatibility support for deprecated names +template MOUSE_LEFT_BUTTON*(): auto = MOUSE_BUTTON_LEFT +template MOUSE_RIGHT_BUTTON*(): auto = MOUSE_BUTTON_RIGHT +template MOUSE_MIDDLE_BUTTON*(): auto = MOUSE_BUTTON_MIDDLE +# Mouse buttons +type MouseButton* = enum + MOUSE_BUTTON_LEFT = 0 # Mouse button left + MOUSE_BUTTON_RIGHT = 1 # Mouse button right + MOUSE_BUTTON_MIDDLE = 2 # Mouse button middle (pressed wheel) + MOUSE_BUTTON_SIDE = 3 # Mouse button side (advanced mouse device) + MOUSE_BUTTON_EXTRA = 4 # Mouse button extra (advanced mouse device) + MOUSE_BUTTON_FORWARD = 5 # Mouse button fordward (advanced mouse device) + MOUSE_BUTTON_BACK = 6 # Mouse button back (advanced mouse device) +converter MouseButton2int32* (self: MouseButton): int32 = self.int32 +# Mouse cursor +type MouseCursor* = enum + MOUSE_CURSOR_DEFAULT = 0 # Default pointer shape + MOUSE_CURSOR_ARROW = 1 # Arrow shape + MOUSE_CURSOR_IBEAM = 2 # Text writing cursor shape + MOUSE_CURSOR_CROSSHAIR = 3 # Cross shape + MOUSE_CURSOR_POINTING_HAND = 4 # Pointing hand cursor + MOUSE_CURSOR_RESIZE_EW = 5 # Horizontal resize/move arrow shape + MOUSE_CURSOR_RESIZE_NS = 6 # Vertical resize/move arrow shape + MOUSE_CURSOR_RESIZE_NWSE = 7 # Top-left to bottom-right diagonal resize/move arrow shape + MOUSE_CURSOR_RESIZE_NESW = 8 # The top-right to bottom-left diagonal resize/move arrow shape + MOUSE_CURSOR_RESIZE_ALL = 9 # The omni-directional resize/move cursor shape + MOUSE_CURSOR_NOT_ALLOWED = 10 # The operation-not-allowed shape +converter MouseCursor2int32* (self: MouseCursor): int32 = self.int32 +# Gamepad buttons +type GamepadButton* = enum + GAMEPAD_BUTTON_UNKNOWN = 0 # Unknown button, just for error checking + GAMEPAD_BUTTON_LEFT_FACE_UP # Gamepad left DPAD up button + GAMEPAD_BUTTON_LEFT_FACE_RIGHT # Gamepad left DPAD right button + GAMEPAD_BUTTON_LEFT_FACE_DOWN # Gamepad left DPAD down button + GAMEPAD_BUTTON_LEFT_FACE_LEFT # Gamepad left DPAD left button + GAMEPAD_BUTTON_RIGHT_FACE_UP # Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) + GAMEPAD_BUTTON_RIGHT_FACE_RIGHT # Gamepad right button right (i.e. PS3: Square, Xbox: X) + GAMEPAD_BUTTON_RIGHT_FACE_DOWN # Gamepad right button down (i.e. PS3: Cross, Xbox: A) + GAMEPAD_BUTTON_RIGHT_FACE_LEFT # Gamepad right button left (i.e. PS3: Circle, Xbox: B) + GAMEPAD_BUTTON_LEFT_TRIGGER_1 # Gamepad top/back trigger left (first), it could be a trailing button + GAMEPAD_BUTTON_LEFT_TRIGGER_2 # Gamepad top/back trigger left (second), it could be a trailing button + GAMEPAD_BUTTON_RIGHT_TRIGGER_1 # Gamepad top/back trigger right (one), it could be a trailing button + GAMEPAD_BUTTON_RIGHT_TRIGGER_2 # Gamepad top/back trigger right (second), it could be a trailing button + GAMEPAD_BUTTON_MIDDLE_LEFT # Gamepad center buttons, left one (i.e. PS3: Select) + GAMEPAD_BUTTON_MIDDLE # Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) + GAMEPAD_BUTTON_MIDDLE_RIGHT # Gamepad center buttons, right one (i.e. PS3: Start) + GAMEPAD_BUTTON_LEFT_THUMB # Gamepad joystick pressed button left + GAMEPAD_BUTTON_RIGHT_THUMB # Gamepad joystick pressed button right +converter GamepadButton2int32* (self: GamepadButton): int32 = self.int32 +# Gamepad axis +type GamepadAxis* = enum + GAMEPAD_AXIS_LEFT_X = 0 # Gamepad left stick X axis + GAMEPAD_AXIS_LEFT_Y = 1 # Gamepad left stick Y axis + GAMEPAD_AXIS_RIGHT_X = 2 # Gamepad right stick X axis + GAMEPAD_AXIS_RIGHT_Y = 3 # Gamepad right stick Y axis + GAMEPAD_AXIS_LEFT_TRIGGER = 4 # Gamepad back trigger left, pressure level: [1..-1] + GAMEPAD_AXIS_RIGHT_TRIGGER = 5 # Gamepad back trigger right, pressure level: [1..-1] +converter GamepadAxis2int32* (self: GamepadAxis): int32 = self.int32 +# Material map index +type MaterialMapIndex* = enum + MATERIAL_MAP_ALBEDO = 0 # Albedo material (same as: MATERIAL_MAP_DIFFUSE) + MATERIAL_MAP_METALNESS # Metalness material (same as: MATERIAL_MAP_SPECULAR) + MATERIAL_MAP_NORMAL # Normal material + MATERIAL_MAP_ROUGHNESS # Roughness material + MATERIAL_MAP_OCCLUSION # Ambient occlusion material + MATERIAL_MAP_EMISSION # Emission material + MATERIAL_MAP_HEIGHT # Heightmap material + MATERIAL_MAP_CUBEMAP # Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_IRRADIANCE # Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_PREFILTER # Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_BRDG # Brdg material +converter MaterialMapIndex2int32* (self: MaterialMapIndex): int32 = self.int32 +template MATERIAL_MAP_DIFFUSE*(): auto = MATERIAL_MAP_ALBEDO +template MATERIAL_MAP_SPECULAR*(): auto = MATERIAL_MAP_METALNESS +# Shader location index +type ShaderLocationIndex* = enum + SHADER_LOC_VERTEX_POSITION = 0 # Shader location: vertex attribute: position + SHADER_LOC_VERTEX_TEXCOORD01 # Shader location: vertex attribute: texcoord01 + SHADER_LOC_VERTEX_TEXCOORD02 # Shader location: vertex attribute: texcoord02 + SHADER_LOC_VERTEX_NORMAL # Shader location: vertex attribute: normal + SHADER_LOC_VERTEX_TANGENT # Shader location: vertex attribute: tangent + SHADER_LOC_VERTEX_COLOR # Shader location: vertex attribute: color + SHADER_LOC_MATRIX_MVP # Shader location: matrix uniform: model-view-projection + SHADER_LOC_MATRIX_VIEW # Shader location: matrix uniform: view (camera transform) + SHADER_LOC_MATRIX_PROJECTION # Shader location: matrix uniform: projection + SHADER_LOC_MATRIX_MODEL # Shader location: matrix uniform: model (transform) + SHADER_LOC_MATRIX_NORMAL # Shader location: matrix uniform: normal + SHADER_LOC_VECTOR_VIEW # Shader location: vector uniform: view + SHADER_LOC_COLOR_DIFFUSE # Shader location: vector uniform: diffuse color + SHADER_LOC_COLOR_SPECULAR # Shader location: vector uniform: specular color + SHADER_LOC_COLOR_AMBIENT # Shader location: vector uniform: ambient color + SHADER_LOC_MAP_ALBEDO # Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) + SHADER_LOC_MAP_METALNESS # Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) + SHADER_LOC_MAP_NORMAL # Shader location: sampler2d texture: normal + SHADER_LOC_MAP_ROUGHNESS # Shader location: sampler2d texture: roughness + SHADER_LOC_MAP_OCCLUSION # Shader location: sampler2d texture: occlusion + SHADER_LOC_MAP_EMISSION # Shader location: sampler2d texture: emission + SHADER_LOC_MAP_HEIGHT # Shader location: sampler2d texture: height + SHADER_LOC_MAP_CUBEMAP # Shader location: samplerCube texture: cubemap + SHADER_LOC_MAP_IRRADIANCE # Shader location: samplerCube texture: irradiance + SHADER_LOC_MAP_PREFILTER # Shader location: samplerCube texture: prefilter + SHADER_LOC_MAP_BRDF # Shader location: sampler2d texture: brdf +converter ShaderLocationIndex2int32* (self: ShaderLocationIndex): int32 = self.int32 +template SHADER_LOC_MAP_DIFFUSE*(): auto = SHADER_LOC_MAP_ALBEDO +template SHADER_LOC_MAP_SPECULAR*(): auto = SHADER_LOC_MAP_METALNESS +# Shader uniform data type +type ShaderUniformDataType* = enum + SHADER_UNIFORM_FLOAT = 0 # Shader uniform type: float + SHADER_UNIFORM_VEC2 # Shader uniform type: vec2 (2 float) + SHADER_UNIFORM_VEC3 # Shader uniform type: vec3 (3 float) + SHADER_UNIFORM_VEC4 # Shader uniform type: vec4 (4 float) + SHADER_UNIFORM_INT # Shader uniform type: int + SHADER_UNIFORM_IVEC2 # Shader uniform type: ivec2 (2 int) + SHADER_UNIFORM_IVEC3 # Shader uniform type: ivec3 (3 int) + SHADER_UNIFORM_IVEC4 # Shader uniform type: ivec4 (4 int) + SHADER_UNIFORM_SAMPLER2D # Shader uniform type: sampler2d +converter ShaderUniformDataType2int32* (self: ShaderUniformDataType): int32 = self.int32 +# Shader attribute data types +type ShaderAttributeDataType* = enum + SHADER_ATTRIB_FLOAT = 0 # Shader attribute type: float + SHADER_ATTRIB_VEC2 # Shader attribute type: vec2 (2 float) + SHADER_ATTRIB_VEC3 # Shader attribute type: vec3 (3 float) + SHADER_ATTRIB_VEC4 # Shader attribute type: vec4 (4 float) +converter ShaderAttributeDataType2int32* (self: ShaderAttributeDataType): int32 = self.int32 +# Pixel formats +# NOTE: Support depends on OpenGL version and platform +type PixelFormat* = enum + PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 # 8 bit per pixel (no alpha) + PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA # 8*2 bpp (2 channels) + PIXELFORMAT_UNCOMPRESSED_R5G6B5 # 16 bpp + PIXELFORMAT_UNCOMPRESSED_R8G8B8 # 24 bpp + PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 # 16 bpp (1 bit alpha) + PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 # 16 bpp (4 bit alpha) + PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 # 32 bpp + PIXELFORMAT_UNCOMPRESSED_R32 # 32 bpp (1 channel - float) + PIXELFORMAT_UNCOMPRESSED_R32G32B32 # 32*3 bpp (3 channels - float) + PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 # 32*4 bpp (4 channels - float) + PIXELFORMAT_COMPRESSED_DXT1_RGB # 4 bpp (no alpha) + PIXELFORMAT_COMPRESSED_DXT1_RGBA # 4 bpp (1 bit alpha) + PIXELFORMAT_COMPRESSED_DXT3_RGBA # 8 bpp + PIXELFORMAT_COMPRESSED_DXT5_RGBA # 8 bpp + PIXELFORMAT_COMPRESSED_ETC1_RGB # 4 bpp + PIXELFORMAT_COMPRESSED_ETC2_RGB # 4 bpp + PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA # 8 bpp + PIXELFORMAT_COMPRESSED_PVRT_RGB # 4 bpp + PIXELFORMAT_COMPRESSED_PVRT_RGBA # 4 bpp + PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA # 8 bpp + PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA # 2 bpp +converter PixelFormat2int32* (self: PixelFormat): int32 = self.int32 +# Texture parameters: filter mode +# NOTE 1: Filtering considers mipmaps if available in the texture +# NOTE 2: Filter is accordingly set for minification and magnification +type TextureFilter* = enum + TEXTURE_FILTER_POINT = 0 # No filter, just pixel aproximation + TEXTURE_FILTER_BILINEAR # Linear filtering + TEXTURE_FILTER_TRILINEAR # Trilinear filtering (linear with mipmaps) + TEXTURE_FILTER_ANISOTROPIC_4X # Anisotropic filtering 4x + TEXTURE_FILTER_ANISOTROPIC_8X # Anisotropic filtering 8x + TEXTURE_FILTER_ANISOTROPIC_16X # Anisotropic filtering 16x +converter TextureFilter2int32* (self: TextureFilter): int32 = self.int32 +# Texture parameters: wrap mode +type TextureWrap* = enum + TEXTURE_WRAP_REPEAT = 0 # Repeats texture in tiled mode + TEXTURE_WRAP_CLAMP # Clamps texture to edge pixel in tiled mode + TEXTURE_WRAP_MIRROR_REPEAT # Mirrors and repeats the texture in tiled mode + TEXTURE_WRAP_MIRROR_CLAMP # Mirrors and clamps to border the texture in tiled mode +converter TextureWrap2int32* (self: TextureWrap): int32 = self.int32 +# Cubemap layouts +type CubemapLayout* = enum + CUBEMAP_LAYOUT_AUTO_DETECT = 0 # Automatically detect layout type + CUBEMAP_LAYOUT_LINE_VERTICAL # Layout is defined by a vertical line with faces + CUBEMAP_LAYOUT_LINE_HORIZONTAL # Layout is defined by an horizontal line with faces + CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR # Layout is defined by a 3x4 cross with cubemap faces + CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE # Layout is defined by a 4x3 cross with cubemap faces + CUBEMAP_LAYOUT_PANORAMA # Layout is defined by a panorama image (equirectangular map) +converter CubemapLayout2int32* (self: CubemapLayout): int32 = self.int32 +# Font type, defines generation method +type FontType* = enum + FONT_DEFAULT = 0 # Default font generation, anti-aliased + FONT_BITMAP # Bitmap font generation, no anti-aliasing + FONT_SDF # SDF font generation, requires external shader +converter FontType2int32* (self: FontType): int32 = self.int32 +# Color blending modes (pre-defined) +type BlendMode* = enum + BLEND_ALPHA = 0 # Blend textures considering alpha (default) + BLEND_ADDITIVE # Blend textures adding colors + BLEND_MULTIPLIED # Blend textures multiplying colors + BLEND_ADD_COLORS # Blend textures adding colors (alternative) + BLEND_SUBTRACT_COLORS # Blend textures subtracting colors (alternative) + BLEND_CUSTOM # Belnd textures using custom src/dst factors (use rlSetBlendMode()) +converter BlendMode2int32* (self: BlendMode): int32 = self.int32 +# Gestures +# NOTE: It could be used as flags to enable only some gestures +type Gesture* = enum + GESTURE_NONE = 0 # No gesture + GESTURE_TAP = 1 # Tap gesture + GESTURE_DOUBLETAP = 2 # Double tap gesture + GESTURE_HOLD = 4 # Hold gesture + GESTURE_DRAG = 8 # Drag gesture + GESTURE_SWIPE_RIGHT = 16 # Swipe right gesture + GESTURE_SWIPE_LEFT = 32 # Swipe left gesture + GESTURE_SWIPE_UP = 64 # Swipe up gesture + GESTURE_SWIPE_DOWN = 128 # Swipe down gesture + GESTURE_PINCH_IN = 256 # Pinch in gesture + GESTURE_PINCH_OUT = 512 # Pinch out gesture +converter Gesture2int32* (self: Gesture): int32 = self.int32 +# Camera system modes +type CameraMode* = enum + CAMERA_CUSTOM = 0 # Custom camera + CAMERA_FREE # Free camera + CAMERA_ORBITAL # Orbital camera + CAMERA_FIRST_PERSON # First person camera + CAMERA_THIRD_PERSON # Third person camera +converter CameraMode2int32* (self: CameraMode): int32 = self.int32 +# Camera projection +type CameraProjection* = enum + CAMERA_PERSPECTIVE = 0 # Perspective projection + CAMERA_ORTHOGRAPHIC # Orthographic projection +converter CameraProjection2int32* (self: CameraProjection): int32 = self.int32 +# N-patch layout +type NPatchLayout* = enum + NPATCH_NINE_PATCH = 0 # Npatch layout: 3x3 tiles + NPATCH_THREE_PATCH_VERTICAL # Npatch layout: 1x3 tiles + NPATCH_THREE_PATCH_HORIZONTAL # Npatch layout: 3x1 tiles +converter NPatchLayout2int32* (self: NPatchLayout): int32 = self.int32 +# Callbacks to hook some internal functions +# WARNING: This callbacks are intended for advance users +type TraceLogCallback* = proc() +type LoadFileDataCallback* = proc(): uint8 +type SaveFileDataCallback* = proc(): bool +type LoadFileTextCallback* = proc(): char +type SaveFileTextCallback* = proc(): bool +# ------------------------------------------------------------------------------------ +# Global Variables Definition +# ------------------------------------------------------------------------------------ +# It's lonely here... +# ------------------------------------------------------------------------------------ +# Window and Graphics Device Functions (Module: core) +# ------------------------------------------------------------------------------------ +# Window-related functions +proc InitWindow*(width: int32; height: int32; title: cstring) {.RLAPI, importc: "InitWindow".} # Initialize window and OpenGL context +proc WindowShouldClose*(): bool {.RLAPI, importc: "WindowShouldClose".} # Check if KEY_ESCAPE pressed or Close icon pressed +proc CloseWindow*() {.RLAPI, importc: "CloseWindow".} # Close window and unload OpenGL context +proc IsWindowReady*(): bool {.RLAPI, importc: "IsWindowReady".} # Check if window has been initialized successfully +proc IsWindowFullscreen*(): bool {.RLAPI, importc: "IsWindowFullscreen".} # Check if window is currently fullscreen +proc IsWindowHidden*(): bool {.RLAPI, importc: "IsWindowHidden".} # Check if window is currently hidden (only PLATFORM_DESKTOP) +proc IsWindowMinimized*(): bool {.RLAPI, importc: "IsWindowMinimized".} # Check if window is currently minimized (only PLATFORM_DESKTOP) +proc IsWindowMaximized*(): bool {.RLAPI, importc: "IsWindowMaximized".} # Check if window is currently maximized (only PLATFORM_DESKTOP) +proc IsWindowFocused*(): bool {.RLAPI, importc: "IsWindowFocused".} # Check if window is currently focused (only PLATFORM_DESKTOP) +proc IsWindowResized*(): bool {.RLAPI, importc: "IsWindowResized".} # Check if window has been resized last frame +proc IsWindowState*(flag: uint32): bool {.RLAPI, importc: "IsWindowState".} # Check if one specific window flag is enabled +proc SetWindowState*(flags: uint32) {.RLAPI, importc: "SetWindowState".} # Set window configuration state using flags +proc ClearWindowState*(flags: uint32) {.RLAPI, importc: "ClearWindowState".} # Clear window configuration state flags +proc ToggleFullscreen*() {.RLAPI, importc: "ToggleFullscreen".} # Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) +proc MaximizeWindow*() {.RLAPI, importc: "MaximizeWindow".} # Set window state: maximized, if resizable (only PLATFORM_DESKTOP) +proc MinimizeWindow*() {.RLAPI, importc: "MinimizeWindow".} # Set window state: minimized, if resizable (only PLATFORM_DESKTOP) +proc RestoreWindow*() {.RLAPI, importc: "RestoreWindow".} # Set window state: not minimized/maximized (only PLATFORM_DESKTOP) +proc SetWindowIcon*(image: Image) {.RLAPI, importc: "SetWindowIcon".} # Set icon for window (only PLATFORM_DESKTOP) +proc SetWindowTitle*(title: cstring) {.RLAPI, importc: "SetWindowTitle".} # Set title for window (only PLATFORM_DESKTOP) +proc SetWindowPosition*(x: int32; y: int32) {.RLAPI, importc: "SetWindowPosition".} # Set window position on screen (only PLATFORM_DESKTOP) +proc SetWindowMonitor*(monitor: int32) {.RLAPI, importc: "SetWindowMonitor".} # Set monitor for the current window (fullscreen mode) +proc SetWindowMinSize*(width: int32; height: int32) {.RLAPI, importc: "SetWindowMinSize".} # Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) +proc SetWindowSize*(width: int32; height: int32) {.RLAPI, importc: "SetWindowSize".} # Set window dimensions +proc GetWindowHandle*(): pointer {.RLAPI, importc: "GetWindowHandle".} # Get native window handle +proc GetScreenWidth*(): int32 {.RLAPI, importc: "GetScreenWidth".} # Get current screen width +proc GetScreenHeight*(): int32 {.RLAPI, importc: "GetScreenHeight".} # Get current screen height +proc GetMonitorCount*(): int32 {.RLAPI, importc: "GetMonitorCount".} # Get number of connected monitors +proc GetCurrentMonitor*(): int32 {.RLAPI, importc: "GetCurrentMonitor".} # Get current connected monitor +proc GetMonitorPosition*(monitor: int32): Vector2 {.RLAPI, importc: "GetMonitorPosition".} # Get specified monitor position +proc GetMonitorWidth*(monitor: int32): int32 {.RLAPI, importc: "GetMonitorWidth".} # Get specified monitor width (max available by monitor) +proc GetMonitorHeight*(monitor: int32): int32 {.RLAPI, importc: "GetMonitorHeight".} # Get specified monitor height (max available by monitor) +proc GetMonitorPhysicalWidth*(monitor: int32): int32 {.RLAPI, importc: "GetMonitorPhysicalWidth".} # Get specified monitor physical width in millimetres +proc GetMonitorPhysicalHeight*(monitor: int32): int32 {.RLAPI, importc: "GetMonitorPhysicalHeight".} # Get specified monitor physical height in millimetres +proc GetMonitorRefreshRate*(monitor: int32): int32 {.RLAPI, importc: "GetMonitorRefreshRate".} # Get specified monitor refresh rate +proc GetWindowPosition*(): Vector2 {.RLAPI, importc: "GetWindowPosition".} # Get window position XY on monitor +proc GetWindowScaleDPI*(): Vector2 {.RLAPI, importc: "GetWindowScaleDPI".} # Get window scale DPI factor +proc GetMonitorName*(monitor: int32): cstring {.RLAPI, importc: "GetMonitorName".} # Get the human-readable, UTF-8 encoded name of the primary monitor +proc SetClipboardText*(text: cstring) {.RLAPI, importc: "SetClipboardText".} # Set clipboard text content +proc GetClipboardText*(): cstring {.RLAPI, importc: "GetClipboardText".} # Get clipboard text content +# Custom frame control functions +# NOTE: Those functions are intended for advance users that want full control over the frame processing +# By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents() +# To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL +proc SwapScreenBuffer*() {.RLAPI, importc: "SwapScreenBuffer".} # Swap back buffer with front buffer (screen drawing) +proc PollInputEvents*() {.RLAPI, importc: "PollInputEvents".} # Register all input events +proc WaitTime*(ms: float32) {.RLAPI, importc: "WaitTime".} # Wait for some milliseconds (halt program execution) +# Cursor-related functions +proc ShowCursor*() {.RLAPI, importc: "ShowCursor".} # Shows cursor +proc HideCursor*() {.RLAPI, importc: "HideCursor".} # Hides cursor +proc IsCursorHidden*(): bool {.RLAPI, importc: "IsCursorHidden".} # Check if cursor is not visible +proc EnableCursor*() {.RLAPI, importc: "EnableCursor".} # Enables cursor (unlock cursor) +proc DisableCursor*() {.RLAPI, importc: "DisableCursor".} # Disables cursor (lock cursor) +proc IsCursorOnScreen*(): bool {.RLAPI, importc: "IsCursorOnScreen".} # Check if cursor is on the screen +# Drawing-related functions +proc ClearBackground*(color: Color) {.RLAPI, importc: "ClearBackground".} # Set background color (framebuffer clear color) +proc BeginDrawing*() {.RLAPI, importc: "BeginDrawing".} # Setup canvas (framebuffer) to start drawing +proc EndDrawing*() {.RLAPI, importc: "EndDrawing".} # End canvas drawing and swap buffers (double buffering) +proc BeginMode2D*(camera: Camera2D) {.RLAPI, importc: "BeginMode2D".} # Begin 2D mode with custom camera (2D) +proc EndMode2D*() {.RLAPI, importc: "EndMode2D".} # Ends 2D mode with custom camera +proc BeginMode3D*(camera: Camera3D) {.RLAPI, importc: "BeginMode3D".} # Begin 3D mode with custom camera (3D) +proc EndMode3D*() {.RLAPI, importc: "EndMode3D".} # Ends 3D mode and returns to default 2D orthographic mode +proc BeginTextureMode*(target: RenderTexture2D) {.RLAPI, importc: "BeginTextureMode".} # Begin drawing to render texture +proc EndTextureMode*() {.RLAPI, importc: "EndTextureMode".} # Ends drawing to render texture +proc BeginShaderMode*(shader: Shader) {.RLAPI, importc: "BeginShaderMode".} # Begin custom shader drawing +proc EndShaderMode*() {.RLAPI, importc: "EndShaderMode".} # End custom shader drawing (use default shader) +proc BeginBlendMode*(mode: int32) {.RLAPI, importc: "BeginBlendMode".} # Begin blending mode (alpha, additive, multiplied, subtract, custom) +proc EndBlendMode*() {.RLAPI, importc: "EndBlendMode".} # End blending mode (reset to default: alpha blending) +proc BeginScissorMode*(x: int32; y: int32; width: int32; height: int32) {.RLAPI, importc: "BeginScissorMode".} # Begin scissor mode (define screen area for following drawing) +proc EndScissorMode*() {.RLAPI, importc: "EndScissorMode".} # End scissor mode +proc BeginVrStereoMode*(config: VrStereoConfig) {.RLAPI, importc: "BeginVrStereoMode".} # Begin stereo rendering (requires VR simulator) +proc EndVrStereoMode*() {.RLAPI, importc: "EndVrStereoMode".} # End stereo rendering (requires VR simulator) +# VR stereo config functions for VR simulator +proc LoadVrStereoConfig*(device: VrDeviceInfo): VrStereoConfig {.RLAPI, importc: "LoadVrStereoConfig".} # Load VR stereo config for VR simulator device parameters +proc UnloadVrStereoConfig*(config: VrStereoConfig) {.RLAPI, importc: "UnloadVrStereoConfig".} # Unload VR stereo config +# Shader management functions +# NOTE: Shader functionality is not available on OpenGL 1.1 +proc LoadShader*(vsFileName: cstring; fsFileName: cstring): Shader {.RLAPI, importc: "LoadShader".} # Load shader from files and bind default locations +proc LoadShaderFromMemory*(vsCode: cstring; fsCode: cstring): Shader {.RLAPI, importc: "LoadShaderFromMemory".} # Load shader from code strings and bind default locations +proc GetShaderLocation*(shader: Shader; uniformName: cstring): int32 {.RLAPI, importc: "GetShaderLocation".} # Get shader uniform location +proc GetShaderLocationAttrib*(shader: Shader; attribName: cstring): int32 {.RLAPI, importc: "GetShaderLocationAttrib".} # Get shader attribute location +proc SetShaderValue*(shader: Shader; locIndex: int32; value: pointer; uniformType: int32) {.RLAPI, importc: "SetShaderValue".} # Set shader uniform value +proc SetShaderValueV*(shader: Shader; locIndex: int32; value: pointer; uniformType: int32; count: int32) {.RLAPI, importc: "SetShaderValueV".} # Set shader uniform value vector +proc SetShaderValueMatrix*(shader: Shader; locIndex: int32; mat: Matrix) {.RLAPI, importc: "SetShaderValueMatrix".} # Set shader uniform value (matrix 4x4) +proc SetShaderValueTexture*(shader: Shader; locIndex: int32; texture: Texture2D) {.RLAPI, importc: "SetShaderValueTexture".} # Set shader uniform value for texture (sampler2d) +proc UnloadShader*(shader: Shader) {.RLAPI, importc: "UnloadShader".} # Unload shader from GPU memory (VRAM) +# Screen-space-related functions +proc GetMouseRay*(mousePosition: Vector2; camera: Camera): Ray {.RLAPI, importc: "GetMouseRay".} # Get a ray trace from mouse position +proc GetCameraMatrix*(camera: Camera): Matrix {.RLAPI, importc: "GetCameraMatrix".} # Get camera transform matrix (view matrix) +proc GetCameraMatrix2D*(camera: Camera2D): Matrix {.RLAPI, importc: "GetCameraMatrix2D".} # Get camera 2d transform matrix +proc GetWorldToScreen*(position: Vector3; camera: Camera): Vector2 {.RLAPI, importc: "GetWorldToScreen".} # Get the screen space position for a 3d world space position +proc GetWorldToScreenEx*(position: Vector3; camera: Camera; width: int32; height: int32): Vector2 {.RLAPI, importc: "GetWorldToScreenEx".} # Get size position for a 3d world space position +proc GetWorldToScreen2D*(position: Vector2; camera: Camera2D): Vector2 {.RLAPI, importc: "GetWorldToScreen2D".} # Get the screen space position for a 2d camera world space position +proc GetScreenToWorld2D*(position: Vector2; camera: Camera2D): Vector2 {.RLAPI, importc: "GetScreenToWorld2D".} # Get the world space position for a 2d camera screen space position +# Timing-related functions +proc SetTargetFPS*(fps: int32) {.RLAPI, importc: "SetTargetFPS".} # Set target FPS (maximum) +proc GetFPS*(): int32 {.RLAPI, importc: "GetFPS".} # Get current FPS +proc GetFrameTime*(): float32 {.RLAPI, importc: "GetFrameTime".} # Get time in seconds for last frame drawn (delta time) +proc GetTime*(): float64 {.RLAPI, importc: "GetTime".} # Get elapsed time in seconds since InitWindow() +# Misc. functions +proc GetRandomValue*(min: int32; max: int32): int32 {.RLAPI, importc: "GetRandomValue".} # Get a random value between min and max (both included) +proc TakeScreenshot*(fileName: cstring) {.RLAPI, importc: "TakeScreenshot".} # Takes a screenshot of current screen (filename extension defines format) +proc SetConfigFlags*(flags: uint32) {.RLAPI, importc: "SetConfigFlags".} # Setup init configuration flags (view FLAGS) +proc TraceLog*(logLevel: int32; text: cstring) {.RLAPI, varargs, importc: "TraceLog".} # Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +proc SetTraceLogLevel*(logLevel: int32) {.RLAPI, importc: "SetTraceLogLevel".} # Set the current threshold (minimum) log level +proc MemAlloc*(size: int32): pointer {.RLAPI, importc: "MemAlloc".} # Internal memory allocator +proc MemRealloc*(ptrx: pointer; size: int32): pointer {.RLAPI, importc: "MemRealloc".} # Internal memory reallocator +proc MemFree*(ptrx: pointer) {.RLAPI, importc: "MemFree".} # Internal memory free +# Set custom callbacks +# WARNING: Callbacks setup is intended for advance users +proc SetTraceLogCallback*(callback: TraceLogCallback) {.RLAPI, importc: "SetTraceLogCallback".} # Set custom trace log +proc SetLoadFileDataCallback*(callback: LoadFileDataCallback) {.RLAPI, importc: "SetLoadFileDataCallback".} # Set custom file binary data loader +proc SetSaveFileDataCallback*(callback: SaveFileDataCallback) {.RLAPI, importc: "SetSaveFileDataCallback".} # Set custom file binary data saver +proc SetLoadFileTextCallback*(callback: LoadFileTextCallback) {.RLAPI, importc: "SetLoadFileTextCallback".} # Set custom file text data loader +proc SetSaveFileTextCallback*(callback: SaveFileTextCallback) {.RLAPI, importc: "SetSaveFileTextCallback".} # Set custom file text data saver +# Files management functions +proc LoadFileData*(fileName: cstring; bytesRead: uint32): uint8 {.RLAPI, importc: "LoadFileData".} # Load file data as byte array (read) +proc UnloadFileData*(data: uint8) {.RLAPI, importc: "UnloadFileData".} # Unload file data allocated by LoadFileData() +proc SaveFileData*(fileName: cstring; data: pointer; bytesToWrite: uint32): bool {.RLAPI, importc: "SaveFileData".} # Save data to file from byte array (write), returns true on success +proc LoadFileText*(fileName: cstring): ptr char {.RLAPI, importc: "LoadFileText".} # Load text data from file (read), returns a '\0' terminated string +proc UnloadFileText*(text: ptr char) {.RLAPI, importc: "UnloadFileText".} # Unload file text data allocated by LoadFileText() +proc SaveFileText*(fileName: cstring; text: ptr char): bool {.RLAPI, importc: "SaveFileText".} # Save text data to file (write), string must be '\0' terminated, returns true on success +proc FileExists*(fileName: cstring): bool {.RLAPI, importc: "FileExists".} # Check if file exists +proc DirectoryExists*(dirPath: cstring): bool {.RLAPI, importc: "DirectoryExists".} # Check if a directory path exists +proc IsFileExtension*(fileName: cstring; ext: cstring): bool {.RLAPI, importc: "IsFileExtension".} # Check file extension (including point: .png, .wav) +proc GetFileExtension*(fileName: cstring): cstring {.RLAPI, importc: "GetFileExtension".} # Get pointer to extension for a filename string (includes dot: '.png') +proc GetFileName*(filePath: cstring): cstring {.RLAPI, importc: "GetFileName".} # Get pointer to filename for a path string +proc GetFileNameWithoutExt*(filePath: cstring): cstring {.RLAPI, importc: "GetFileNameWithoutExt".} # Get filename string without extension (uses static string) +proc GetDirectoryPath*(filePath: cstring): cstring {.RLAPI, importc: "GetDirectoryPath".} # Get full path for a given fileName with path (uses static string) +proc GetPrevDirectoryPath*(dirPath: cstring): cstring {.RLAPI, importc: "GetPrevDirectoryPath".} # Get previous directory path for a given path (uses static string) +proc GetWorkingDirectory*(): cstring {.RLAPI, importc: "GetWorkingDirectory".} # Get current working directory (uses static string) +proc GetDirectoryFiles*(dirPath: cstring; count: pointer): cstringArray {.RLAPI, importc: "GetDirectoryFiles".} # Get filenames in a directory path (memory should be freed) +proc ClearDirectoryFiles*() {.RLAPI, importc: "ClearDirectoryFiles".} # Clear directory files paths buffers (free memory) +proc ChangeDirectory*(dir: cstring): bool {.RLAPI, importc: "ChangeDirectory".} # Change working directory, return true on success +proc IsFileDropped*(): bool {.RLAPI, importc: "IsFileDropped".} # Check if a file has been dropped into window +proc GetDroppedFiles*(count: pointer): cstringArray {.RLAPI, importc: "GetDroppedFiles".} # Get dropped files names (memory should be freed) +proc ClearDroppedFiles*() {.RLAPI, importc: "ClearDroppedFiles".} # Clear dropped files paths buffer (free memory) +proc GetFileModTime*(fileName: cstring): int32 {.RLAPI, importc: "GetFileModTime".} # Get file modification time (last write time) +proc CompressData*(data: uint8; dataLength: int32; compDataLength: pointer): uint8 {.RLAPI, importc: "CompressData".} # Compress data (DEFLATE algorithm) +proc DecompressData*(compData: uint8; compDataLength: int32; dataLength: pointer): uint8 {.RLAPI, importc: "DecompressData".} # Decompress data (DEFLATE algorithm) +# Persistent storage management +proc SaveStorageValue*(position: uint32; value: int32): bool {.RLAPI, importc: "SaveStorageValue".} # Save integer value to storage file (to defined position), returns true on success +proc LoadStorageValue*(position: uint32): int32 {.RLAPI, importc: "LoadStorageValue".} # Load integer value from storage file (from defined position) +proc OpenURL*(url: cstring) {.RLAPI, importc: "OpenURL".} # Open URL with default system browser (if available) +# ------------------------------------------------------------------------------------ +# Input Handling Functions (Module: core) +# ------------------------------------------------------------------------------------ +# Input-related functions: keyboard +proc IsKeyPressed*(key: int32): bool {.RLAPI, importc: "IsKeyPressed".} # Check if a key has been pressed once +proc IsKeyDown*(key: int32): bool {.RLAPI, importc: "IsKeyDown".} # Check if a key is being pressed +proc IsKeyReleased*(key: int32): bool {.RLAPI, importc: "IsKeyReleased".} # Check if a key has been released once +proc IsKeyUp*(key: int32): bool {.RLAPI, importc: "IsKeyUp".} # Check if a key is NOT being pressed +proc SetExitKey*(key: int32) {.RLAPI, importc: "SetExitKey".} # Set a custom key to exit program (default is ESC) +proc GetKeyPressed*(): int32 {.RLAPI, importc: "GetKeyPressed".} # Get key pressed (keycode), call it multiple times for keys queued +proc GetCharPressed*(): int32 {.RLAPI, importc: "GetCharPressed".} # Get char pressed (unicode), call it multiple times for chars queued +# Input-related functions: gamepads +proc IsGamepadAvailable*(gamepad: int32): bool {.RLAPI, importc: "IsGamepadAvailable".} # Check if a gamepad is available +proc IsGamepadName*(gamepad: int32; name: cstring): bool {.RLAPI, importc: "IsGamepadName".} # Check gamepad name (if available) +proc GetGamepadName*(gamepad: int32): cstring {.RLAPI, importc: "GetGamepadName".} # Get gamepad internal name id +proc IsGamepadButtonPressed*(gamepad: int32; button: int32): bool {.RLAPI, importc: "IsGamepadButtonPressed".} # Check if a gamepad button has been pressed once +proc IsGamepadButtonDown*(gamepad: int32; button: int32): bool {.RLAPI, importc: "IsGamepadButtonDown".} # Check if a gamepad button is being pressed +proc IsGamepadButtonReleased*(gamepad: int32; button: int32): bool {.RLAPI, importc: "IsGamepadButtonReleased".} # Check if a gamepad button has been released once +proc IsGamepadButtonUp*(gamepad: int32; button: int32): bool {.RLAPI, importc: "IsGamepadButtonUp".} # Check if a gamepad button is NOT being pressed +proc GetGamepadButtonPressed*(): int32 {.RLAPI, importc: "GetGamepadButtonPressed".} # Get the last gamepad button pressed +proc GetGamepadAxisCount*(gamepad: int32): int32 {.RLAPI, importc: "GetGamepadAxisCount".} # Get gamepad axis count for a gamepad +proc GetGamepadAxisMovement*(gamepad: int32; axis: int32): float32 {.RLAPI, importc: "GetGamepadAxisMovement".} # Get axis movement value for a gamepad axis +proc SetGamepadMappings*(mappings: cstring): int32 {.RLAPI, importc: "SetGamepadMappings".} # Set internal gamepad mappings (SDL_GameControllerDB) +# Input-related functions: mouse +proc IsMouseButtonPressed*(button: int32): bool {.RLAPI, importc: "IsMouseButtonPressed".} # Check if a mouse button has been pressed once +proc IsMouseButtonDown*(button: int32): bool {.RLAPI, importc: "IsMouseButtonDown".} # Check if a mouse button is being pressed +proc IsMouseButtonReleased*(button: int32): bool {.RLAPI, importc: "IsMouseButtonReleased".} # Check if a mouse button has been released once +proc IsMouseButtonUp*(button: int32): bool {.RLAPI, importc: "IsMouseButtonUp".} # Check if a mouse button is NOT being pressed +proc GetMouseX*(): int32 {.RLAPI, importc: "GetMouseX".} # Get mouse position X +proc GetMouseY*(): int32 {.RLAPI, importc: "GetMouseY".} # Get mouse position Y +proc GetMousePosition*(): Vector2 {.RLAPI, importc: "GetMousePosition".} # Get mouse position XY +proc GetMouseDelta*(): Vector2 {.RLAPI, importc: "GetMouseDelta".} # Get mouse delta between frames +proc SetMousePosition*(x: int32; y: int32) {.RLAPI, importc: "SetMousePosition".} # Set mouse position XY +proc SetMouseOffset*(offsetX: int32; offsetY: int32) {.RLAPI, importc: "SetMouseOffset".} # Set mouse offset +proc SetMouseScale*(scaleX: float32; scaleY: float32) {.RLAPI, importc: "SetMouseScale".} # Set mouse scaling +proc GetMouseWheelMove*(): float32 {.RLAPI, importc: "GetMouseWheelMove".} # Get mouse wheel movement Y +proc SetMouseCursor*(cursor: int32) {.RLAPI, importc: "SetMouseCursor".} # Set mouse cursor +# Input-related functions: touch +proc GetTouchX*(): int32 {.RLAPI, importc: "GetTouchX".} # Get touch position X for touch point 0 (relative to screen size) +proc GetTouchY*(): int32 {.RLAPI, importc: "GetTouchY".} # Get touch position Y for touch point 0 (relative to screen size) +proc GetTouchPosition*(index: int32): Vector2 {.RLAPI, importc: "GetTouchPosition".} # Get touch position XY for a touch point index (relative to screen size) +# ------------------------------------------------------------------------------------ +# Gestures and Touch Handling Functions (Module: gestures) +# ------------------------------------------------------------------------------------ +proc SetGesturesEnabled*(flags: uint32) {.RLAPI, importc: "SetGesturesEnabled".} # Enable a set of gestures using flags +proc IsGestureDetected*(gesture: int32): bool {.RLAPI, importc: "IsGestureDetected".} # Check if a gesture have been detected +proc GetGestureDetected*(): int32 {.RLAPI, importc: "GetGestureDetected".} # Get latest detected gesture +proc GetTouchPointsCount*(): int32 {.RLAPI, importc: "GetTouchPointsCount".} # Get touch points count +proc GetGestureHoldDuration*(): float32 {.RLAPI, importc: "GetGestureHoldDuration".} # Get gesture hold time in milliseconds +proc GetGestureDragVector*(): Vector2 {.RLAPI, importc: "GetGestureDragVector".} # Get gesture drag vector +proc GetGestureDragAngle*(): float32 {.RLAPI, importc: "GetGestureDragAngle".} # Get gesture drag angle +proc GetGesturePinchVector*(): Vector2 {.RLAPI, importc: "GetGesturePinchVector".} # Get gesture pinch delta +proc GetGesturePinchAngle*(): float32 {.RLAPI, importc: "GetGesturePinchAngle".} # Get gesture pinch angle +# ------------------------------------------------------------------------------------ +# Camera System Functions (Module: camera) +# ------------------------------------------------------------------------------------ +proc SetCameraMode*(camera: Camera; mode: int32) {.RLAPI, importc: "SetCameraMode".} # Set camera mode (multiple camera modes available) +proc UpdateCamera*(camera: ptr Camera) {.RLAPI, importc: "UpdateCamera".} # Update camera position for selected mode +proc SetCameraPanControl*(keyPan: int32) {.RLAPI, importc: "SetCameraPanControl".} # Set camera pan key to combine with mouse movement (free camera) +proc SetCameraAltControl*(keyAlt: int32) {.RLAPI, importc: "SetCameraAltControl".} # Set camera alt key to combine with mouse movement (free camera) +proc SetCameraSmoothZoomControl*(keySmoothZoom: int32) {.RLAPI, importc: "SetCameraSmoothZoomControl".} # Set camera smooth zoom key to combine with mouse (free camera) +proc SetCameraMoveControls*(keyFront: int32; keyBack: int32; keyRight: int32; keyLeft: int32; keyUp: int32; keyDown: int32) {.RLAPI, importc: "SetCameraMoveControls".} # Set camera move controls (1st person and 3rd person cameras) +# ------------------------------------------------------------------------------------ +# Basic Shapes Drawing Functions (Module: shapes) +# ------------------------------------------------------------------------------------ +# Set texture and rectangle to be used on shapes drawing +# NOTE: It can be useful when using basic shapes and one single font, +# defining a font char white rectangle would allow drawing everything in a single draw call +proc SetShapesTexture*(texture: Texture2D; source: Rectangle) {.RLAPI, importc: "SetShapesTexture".} # Set texture and rectangle to be used on shapes drawing +# Basic shapes drawing functions +proc DrawPixel*(posX: int32; posY: int32; color: Color) {.RLAPI, importc: "DrawPixel".} # Draw a pixel +proc DrawPixelV*(position: Vector2; color: Color) {.RLAPI, importc: "DrawPixelV".} # Draw a pixel (Vector version) +proc DrawLine*(startPosX: int32; startPosY: int32; endPosX: int32; endPosY: int32; color: Color) {.RLAPI, importc: "DrawLine".} # Draw a line +proc DrawLineV*(startPos: Vector2; endPos: Vector2; color: Color) {.RLAPI, importc: "DrawLineV".} # Draw a line (Vector version) +proc DrawLineEx*(startPos: Vector2; endPos: Vector2; thick: float32; color: Color) {.RLAPI, importc: "DrawLineEx".} # Draw a line defining thickness +proc DrawLineBezier*(startPos: Vector2; endPos: Vector2; thick: float32; color: Color) {.RLAPI, importc: "DrawLineBezier".} # Draw a line using cubic-bezier curves in-out +proc DrawLineBezierQuad*(startPos: Vector2; endPos: Vector2; controlPos: Vector2; thick: float32; color: Color) {.RLAPI, importc: "DrawLineBezierQuad".} # Draw line using quadratic bezier curves with a control point +proc DrawLineStrip*(points: ptr Vector2; pointsCount: int32; color: Color) {.RLAPI, importc: "DrawLineStrip".} # Draw lines sequence +proc DrawCircle*(centerX: int32; centerY: int32; radius: float32; color: Color) {.RLAPI, importc: "DrawCircle".} # Draw a color-filled circle +proc DrawCircleSector*(center: Vector2; radius: float32; startAngle: float32; endAngle: float32; segments: int32; color: Color) {.RLAPI, importc: "DrawCircleSector".} # Draw a piece of a circle +proc DrawCircleSectorLines*(center: Vector2; radius: float32; startAngle: float32; endAngle: float32; segments: int32; color: Color) {.RLAPI, importc: "DrawCircleSectorLines".} # Draw circle sector outline +proc DrawCircleGradient*(centerX: int32; centerY: int32; radius: float32; color1: Color; color2: Color) {.RLAPI, importc: "DrawCircleGradient".} # Draw a gradient-filled circle +proc DrawCircleV*(center: Vector2; radius: float32; color: Color) {.RLAPI, importc: "DrawCircleV".} # Draw a color-filled circle (Vector version) +proc DrawCircleLines*(centerX: int32; centerY: int32; radius: float32; color: Color) {.RLAPI, importc: "DrawCircleLines".} # Draw circle outline +proc DrawEllipse*(centerX: int32; centerY: int32; radiusH: float32; radiusV: float32; color: Color) {.RLAPI, importc: "DrawEllipse".} # Draw ellipse +proc DrawEllipseLines*(centerX: int32; centerY: int32; radiusH: float32; radiusV: float32; color: Color) {.RLAPI, importc: "DrawEllipseLines".} # Draw ellipse outline +proc DrawRing*(center: Vector2; innerRadius: float32; outerRadius: float32; startAngle: float32; endAngle: float32; segments: int32; color: Color) {.RLAPI, importc: "DrawRing".} # Draw ring +proc DrawRingLines*(center: Vector2; innerRadius: float32; outerRadius: float32; startAngle: float32; endAngle: float32; segments: int32; color: Color) {.RLAPI, importc: "DrawRingLines".} # Draw ring outline +proc DrawRectangle*(posX: int32; posY: int32; width: int32; height: int32; color: Color) {.RLAPI, importc: "DrawRectangle".} # Draw a color-filled rectangle +proc DrawRectangleV*(position: Vector2; size: Vector2; color: Color) {.RLAPI, importc: "DrawRectangleV".} # Draw a color-filled rectangle (Vector version) +proc DrawRectangleRec*(rec: Rectangle; color: Color) {.RLAPI, importc: "DrawRectangleRec".} # Draw a color-filled rectangle +proc DrawRectanglePro*(rec: Rectangle; origin: Vector2; rotation: float32; color: Color) {.RLAPI, importc: "DrawRectanglePro".} # Draw a color-filled rectangle with pro parameters +proc DrawRectangleGradientV*(posX: int32; posY: int32; width: int32; height: int32; color1: Color; color2: Color) {.RLAPI, importc: "DrawRectangleGradientV".} # Draw a vertical-gradient-filled rectangle +proc DrawRectangleGradientH*(posX: int32; posY: int32; width: int32; height: int32; color1: Color; color2: Color) {.RLAPI, importc: "DrawRectangleGradientH".} # Draw a horizontal-gradient-filled rectangle +proc DrawRectangleGradientEx*(rec: Rectangle; col1: Color; col2: Color; col3: Color; col4: Color) {.RLAPI, importc: "DrawRectangleGradientEx".} # Draw a gradient-filled rectangle with custom vertex colors +proc DrawRectangleLines*(posX: int32; posY: int32; width: int32; height: int32; color: Color) {.RLAPI, importc: "DrawRectangleLines".} # Draw rectangle outline +proc DrawRectangleLinesEx*(rec: Rectangle; lineThick: float32; color: Color) {.RLAPI, importc: "DrawRectangleLinesEx".} # Draw rectangle outline with extended parameters +proc DrawRectangleRounded*(rec: Rectangle; roundness: float32; segments: int32; color: Color) {.RLAPI, importc: "DrawRectangleRounded".} # Draw rectangle with rounded edges +proc DrawRectangleRoundedLines*(rec: Rectangle; roundness: float32; segments: int32; lineThick: float32; color: Color) {.RLAPI, importc: "DrawRectangleRoundedLines".} # Draw rectangle with rounded edges outline +proc DrawTriangle*(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.RLAPI, importc: "DrawTriangle".} # Draw a color-filled triangle (vertex in counter-clockwise order!) +proc DrawTriangleLines*(v1: Vector2; v2: Vector2; v3: Vector2; color: Color) {.RLAPI, importc: "DrawTriangleLines".} # Draw triangle outline (vertex in counter-clockwise order!) +proc DrawTriangleFan*(points: ptr Vector2; pointsCount: int32; color: Color) {.RLAPI, importc: "DrawTriangleFan".} # Draw a triangle fan defined by points (first vertex is the center) +proc DrawTriangleStrip*(points: ptr Vector2; pointsCount: int32; color: Color) {.RLAPI, importc: "DrawTriangleStrip".} # Draw a triangle strip defined by points +proc DrawPoly*(center: Vector2; sides: int32; radius: float32; rotation: float32; color: Color) {.RLAPI, importc: "DrawPoly".} # Draw a regular polygon (Vector version) +proc DrawPolyLines*(center: Vector2; sides: int32; radius: float32; rotation: float32; color: Color) {.RLAPI, importc: "DrawPolyLines".} # Draw a polygon outline of n sides +proc DrawPolyLinesEx*(center: Vector2; sides: int32; radius: float32; rotation: float32; lineThick: float32; color: Color) {.RLAPI, importc: "DrawPolyLinesEx".} # Draw a polygon outline of n sides with extended parameters +# Basic shapes collision detection functions +proc CheckCollisionRecs*(rec1: Rectangle; rec2: Rectangle): bool {.RLAPI, importc: "CheckCollisionRecs".} # Check collision between two rectangles +proc CheckCollisionCircles*(center1: Vector2; radius1: float32; center2: Vector2; radius2: float32): bool {.RLAPI, importc: "CheckCollisionCircles".} # Check collision between two circles +proc CheckCollisionCircleRec*(center: Vector2; radius: float32; rec: Rectangle): bool {.RLAPI, importc: "CheckCollisionCircleRec".} # Check collision between circle and rectangle +proc CheckCollisionPointRec*(point: Vector2; rec: Rectangle): bool {.RLAPI, importc: "CheckCollisionPointRec".} # Check if point is inside rectangle +proc CheckCollisionPointCircle*(point: Vector2; center: Vector2; radius: float32): bool {.RLAPI, importc: "CheckCollisionPointCircle".} # Check if point is inside circle +proc CheckCollisionPointTriangle*(point: Vector2; p1: Vector2; p2: Vector2; p3: Vector2): bool {.RLAPI, importc: "CheckCollisionPointTriangle".} # Check if point is inside a triangle +proc CheckCollisionLines*(startPos1: Vector2; endPos1: Vector2; startPos2: Vector2; endPos2: Vector2; collisionPoint: ptr Vector2): bool {.RLAPI, importc: "CheckCollisionLines".} # Check the collision between two lines defined by two points each, returns collision point by reference +proc GetCollisionRec*(rec1: Rectangle; rec2: Rectangle): Rectangle {.RLAPI, importc: "GetCollisionRec".} # Get collision rectangle for two rectangles collision +# ------------------------------------------------------------------------------------ +# Texture Loading and Drawing Functions (Module: textures) +# ------------------------------------------------------------------------------------ +# Image loading functions +# NOTE: This functions do not require GPU access +proc LoadImage*(fileName: cstring): Image {.RLAPI, importc: "LoadImage".} # Load image from file into CPU memory (RAM) +proc LoadImageRaw*(fileName: cstring; width: int32; height: int32; format: int32; headerSize: int32): Image {.RLAPI, importc: "LoadImageRaw".} # Load image from RAW file data +proc LoadImageAnim*(fileName: cstring; frames: pointer): Image {.RLAPI, importc: "LoadImageAnim".} # Load image sequence from file (frames appended to image.data) +proc LoadImageFromMemory*(fileType: cstring; fileData: UncheckedArray[byte]; dataSize: int32): Image {.RLAPI, importc: "LoadImageFromMemory".} # Load image from memory buffer, fileType refers to extension: i.e. '.png' +proc LoadImageFromTexture*(texture: Texture2D): Image {.RLAPI, importc: "LoadImageFromTexture".} # Load image from GPU texture data +proc LoadImageFromScreen*(): Image {.RLAPI, importc: "LoadImageFromScreen".} # Load image from screen buffer and (screenshot) +proc UnloadImage*(image: Image) {.RLAPI, importc: "UnloadImage".} # Unload image from CPU memory (RAM) +proc ExportImage*(image: Image; fileName: cstring): bool {.RLAPI, importc: "ExportImage".} # Export image data to file, returns true on success +proc ExportImageAsCode*(image: Image; fileName: cstring): bool {.RLAPI, importc: "ExportImageAsCode".} # Export image as code file defining an array of bytes, returns true on success +# Image generation functions +proc GenImageColor*(width: int32; height: int32; color: Color): Image {.RLAPI, importc: "GenImageColor".} # Generate image: plain color +proc GenImageGradientV*(width: int32; height: int32; top: Color; bottom: Color): Image {.RLAPI, importc: "GenImageGradientV".} # Generate image: vertical gradient +proc GenImageGradientH*(width: int32; height: int32; left: Color; right: Color): Image {.RLAPI, importc: "GenImageGradientH".} # Generate image: horizontal gradient +proc GenImageGradientRadial*(width: int32; height: int32; density: float32; inner: Color; outer: Color): Image {.RLAPI, importc: "GenImageGradientRadial".} # Generate image: radial gradient +proc GenImageChecked*(width: int32; height: int32; checksX: int32; checksY: int32; col1: Color; col2: Color): Image {.RLAPI, importc: "GenImageChecked".} # Generate image: checked +proc GenImageWhiteNoise*(width: int32; height: int32; factor: float32): Image {.RLAPI, importc: "GenImageWhiteNoise".} # Generate image: white noise +proc GenImagePerlinNoise*(width: int32; height: int32; offsetX: int32; offsetY: int32; scale: float32): Image {.RLAPI, importc: "GenImagePerlinNoise".} # Generate image: perlin noise +proc GenImageCellular*(width: int32; height: int32; tileSize: int32): Image {.RLAPI, importc: "GenImageCellular".} # Generate image: cellular algorithm. Bigger tileSize means bigger cells +# Image manipulation functions +proc ImageCopy*(image: Image): Image {.RLAPI, importc: "ImageCopy".} # Create an image duplicate (useful for transformations) +proc ImageFromImage*(image: Image; rec: Rectangle): Image {.RLAPI, importc: "ImageFromImage".} # Create an image from another image piece +proc ImageText*(text: cstring; fontSize: int32; color: Color): Image {.RLAPI, importc: "ImageText".} # Create an image from text (default font) +proc ImageTextEx*(font: Font; text: cstring; fontSize: float32; spacing: float32; tint: Color): Image {.RLAPI, importc: "ImageTextEx".} # Create an image from text (custom sprite font) +proc ImageFormat*(image: ptr Image; newFormat: int32) {.RLAPI, importc: "ImageFormat".} # Convert image data to desired format +proc ImageToPOT*(image: ptr Image; fill: Color) {.RLAPI, importc: "ImageToPOT".} # Convert image to POT (power-of-two) +proc ImageCrop*(image: ptr Image; crop: Rectangle) {.RLAPI, importc: "ImageCrop".} # Crop an image to a defined rectangle +proc ImageAlphaCrop*(image: ptr Image; threshold: float32) {.RLAPI, importc: "ImageAlphaCrop".} # Crop image depending on alpha value +proc ImageAlphaClear*(image: ptr Image; color: Color; threshold: float32) {.RLAPI, importc: "ImageAlphaClear".} # Clear alpha channel to desired color +proc ImageAlphaMask*(image: ptr Image; alphaMask: Image) {.RLAPI, importc: "ImageAlphaMask".} # Apply alpha mask to image +proc ImageAlphaPremultiply*(image: ptr Image) {.RLAPI, importc: "ImageAlphaPremultiply".} # Premultiply alpha channel +proc ImageResize*(image: ptr Image; newWidth: int32; newHeight: int32) {.RLAPI, importc: "ImageResize".} # Resize image (Bicubic scaling algorithm) +proc ImageResizeNN*(image: ptr Image; newWidth: int32; newHeight: int32) {.RLAPI, importc: "ImageResizeNN".} # Resize image (Nearest-Neighbor scaling algorithm) +proc ImageResizeCanvas*(image: ptr Image; newWidth: int32; newHeight: int32; offsetX: int32; offsetY: int32; fill: Color) {.RLAPI, importc: "ImageResizeCanvas".} # Resize canvas and fill with color +proc ImageMipmaps*(image: ptr Image) {.RLAPI, importc: "ImageMipmaps".} # Compute all mipmap levels for a provided image +proc ImageDither*(image: ptr Image; rBpp: int32; gBpp: int32; bBpp: int32; aBpp: int32) {.RLAPI, importc: "ImageDither".} # Dither image data to 16bpp or lower (Floyd-Steinberg dithering) +proc ImageFlipVertical*(image: ptr Image) {.RLAPI, importc: "ImageFlipVertical".} # Flip image vertically +proc ImageFlipHorizontal*(image: ptr Image) {.RLAPI, importc: "ImageFlipHorizontal".} # Flip image horizontally +proc ImageRotateCW*(image: ptr Image) {.RLAPI, importc: "ImageRotateCW".} # Rotate image clockwise 90deg +proc ImageRotateCCW*(image: ptr Image) {.RLAPI, importc: "ImageRotateCCW".} # Rotate image counter-clockwise 90deg +proc ImageColorTint*(image: ptr Image; color: Color) {.RLAPI, importc: "ImageColorTint".} # Modify image color: tint +proc ImageColorInvert*(image: ptr Image) {.RLAPI, importc: "ImageColorInvert".} # Modify image color: invert +proc ImageColorGrayscale*(image: ptr Image) {.RLAPI, importc: "ImageColorGrayscale".} # Modify image color: grayscale +proc ImageColorContrast*(image: ptr Image; contrast: float32) {.RLAPI, importc: "ImageColorContrast".} # Modify image color: contrast (-100 to 100) +proc ImageColorBrightness*(image: ptr Image; brightness: int32) {.RLAPI, importc: "ImageColorBrightness".} # Modify image color: brightness (-255 to 255) +proc ImageColorReplace*(image: ptr Image; color: Color; replace: Color) {.RLAPI, importc: "ImageColorReplace".} # Modify image color: replace color +proc LoadImageColors*(image: Image): ptr Color {.RLAPI, importc: "LoadImageColors".} # Load color data from image as a Color array (RGBA - 32bit) +proc LoadImagePalette*(image: Image; maxPaletteSize: int32; colorsCount: pointer): ptr Color {.RLAPI, importc: "LoadImagePalette".} # Load colors palette from image as a Color array (RGBA - 32bit) +proc UnloadImageColors*(colors: ptr Color) {.RLAPI, importc: "UnloadImageColors".} # Unload color data loaded with LoadImageColors() +proc UnloadImagePalette*(colors: ptr Color) {.RLAPI, importc: "UnloadImagePalette".} # Unload colors palette loaded with LoadImagePalette() +proc GetImageAlphaBorder*(image: Image; threshold: float32): Rectangle {.RLAPI, importc: "GetImageAlphaBorder".} # Get image alpha border rectangle +# Image drawing functions +# NOTE: Image software-rendering functions (CPU) +proc ImageClearBackground*(dst: ptr Image; color: Color) {.RLAPI, importc: "ImageClearBackground".} # Clear image background with given color +proc ImageDrawPixel*(dst: ptr Image; posX: int32; posY: int32; color: Color) {.RLAPI, importc: "ImageDrawPixel".} # Draw pixel within an image +proc ImageDrawPixelV*(dst: ptr Image; position: Vector2; color: Color) {.RLAPI, importc: "ImageDrawPixelV".} # Draw pixel within an image (Vector version) +proc ImageDrawLine*(dst: ptr Image; startPosX: int32; startPosY: int32; endPosX: int32; endPosY: int32; color: Color) {.RLAPI, importc: "ImageDrawLine".} # Draw line within an image +proc ImageDrawLineV*(dst: ptr Image; start: Vector2; endx: Vector2; color: Color) {.RLAPI, importc: "ImageDrawLineV".} # Draw line within an image (Vector version) +proc ImageDrawCircle*(dst: ptr Image; centerX: int32; centerY: int32; radius: int32; color: Color) {.RLAPI, importc: "ImageDrawCircle".} # Draw circle within an image +proc ImageDrawCircleV*(dst: ptr Image; center: Vector2; radius: int32; color: Color) {.RLAPI, importc: "ImageDrawCircleV".} # Draw circle within an image (Vector version) +proc ImageDrawRectangle*(dst: ptr Image; posX: int32; posY: int32; width: int32; height: int32; color: Color) {.RLAPI, importc: "ImageDrawRectangle".} # Draw rectangle within an image +proc ImageDrawRectangleV*(dst: ptr Image; position: Vector2; size: Vector2; color: Color) {.RLAPI, importc: "ImageDrawRectangleV".} # Draw rectangle within an image (Vector version) +proc ImageDrawRectangleRec*(dst: ptr Image; rec: Rectangle; color: Color) {.RLAPI, importc: "ImageDrawRectangleRec".} # Draw rectangle within an image +proc ImageDrawRectangleLines*(dst: ptr Image; rec: Rectangle; thick: int32; color: Color) {.RLAPI, importc: "ImageDrawRectangleLines".} # Draw rectangle lines within an image +proc ImageDraw*(dst: ptr Image; src: Image; srcRec: Rectangle; dstRec: Rectangle; tint: Color) {.RLAPI, importc: "ImageDraw".} # Draw a source image within a destination image (tint applied to source) +proc ImageDrawText*(dst: ptr Image; text: cstring; posX: int32; posY: int32; fontSize: int32; color: Color) {.RLAPI, importc: "ImageDrawText".} # Draw text (using default font) within an image (destination) +proc ImageDrawTextEx*(dst: ptr Image; font: Font; text: cstring; position: Vector2; fontSize: float32; spacing: float32; tint: Color) {.RLAPI, importc: "ImageDrawTextEx".} # Draw text (custom sprite font) within an image (destination) +# Texture loading functions +# NOTE: These functions require GPU access +proc LoadTexture*(fileName: cstring): Texture2D {.RLAPI, importc: "LoadTexture".} # Load texture from file into GPU memory (VRAM) +proc LoadTextureFromImage*(image: Image): Texture2D {.RLAPI, importc: "LoadTextureFromImage".} # Load texture from image data +proc LoadTextureCubemap*(image: Image; layout: int32): TextureCubemap {.RLAPI, importc: "LoadTextureCubemap".} # Load cubemap from image, multiple image cubemap layouts supported +proc LoadRenderTexture*(width: int32; height: int32): RenderTexture2D {.RLAPI, importc: "LoadRenderTexture".} # Load texture for rendering (framebuffer) +proc UnloadTexture*(texture: Texture2D) {.RLAPI, importc: "UnloadTexture".} # Unload texture from GPU memory (VRAM) +proc UnloadRenderTexture*(target: RenderTexture2D) {.RLAPI, importc: "UnloadRenderTexture".} # Unload render texture from GPU memory (VRAM) +proc UpdateTexture*(texture: Texture2D; pixels: pointer) {.RLAPI, importc: "UpdateTexture".} # Update GPU texture with new data +proc UpdateTextureRec*(texture: Texture2D; rec: Rectangle; pixels: pointer) {.RLAPI, importc: "UpdateTextureRec".} # Update GPU texture rectangle with new data +# Texture configuration functions +proc GenTextureMipmaps*(texture: ptr Texture2D) {.RLAPI, importc: "GenTextureMipmaps".} # Generate GPU mipmaps for a texture +proc SetTextureFilter*(texture: Texture2D; filter: int32) {.RLAPI, importc: "SetTextureFilter".} # Set texture scaling filter mode +proc SetTextureWrap*(texture: Texture2D; wrap: int32) {.RLAPI, importc: "SetTextureWrap".} # Set texture wrapping mode +# Texture drawing functions +proc DrawTexture*(texture: Texture2D; posX: int32; posY: int32; tint: Color) {.RLAPI, importc: "DrawTexture".} # Draw a Texture2D +proc DrawTextureV*(texture: Texture2D; position: Vector2; tint: Color) {.RLAPI, importc: "DrawTextureV".} # Draw a Texture2D with position defined as Vector2 +proc DrawTextureEx*(texture: Texture2D; position: Vector2; rotation: float32; scale: float32; tint: Color) {.RLAPI, importc: "DrawTextureEx".} # Draw a Texture2D with extended parameters +proc DrawTextureRec*(texture: Texture2D; source: Rectangle; position: Vector2; tint: Color) {.RLAPI, importc: "DrawTextureRec".} # Draw a part of a texture defined by a rectangle +proc DrawTextureQuad*(texture: Texture2D; tiling: Vector2; offset: Vector2; quad: Rectangle; tint: Color) {.RLAPI, importc: "DrawTextureQuad".} # Draw texture quad with tiling and offset parameters +proc DrawTextureTiled*(texture: Texture2D; source: Rectangle; dest: Rectangle; origin: Vector2; rotation: float32; scale: float32; tint: Color) {.RLAPI, importc: "DrawTextureTiled".} # Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. +proc DrawTexturePro*(texture: Texture2D; source: Rectangle; dest: Rectangle; origin: Vector2; rotation: float32; tint: Color) {.RLAPI, importc: "DrawTexturePro".} # Draw a part of a texture defined by a rectangle with 'pro' parameters +proc DrawTextureNPatch*(texture: Texture2D; nPatchInfo: NPatchInfo; dest: Rectangle; origin: Vector2; rotation: float32; tint: Color) {.RLAPI, importc: "DrawTextureNPatch".} # Draws a texture (or part of it) that stretches or shrinks nicely +proc DrawTexturePoly*(texture: Texture2D; center: Vector2; points: ptr Vector2; texcoords: ptr Vector2; pointsCount: int32; tint: Color) {.RLAPI, importc: "DrawTexturePoly".} # Draw a textured polygon +# Color/pixel related functions +proc Fade*(color: Color; alpha: float32): Color {.RLAPI, importc: "Fade".} # Get color with alpha applied, alpha goes from 0.0f to 1.0f +proc ColorToInt*(color: Color): int32 {.RLAPI, importc: "ColorToInt".} # Get hexadecimal value for a Color +proc ColorNormalize*(color: Color): Vector4 {.RLAPI, importc: "ColorNormalize".} # Get Color normalized as float [0..1] +proc ColorFromNormalized*(normalized: Vector4): Color {.RLAPI, importc: "ColorFromNormalized".} # Get Color from normalized values [0..1] +proc ColorToHSV*(color: Color): Vector3 {.RLAPI, importc: "ColorToHSV".} # Get HSV values for a Color, hue [0..360], saturation/value [0..1] +proc ColorFromHSV*(hue: float32; saturation: float32; value: float32): Color {.RLAPI, importc: "ColorFromHSV".} # Get a Color from HSV values, hue [0..360], saturation/value [0..1] +proc ColorAlpha*(color: Color; alpha: float32): Color {.RLAPI, importc: "ColorAlpha".} # Get color with alpha applied, alpha goes from 0.0f to 1.0f +proc ColorAlphaBlend*(dst: Color; src: Color; tint: Color): Color {.RLAPI, importc: "ColorAlphaBlend".} # Get src alpha-blended into dst color with tint +proc GetColor*(hexValue: int32): Color {.RLAPI, importc: "GetColor".} # Get Color structure from hexadecimal value +proc GetPixelColor*(srcPtr: pointer; format: int32): Color {.RLAPI, importc: "GetPixelColor".} # Get Color from a source pixel pointer of certain format +proc SetPixelColor*(dstPtr: pointer; color: Color; format: int32) {.RLAPI, importc: "SetPixelColor".} # Set color formatted into destination pixel pointer +proc GetPixelDataSize*(width: int32; height: int32; format: int32): int32 {.RLAPI, importc: "GetPixelDataSize".} # Get pixel data size in bytes for certain format +# ------------------------------------------------------------------------------------ +# Font Loading and Text Drawing Functions (Module: text) +# ------------------------------------------------------------------------------------ +# Font loading/unloading functions +proc GetFontDefault*(): Font {.RLAPI, importc: "GetFontDefault".} # Get the default Font +proc LoadFont*(fileName: cstring): Font {.RLAPI, importc: "LoadFont".} # Load font from file into GPU memory (VRAM) +proc LoadFontEx*(fileName: cstring; fontSize: int32; fontChars: pointer; charsCount: int32): Font {.RLAPI, importc: "LoadFontEx".} # Load font from file with extended parameters +proc LoadFontFromImage*(image: Image; key: Color; firstChar: int32): Font {.RLAPI, importc: "LoadFontFromImage".} # Load font from Image (XNA style) +proc LoadFontFromMemory*(fileType: cstring; fileData: UncheckedArray[byte]; dataSize: int32; fontSize: int32; fontChars: pointer; charsCount: int32): Font {.RLAPI, importc: "LoadFontFromMemory".} # Load font from memory buffer, fileType refers to extension: i.e. '.ttf' +proc LoadFontData*(fileData: UncheckedArray[byte]; dataSize: int32; fontSize: int32; fontChars: pointer; charsCount: int32; typex: int32): ptr CharInfo {.RLAPI, importc: "LoadFontData".} # Load font data for further use +proc GenImageFontAtlas*(chars: ptr ptr CharInfo; recs: ptr Rectangle; charsCount: int32; fontSize: int32; padding: int32; packMethod: int32): Image {.RLAPI, importc: "GenImageFontAtlas".} # Generate image font atlas using chars info +proc UnloadFontData*(chars: ptr CharInfo; charsCount: int32) {.RLAPI, importc: "UnloadFontData".} # Unload font chars info data (RAM) +proc UnloadFont*(font: Font) {.RLAPI, importc: "UnloadFont".} # Unload Font from GPU memory (VRAM) +# Text drawing functions +proc DrawFPS*(posX: int32; posY: int32) {.RLAPI, importc: "DrawFPS".} # Draw current FPS +proc DrawText*(text: cstring; posX: int32; posY: int32; fontSize: int32; color: Color) {.RLAPI, importc: "DrawText".} # Draw text (using default font) +proc DrawTextEx*(font: Font; text: cstring; position: Vector2; fontSize: float32; spacing: float32; tint: Color) {.RLAPI, importc: "DrawTextEx".} # Draw text using font and additional parameters +proc DrawTextRec*(font: Font; text: cstring; rec: Rectangle; fontSize: float32; spacing: float32; wordWrap: bool; tint: Color) {.RLAPI, importc: "DrawTextRec".} # Draw text using font inside rectangle limits +proc DrawTextRecEx*(font: Font; text: cstring; rec: Rectangle; fontSize: float32; spacing: float32; wordWrap: bool; tint: Color; selectStart: int32; selectLength: int32; selectTint: Color; selectBackTint: Color) {.RLAPI, importc: "DrawTextRecEx".} # Draw text using font inside rectangle limits with support for text selection +proc DrawTextCodepoint*(font: Font; codepoint: int32; position: Vector2; fontSize: float32; tint: Color) {.RLAPI, importc: "DrawTextCodepoint".} # Draw one character (codepoint) +# Text misc. functions +proc MeasureText*(text: cstring; fontSize: int32): int32 {.RLAPI, importc: "MeasureText".} # Measure string width for default font +proc MeasureTextEx*(font: Font; text: cstring; fontSize: float32; spacing: float32): Vector2 {.RLAPI, importc: "MeasureTextEx".} # Measure string size for Font +proc GetGlyphIndex*(font: Font; codepoint: int32): int32 {.RLAPI, importc: "GetGlyphIndex".} # Get index position for a unicode character on font +# Text strings management functions (no utf8 strings, only byte chars) +# NOTE: Some strings allocate memory internally for returned strings, just be careful! +proc TextCopy*(dst: ptr char; src: cstring): int32 {.RLAPI, importc: "TextCopy".} # Copy one string to another, returns bytes copied +proc TextIsEqual*(text1: cstring; text2: cstring): bool {.RLAPI, importc: "TextIsEqual".} # Check if two text string are equal +proc TextLength*(text: cstring): uint32 {.RLAPI, importc: "TextLength".} # Get text length, checks for '\0' ending +proc TextFormat*(text: cstring): cstring {.RLAPI, varargs, importc: "TextFormat".} # Text formatting with variables (sprintf style) +proc TextSubtext*(text: cstring; position: int32; length: int32): cstring {.RLAPI, importc: "TextSubtext".} # Get a piece of a text string +proc TextReplace*(text: ptr char; replace: cstring; by: cstring): ptr char {.RLAPI, importc: "TextReplace".} # Replace text string (memory must be freed!) +proc TextInsert*(text: cstring; insert: cstring; position: int32): ptr char {.RLAPI, importc: "TextInsert".} # Insert text in a position (memory must be freed!) +proc TextJoin*(textList: cstring; count: int32; delimiter: cstring): cstring {.RLAPI, importc: "TextJoin".} # Join text strings with delimiter +proc TextSplit*(text: cstring; delimiter: char; count: pointer): cstring {.RLAPI, importc: "TextSplit".} # Split text into multiple strings +proc TextAppend*(text: ptr char; append: cstring; position: pointer) {.RLAPI, importc: "TextAppend".} # Append text at specific position and move cursor! +proc TextFindIndex*(text: cstring; find: cstring): int32 {.RLAPI, importc: "TextFindIndex".} # Find first text occurrence within a string +proc TextToUpper*(text: cstring): cstring {.RLAPI, importc: "TextToUpper".} # Get upper case version of provided string +proc TextToLower*(text: cstring): cstring {.RLAPI, importc: "TextToLower".} # Get lower case version of provided string +proc TextToPascal*(text: cstring): cstring {.RLAPI, importc: "TextToPascal".} # Get Pascal case notation version of provided string +proc TextToInteger*(text: cstring): int32 {.RLAPI, importc: "TextToInteger".} # Get integer value from text (negative values not supported) +proc TextToUtf8*(codepoints: pointer; length: int32): ptr char {.RLAPI, importc: "TextToUtf8".} # Encode text codepoint into utf8 text (memory must be freed!) +# UTF8 text strings management functions +proc LoadCodepoints*(text: cstring; count: pointer): pointer {.RLAPI, importc: "LoadCodepoints".} # Load all codepoints from a UTF8 text string, codepoints count returned by parameter +proc UnloadCodepoints*(codepoints: pointer) {.RLAPI, importc: "UnloadCodepoints".} # Unload codepoints data from memory +proc GetCodepointsCount*(text: cstring): int32 {.RLAPI, importc: "GetCodepointsCount".} # Get total number of characters (codepoints) in a UTF8 encoded string +proc GetCodepoint*(text: cstring; bytesProcessed: pointer): int32 {.RLAPI, importc: "GetCodepoint".} # Get next codepoint in a UTF8 encoded string, 0x3f('?') is returned on failure +proc CodepointToUtf8*(codepoint: int32; byteLength: pointer): cstring {.RLAPI, importc: "CodepointToUtf8".} # Encode codepoint into utf8 text (char array length returned as parameter) +# ------------------------------------------------------------------------------------ +# Basic 3d Shapes Drawing Functions (Module: models) +# ------------------------------------------------------------------------------------ +# Basic geometric 3D shapes drawing functions +proc DrawLine3D*(startPos: Vector3; endPos: Vector3; color: Color) {.RLAPI, importc: "DrawLine3D".} # Draw a line in 3D world space +proc DrawPoint3D*(position: Vector3; color: Color) {.RLAPI, importc: "DrawPoint3D".} # Draw a point in 3D space, actually a small line +proc DrawCircle3D*(center: Vector3; radius: float32; rotationAxis: Vector3; rotationAngle: float32; color: Color) {.RLAPI, importc: "DrawCircle3D".} # Draw a circle in 3D world space +proc DrawTriangle3D*(v1: Vector3; v2: Vector3; v3: Vector3; color: Color) {.RLAPI, importc: "DrawTriangle3D".} # Draw a color-filled triangle (vertex in counter-clockwise order!) +proc DrawTriangleStrip3D*(points: ptr Vector3; pointsCount: int32; color: Color) {.RLAPI, importc: "DrawTriangleStrip3D".} # Draw a triangle strip defined by points +proc DrawCube*(position: Vector3; width: float32; height: float32; length: float32; color: Color) {.RLAPI, importc: "DrawCube".} # Draw cube +proc DrawCubeV*(position: Vector3; size: Vector3; color: Color) {.RLAPI, importc: "DrawCubeV".} # Draw cube (Vector version) +proc DrawCubeWires*(position: Vector3; width: float32; height: float32; length: float32; color: Color) {.RLAPI, importc: "DrawCubeWires".} # Draw cube wires +proc DrawCubeWiresV*(position: Vector3; size: Vector3; color: Color) {.RLAPI, importc: "DrawCubeWiresV".} # Draw cube wires (Vector version) +proc DrawCubeTexture*(texture: Texture2D; position: Vector3; width: float32; height: float32; length: float32; color: Color) {.RLAPI, importc: "DrawCubeTexture".} # Draw cube textured +proc DrawSphere*(centerPos: Vector3; radius: float32; color: Color) {.RLAPI, importc: "DrawSphere".} # Draw sphere +proc DrawSphereEx*(centerPos: Vector3; radius: float32; rings: int32; slices: int32; color: Color) {.RLAPI, importc: "DrawSphereEx".} # Draw sphere with extended parameters +proc DrawSphereWires*(centerPos: Vector3; radius: float32; rings: int32; slices: int32; color: Color) {.RLAPI, importc: "DrawSphereWires".} # Draw sphere wires +proc DrawCylinder*(position: Vector3; radiusTop: float32; radiusBottom: float32; height: float32; slices: int32; color: Color) {.RLAPI, importc: "DrawCylinder".} # Draw a cylinder/cone +proc DrawCylinderWires*(position: Vector3; radiusTop: float32; radiusBottom: float32; height: float32; slices: int32; color: Color) {.RLAPI, importc: "DrawCylinderWires".} # Draw a cylinder/cone wires +proc DrawPlane*(centerPos: Vector3; size: Vector2; color: Color) {.RLAPI, importc: "DrawPlane".} # Draw a plane XZ +proc DrawRay*(ray: Ray; color: Color) {.RLAPI, importc: "DrawRay".} # Draw a ray line +proc DrawGrid*(slices: int32; spacing: float32) {.RLAPI, importc: "DrawGrid".} # Draw a grid (centered at (0, 0, 0)) +# ------------------------------------------------------------------------------------ +# Model 3d Loading and Drawing Functions (Module: models) +# ------------------------------------------------------------------------------------ +# Model loading/unloading functions +proc LoadModel*(fileName: cstring): Model {.RLAPI, importc: "LoadModel".} # Load model from files (meshes and materials) +proc LoadModelFromMesh*(mesh: Mesh): Model {.RLAPI, importc: "LoadModelFromMesh".} # Load model from generated mesh (default material) +proc UnloadModel*(model: Model) {.RLAPI, importc: "UnloadModel".} # Unload model (including meshes) from memory (RAM and/or VRAM) +proc UnloadModelKeepMeshes*(model: Model) {.RLAPI, importc: "UnloadModelKeepMeshes".} # Unload model (but not meshes) from memory (RAM and/or VRAM) +# Mesh loading/unloading functions +proc UploadMesh*(mesh: ptr Mesh; dynamic: bool) {.RLAPI, importc: "UploadMesh".} # Upload mesh vertex data in GPU and provide VAO/VBO ids +proc UpdateMeshBuffer*(mesh: Mesh; index: int32; data: pointer; dataSize: int32; offset: int32) {.RLAPI, importc: "UpdateMeshBuffer".} # Update mesh vertex data in GPU for a specific buffer index +proc DrawMesh*(mesh: Mesh; material: Material; transform: Matrix) {.RLAPI, importc: "DrawMesh".} # Draw a 3d mesh with material and transform +proc DrawMeshInstanced*(mesh: Mesh; material: Material; transforms: ptr Matrix; instances: int32) {.RLAPI, importc: "DrawMeshInstanced".} # Draw multiple mesh instances with material and different transforms +proc UnloadMesh*(mesh: Mesh) {.RLAPI, importc: "UnloadMesh".} # Unload mesh data from CPU and GPU +proc ExportMesh*(mesh: Mesh; fileName: cstring): bool {.RLAPI, importc: "ExportMesh".} # Export mesh data to file, returns true on success +# Material loading/unloading functions +proc LoadMaterials*(fileName: cstring; materialCount: pointer): ptr Material {.RLAPI, importc: "LoadMaterials".} # Load materials from model file +proc LoadMaterialDefault*(): Material {.RLAPI, importc: "LoadMaterialDefault".} # Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) +proc UnloadMaterial*(material: Material) {.RLAPI, importc: "UnloadMaterial".} # Unload material from GPU memory (VRAM) +proc SetMaterialTexture*(material: ptr Material; mapType: int32; texture: Texture2D) {.RLAPI, importc: "SetMaterialTexture".} # Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) +proc SetModelMeshMaterial*(model: ptr Model; meshId: int32; materialId: int32) {.RLAPI, importc: "SetModelMeshMaterial".} # Set material for a mesh +# Model animations loading/unloading functions +proc LoadModelAnimations*(fileName: cstring; animsCount: pointer): ptr ModelAnimation {.RLAPI, importc: "LoadModelAnimations".} # Load model animations from file +proc UpdateModelAnimation*(model: Model; anim: ModelAnimation; frame: int32) {.RLAPI, importc: "UpdateModelAnimation".} # Update model animation pose +proc UnloadModelAnimation*(anim: ModelAnimation) {.RLAPI, importc: "UnloadModelAnimation".} # Unload animation data +proc UnloadModelAnimations*(animations: proc(): ModelAnimation; count: uint32) {.RLAPI, importc: "UnloadModelAnimations".} # Unload animation array data +proc IsModelAnimationValid*(model: Model; anim: ModelAnimation): bool {.RLAPI, importc: "IsModelAnimationValid".} # Check model animation skeleton match +# Mesh generation functions +proc GenMeshPoly*(sides: int32; radius: float32): Mesh {.RLAPI, importc: "GenMeshPoly".} # Generate polygonal mesh +proc GenMeshPlane*(width: float32; length: float32; resX: int32; resZ: int32): Mesh {.RLAPI, importc: "GenMeshPlane".} # Generate plane mesh (with subdivisions) +proc GenMeshCube*(width: float32; height: float32; length: float32): Mesh {.RLAPI, importc: "GenMeshCube".} # Generate cuboid mesh +proc GenMeshSphere*(radius: float32; rings: int32; slices: int32): Mesh {.RLAPI, importc: "GenMeshSphere".} # Generate sphere mesh (standard sphere) +proc GenMeshHemiSphere*(radius: float32; rings: int32; slices: int32): Mesh {.RLAPI, importc: "GenMeshHemiSphere".} # Generate half-sphere mesh (no bottom cap) +proc GenMeshCylinder*(radius: float32; height: float32; slices: int32): Mesh {.RLAPI, importc: "GenMeshCylinder".} # Generate cylinder mesh +proc GenMeshTorus*(radius: float32; size: float32; radSeg: int32; sides: int32): Mesh {.RLAPI, importc: "GenMeshTorus".} # Generate torus mesh +proc GenMeshKnot*(radius: float32; size: float32; radSeg: int32; sides: int32): Mesh {.RLAPI, importc: "GenMeshKnot".} # Generate trefoil knot mesh +proc GenMeshHeightmap*(heightmap: Image; size: Vector3): Mesh {.RLAPI, importc: "GenMeshHeightmap".} # Generate heightmap mesh from image data +proc GenMeshCubicmap*(cubicmap: Image; cubeSize: Vector3): Mesh {.RLAPI, importc: "GenMeshCubicmap".} # Generate cubes-based map mesh from image data +# Mesh manipulation functions +proc GetMeshBoundingBox*(mesh: Mesh): BoundingBox {.RLAPI, importc: "GetMeshBoundingBox".} # Compute mesh bounding box limits +proc GenMeshTangents*(mesh: ptr Mesh) {.RLAPI, importc: "GenMeshTangents".} # Compute mesh tangents +proc GenMeshBinormals*(mesh: ptr Mesh) {.RLAPI, importc: "GenMeshBinormals".} # Compute mesh binormals +# Model drawing functions +proc DrawModel*(model: Model; position: Vector3; scale: float32; tint: Color) {.RLAPI, importc: "DrawModel".} # Draw a model (with texture if set) +proc DrawModelEx*(model: Model; position: Vector3; rotationAxis: Vector3; rotationAngle: float32; scale: Vector3; tint: Color) {.RLAPI, importc: "DrawModelEx".} # Draw a model with extended parameters +proc DrawModelWires*(model: Model; position: Vector3; scale: float32; tint: Color) {.RLAPI, importc: "DrawModelWires".} # Draw a model wires (with texture if set) +proc DrawModelWiresEx*(model: Model; position: Vector3; rotationAxis: Vector3; rotationAngle: float32; scale: Vector3; tint: Color) {.RLAPI, importc: "DrawModelWiresEx".} # Draw a model wires (with texture if set) with extended parameters +proc DrawBoundingBox*(box: BoundingBox; color: Color) {.RLAPI, importc: "DrawBoundingBox".} # Draw bounding box (wires) +proc DrawBillboard*(camera: Camera; texture: Texture2D; position: Vector3; size: float32; tint: Color) {.RLAPI, importc: "DrawBillboard".} # Draw a billboard texture +proc DrawBillboardRec*(camera: Camera; texture: Texture2D; source: Rectangle; position: Vector3; size: Vector2; tint: Color) {.RLAPI, importc: "DrawBillboardRec".} # Draw a billboard texture defined by source +proc DrawBillboardPro*(camera: Camera; texture: Texture2D; source: Rectangle; position: Vector3; size: Vector2; origin: Vector2; rotation: float32; tint: Color) {.RLAPI, importc: "DrawBillboardPro".} # Draw a billboard texture defined by source and rotation +# Collision detection functions +proc CheckCollisionSpheres*(center1: Vector3; radius1: float32; center2: Vector3; radius2: float32): bool {.RLAPI, importc: "CheckCollisionSpheres".} # Check collision between two spheres +proc CheckCollisionBoxes*(box1: BoundingBox; box2: BoundingBox): bool {.RLAPI, importc: "CheckCollisionBoxes".} # Check collision between two bounding boxes +proc CheckCollisionBoxSphere*(box: BoundingBox; center: Vector3; radius: float32): bool {.RLAPI, importc: "CheckCollisionBoxSphere".} # Check collision between box and sphere +proc GetRayCollisionSphere*(ray: Ray; center: Vector3; radius: float32): RayCollision {.RLAPI, importc: "GetRayCollisionSphere".} # Get collision info between ray and sphere +proc GetRayCollisionBox*(ray: Ray; box: BoundingBox): RayCollision {.RLAPI, importc: "GetRayCollisionBox".} # Get collision info between ray and box +proc GetRayCollisionModel*(ray: Ray; model: Model): RayCollision {.RLAPI, importc: "GetRayCollisionModel".} # Get collision info between ray and model +proc GetRayCollisionMesh*(ray: Ray; mesh: Mesh; transform: Matrix): RayCollision {.RLAPI, importc: "GetRayCollisionMesh".} # Get collision info between ray and mesh +proc GetRayCollisionTriangle*(ray: Ray; p1: Vector3; p2: Vector3; p3: Vector3): RayCollision {.RLAPI, importc: "GetRayCollisionTriangle".} # Get collision info between ray and triangle +proc GetRayCollisionQuad*(ray: Ray; p1: Vector3; p2: Vector3; p3: Vector3; p4: Vector3): RayCollision {.RLAPI, importc: "GetRayCollisionQuad".} # Get collision info between ray and quad +# ------------------------------------------------------------------------------------ +# Audio Loading and Playing Functions (Module: audio) +# ------------------------------------------------------------------------------------ +# Audio device management functions +proc InitAudioDevice*() {.RLAPI, importc: "InitAudioDevice".} # Initialize audio device and context +proc CloseAudioDevice*() {.RLAPI, importc: "CloseAudioDevice".} # Close the audio device and context +proc IsAudioDeviceReady*(): bool {.RLAPI, importc: "IsAudioDeviceReady".} # Check if audio device has been initialized successfully +proc SetMasterVolume*(volume: float32) {.RLAPI, importc: "SetMasterVolume".} # Set master volume (listener) +# Wave/Sound loading/unloading functions +proc LoadWave*(fileName: cstring): Wave {.RLAPI, importc: "LoadWave".} # Load wave data from file +proc LoadWaveFromMemory*(fileType: cstring; fileData: UncheckedArray[byte]; dataSize: int32): Wave {.RLAPI, importc: "LoadWaveFromMemory".} # Load wave from memory buffer, fileType refers to extension: i.e. '.wav' +proc LoadSound*(fileName: cstring): Sound {.RLAPI, importc: "LoadSound".} # Load sound from file +proc LoadSoundFromWave*(wave: Wave): Sound {.RLAPI, importc: "LoadSoundFromWave".} # Load sound from wave data +proc UpdateSound*(sound: Sound; data: pointer; samplesCount: int32) {.RLAPI, importc: "UpdateSound".} # Update sound buffer with new data +proc UnloadWave*(wave: Wave) {.RLAPI, importc: "UnloadWave".} # Unload wave data +proc UnloadSound*(sound: Sound) {.RLAPI, importc: "UnloadSound".} # Unload sound +proc ExportWave*(wave: Wave; fileName: cstring): bool {.RLAPI, importc: "ExportWave".} # Export wave data to file, returns true on success +proc ExportWaveAsCode*(wave: Wave; fileName: cstring): bool {.RLAPI, importc: "ExportWaveAsCode".} # Export wave sample data to code (.h), returns true on success +# Wave/Sound management functions +proc PlaySound*(sound: Sound) {.RLAPI, importc: "PlaySound".} # Play a sound +proc StopSound*(sound: Sound) {.RLAPI, importc: "StopSound".} # Stop playing a sound +proc PauseSound*(sound: Sound) {.RLAPI, importc: "PauseSound".} # Pause a sound +proc ResumeSound*(sound: Sound) {.RLAPI, importc: "ResumeSound".} # Resume a paused sound +proc PlaySoundMulti*(sound: Sound) {.RLAPI, importc: "PlaySoundMulti".} # Play a sound (using multichannel buffer pool) +proc StopSoundMulti*() {.RLAPI, importc: "StopSoundMulti".} # Stop any sound playing (using multichannel buffer pool) +proc GetSoundsPlaying*(): int32 {.RLAPI, importc: "GetSoundsPlaying".} # Get number of sounds playing in the multichannel +proc IsSoundPlaying*(sound: Sound): bool {.RLAPI, importc: "IsSoundPlaying".} # Check if a sound is currently playing +proc SetSoundVolume*(sound: Sound; volume: float32) {.RLAPI, importc: "SetSoundVolume".} # Set volume for a sound (1.0 is max level) +proc SetSoundPitch*(sound: Sound; pitch: float32) {.RLAPI, importc: "SetSoundPitch".} # Set pitch for a sound (1.0 is base level) +proc WaveFormat*(wave: ptr Wave; sampleRate: int32; sampleSize: int32; channels: int32) {.RLAPI, importc: "WaveFormat".} # Convert wave data to desired format +proc WaveCopy*(wave: Wave): Wave {.RLAPI, importc: "WaveCopy".} # Copy a wave to a new wave +proc WaveCrop*(wave: ptr Wave; initSample: int32; finalSample: int32) {.RLAPI, importc: "WaveCrop".} # Crop a wave to defined samples range +proc LoadWaveSamples*(wave: Wave): float32 {.RLAPI, importc: "LoadWaveSamples".} # Load samples data from wave as a floats array +proc UnloadWaveSamples*(samples: float32) {.RLAPI, importc: "UnloadWaveSamples".} # Unload samples data loaded with LoadWaveSamples() +# Music management functions +proc LoadMusicStream*(fileName: cstring): Music {.RLAPI, importc: "LoadMusicStream".} # Load music stream from file +proc LoadMusicStreamFromMemory*(fileType: cstring; data: uint8; dataSize: int32): Music {.RLAPI, importc: "LoadMusicStreamFromMemory".} # Load music stream from data +proc UnloadMusicStream*(music: Music) {.RLAPI, importc: "UnloadMusicStream".} # Unload music stream +proc PlayMusicStream*(music: Music) {.RLAPI, importc: "PlayMusicStream".} # Start music playing +proc IsMusicStreamPlaying*(music: Music): bool {.RLAPI, importc: "IsMusicStreamPlaying".} # Check if music is playing +proc UpdateMusicStream*(music: Music) {.RLAPI, importc: "UpdateMusicStream".} # Updates buffers for music streaming +proc StopMusicStream*(music: Music) {.RLAPI, importc: "StopMusicStream".} # Stop music playing +proc PauseMusicStream*(music: Music) {.RLAPI, importc: "PauseMusicStream".} # Pause music playing +proc ResumeMusicStream*(music: Music) {.RLAPI, importc: "ResumeMusicStream".} # Resume playing paused music +proc SetMusicVolume*(music: Music; volume: float32) {.RLAPI, importc: "SetMusicVolume".} # Set volume for music (1.0 is max level) +proc SetMusicPitch*(music: Music; pitch: float32) {.RLAPI, importc: "SetMusicPitch".} # Set pitch for a music (1.0 is base level) +proc GetMusicTimeLength*(music: Music): float32 {.RLAPI, importc: "GetMusicTimeLength".} # Get music time length (in seconds) +proc GetMusicTimePlayed*(music: Music): float32 {.RLAPI, importc: "GetMusicTimePlayed".} # Get current music time played (in seconds) +# AudioStream management functions +proc LoadAudioStream*(sampleRate: uint32; sampleSize: uint32; channels: uint32): AudioStream {.RLAPI, importc: "LoadAudioStream".} # Load audio stream (to stream raw audio pcm data) +proc UnloadAudioStream*(stream: AudioStream) {.RLAPI, importc: "UnloadAudioStream".} # Unload audio stream and free memory +proc UpdateAudioStream*(stream: AudioStream; data: pointer; samplesCount: int32) {.RLAPI, importc: "UpdateAudioStream".} # Update audio stream buffers with data +proc IsAudioStreamProcessed*(stream: AudioStream): bool {.RLAPI, importc: "IsAudioStreamProcessed".} # Check if any audio stream buffers requires refill +proc PlayAudioStream*(stream: AudioStream) {.RLAPI, importc: "PlayAudioStream".} # Play audio stream +proc PauseAudioStream*(stream: AudioStream) {.RLAPI, importc: "PauseAudioStream".} # Pause audio stream +proc ResumeAudioStream*(stream: AudioStream) {.RLAPI, importc: "ResumeAudioStream".} # Resume audio stream +proc IsAudioStreamPlaying*(stream: AudioStream): bool {.RLAPI, importc: "IsAudioStreamPlaying".} # Check if audio stream is playing +proc StopAudioStream*(stream: AudioStream) {.RLAPI, importc: "StopAudioStream".} # Stop audio stream +proc SetAudioStreamVolume*(stream: AudioStream; volume: float32) {.RLAPI, importc: "SetAudioStreamVolume".} # Set volume for audio stream (1.0 is max level) +proc SetAudioStreamPitch*(stream: AudioStream; pitch: float32) {.RLAPI, importc: "SetAudioStreamPitch".} # Set pitch for audio stream (1.0 is base level) +proc SetAudioStreamBufferSizeDefault*(size: int32) {.RLAPI, importc: "SetAudioStreamBufferSizeDefault".} # Default size for new audio streams +const GetImageData* = LoadImageColors +const KEY_MENU* = 82 \ No newline at end of file diff --git a/src/lsystempkg/raymath.nim b/src/lsystempkg/raymath.nim new file mode 100644 index 0000000..da30e88 --- /dev/null +++ b/src/lsystempkg/raymath.nim @@ -0,0 +1,270 @@ +# +# raymath v1.2 - Math functions to work with Vector3, Matrix and Quaternions +# +# CONFIGURATION: +# +# #define RAYMATH_IMPLEMENTATION +# Generates the implementation of the library into the included file. +# If not defined, the library is in header only mode and can be included in other headers +# or source files without problems. But only ONE file should hold the implementation. +# +# #define RAYMATH_HEADER_ONLY +# Define static inline functions code, so #include header suffices for use. +# This may use up lots of memory. +# +# #define RAYMATH_STANDALONE +# Avoid raylib.h header inclusion in this file. +# Vector3 and Matrix data types are defined internally in raymath module. +# +# +# LICENSE: zlib/libpng +# +# Copyright (c) 2015-2021 Ramon Santamaria (@raysan5) +# +# This software is provided "as-is", without any express or implied warranty. In no event +# will the authors be held liable for any damages arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, including commercial +# applications, and to alter it and redistribute it freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim that you +# wrote the original software. If you use this software in a product, an acknowledgment +# in the product documentation would be appreciated but is not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be misrepresented +# as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution. +# +template RAYMATH_H*(): auto = RAYMATH_H +# #define RAYMATH_STANDALONE +# #define RAYMATH_HEADER_ONLY +import raylib +{.pragma: RMDEF, cdecl, discardable, dynlib: "libraylib" & LEXT.} +# ---------------------------------------------------------------------------------- +# Defines and Macros +# ---------------------------------------------------------------------------------- +# Get float vector for Matrix +# Get float vector for Vector3 +# ---------------------------------------------------------------------------------- +# Types and Structures Definition +# ---------------------------------------------------------------------------------- +# NOTE: Helper types to be used instead of array return types for *ToFloat functions +type float3* {.bycopy.} = object + v*: array[0..2, float32] +type float16* {.bycopy.} = object + v*: array[0..15, float32] +# ---------------------------------------------------------------------------------- +# Module Functions Definition - Utils math +# ---------------------------------------------------------------------------------- +# Clamp float value +proc Clamp*(value: float32; min: float32; max: float32): float32 {.RMDEF, importc: "Clamp".} +# Calculate linear interpolation between two floats +proc Lerp*(start: float32; endx: float32; amount: float32): float32 {.RMDEF, importc: "Lerp".} +# Normalize input value within input range +proc Normalize*(value: float32; start: float32; endx: float32): float32 {.RMDEF, importc: "Normalize".} +# Remap input value within input range to output range +proc Remap*(value: float32; inputStart: float32; inputEnd: float32; outputStart: float32; outputEnd: float32): float32 {.RMDEF, importc: "Remap".} +# ---------------------------------------------------------------------------------- +# Module Functions Definition - Vector2 math +# ---------------------------------------------------------------------------------- +# Vector with components value 0.0f +proc Vector2Zero*(): Vector2 {.RMDEF, importc: "Vector2Zero".} +# Vector with components value 1.0f +proc Vector2One*(): Vector2 {.RMDEF, importc: "Vector2One".} +# Add two vectors (v1 + v2) +proc Vector2Add*(v1: Vector2; v2: Vector2): Vector2 {.RMDEF, importc: "Vector2Add".} +# Add vector and float value +proc Vector2AddValue*(v: Vector2; add: float32): Vector2 {.RMDEF, importc: "Vector2AddValue".} +# Subtract two vectors (v1 - v2) +proc Vector2Subtract*(v1: Vector2; v2: Vector2): Vector2 {.RMDEF, importc: "Vector2Subtract".} +# Subtract vector by float value +proc Vector2SubtractValue*(v: Vector2; sub: float32): Vector2 {.RMDEF, importc: "Vector2SubtractValue".} +# Calculate vector length +proc Vector2Length*(v: Vector2): float32 {.RMDEF, importc: "Vector2Length".} +# Calculate vector square length +proc Vector2LengthSqr*(v: Vector2): float32 {.RMDEF, importc: "Vector2LengthSqr".} +# Calculate two vectors dot product +proc Vector2DotProduct*(v1: Vector2; v2: Vector2): float32 {.RMDEF, importc: "Vector2DotProduct".} +# Calculate distance between two vectors +proc Vector2Distance*(v1: Vector2; v2: Vector2): float32 {.RMDEF, importc: "Vector2Distance".} +# Calculate angle from two vectors in X-axis +proc Vector2Angle*(v1: Vector2; v2: Vector2): float32 {.RMDEF, importc: "Vector2Angle".} +# Scale vector (multiply by value) +proc Vector2Scale*(v: Vector2; scale: float32): Vector2 {.RMDEF, importc: "Vector2Scale".} +# Multiply vector by vector +proc Vector2Multiply*(v1: Vector2; v2: Vector2): Vector2 {.RMDEF, importc: "Vector2Multiply".} +# Negate vector +proc Vector2Negate*(v: Vector2): Vector2 {.RMDEF, importc: "Vector2Negate".} +# Divide vector by vector +proc Vector2Divide*(v1: Vector2; v2: Vector2): Vector2 {.RMDEF, importc: "Vector2Divide".} +# Normalize provided vector +proc Vector2Normalize*(v: Vector2): Vector2 {.RMDEF, importc: "Vector2Normalize".} +# Calculate linear interpolation between two vectors +proc Vector2Lerp*(v1: Vector2; v2: Vector2; amount: float32): Vector2 {.RMDEF, importc: "Vector2Lerp".} +# Calculate reflected vector to normal +proc Vector2Reflect*(v: Vector2; normal: Vector2): Vector2 {.RMDEF, importc: "Vector2Reflect".} +# Rotate Vector by float in Degrees. +proc Vector2Rotate*(v: Vector2; degs: float32): Vector2 {.RMDEF, importc: "Vector2Rotate".} +# Move Vector towards target +proc Vector2MoveTowards*(v: Vector2; target: Vector2; maxDistance: float32): Vector2 {.RMDEF, importc: "Vector2MoveTowards".} +# ---------------------------------------------------------------------------------- +# Module Functions Definition - Vector3 math +# ---------------------------------------------------------------------------------- +# Vector with components value 0.0f +proc Vector3Zero*(): Vector3 {.RMDEF, importc: "Vector3Zero".} +# Vector with components value 1.0f +proc Vector3One*(): Vector3 {.RMDEF, importc: "Vector3One".} +# Add two vectors +proc Vector3Add*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Add".} +# Add vector and float value +proc Vector3AddValue*(v: Vector3; add: float32): Vector3 {.RMDEF, importc: "Vector3AddValue".} +# Subtract two vectors +proc Vector3Subtract*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Subtract".} +# Subtract vector by float value +proc Vector3SubtractValue*(v: Vector3; sub: float32): Vector3 {.RMDEF, importc: "Vector3SubtractValue".} +# Multiply vector by scalar +proc Vector3Scale*(v: Vector3; scalar: float32): Vector3 {.RMDEF, importc: "Vector3Scale".} +# Multiply vector by vector +proc Vector3Multiply*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Multiply".} +# Calculate two vectors cross product +proc Vector3CrossProduct*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3CrossProduct".} +# Calculate one vector perpendicular vector +proc Vector3Perpendicular*(v: Vector3): Vector3 {.RMDEF, importc: "Vector3Perpendicular".} +# Calculate vector length +proc Vector3Length*(v: ptr Vector3): float32 {.RMDEF, importc: "Vector3Length".} +# Calculate vector square length +proc Vector3LengthSqr*(v: ptr Vector3): float32 {.RMDEF, importc: "Vector3LengthSqr".} +# Calculate two vectors dot product +proc Vector3DotProduct*(v1: Vector3; v2: Vector3): float32 {.RMDEF, importc: "Vector3DotProduct".} +# Calculate distance between two vectors +proc Vector3Distance*(v1: Vector3; v2: Vector3): float32 {.RMDEF, importc: "Vector3Distance".} +# Negate provided vector (invert direction) +proc Vector3Negate*(v: Vector3): Vector3 {.RMDEF, importc: "Vector3Negate".} +# Divide vector by vector +proc Vector3Divide*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Divide".} +# Normalize provided vector +proc Vector3Normalize*(v: Vector3): Vector3 {.RMDEF, importc: "Vector3Normalize".} +# Orthonormalize provided vectors +# Makes vectors normalized and orthogonal to each other +# Gram-Schmidt function implementation +proc Vector3OrthoNormalize*(v1: ptr Vector3; v2: ptr Vector3) {.RMDEF, importc: "Vector3OrthoNormalize".} +# Transforms a Vector3 by a given Matrix +proc Vector3Transform*(v: Vector3; mat: Matrix): Vector3 {.RMDEF, importc: "Vector3Transform".} +# Transform a vector by quaternion rotation +proc Vector3RotateByQuaternion*(v: Vector3; q: Quaternion): Vector3 {.RMDEF, importc: "Vector3RotateByQuaternion".} +# Calculate linear interpolation between two vectors +proc Vector3Lerp*(v1: Vector3; v2: Vector3; amount: float32): Vector3 {.RMDEF, importc: "Vector3Lerp".} +# Calculate reflected vector to normal +proc Vector3Reflect*(v: Vector3; normal: Vector3): Vector3 {.RMDEF, importc: "Vector3Reflect".} +# Get min value for each pair of components +proc Vector3Min*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Min".} +# Get max value for each pair of components +proc Vector3Max*(v1: Vector3; v2: Vector3): Vector3 {.RMDEF, importc: "Vector3Max".} +# 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 +proc Vector3Barycenter*(p: Vector3; a: Vector3; b: Vector3; c: Vector3): Vector3 {.RMDEF, importc: "Vector3Barycenter".} +# Get Vector3 as float array +proc Vector3ToFloatV*(v: Vector3): float3 {.RMDEF, importc: "Vector3ToFloatV".} +# ---------------------------------------------------------------------------------- +# Module Functions Definition - Matrix math +# ---------------------------------------------------------------------------------- +# Compute matrix determinant +proc MatrixDeterminant*(mat: Matrix): float32 {.RMDEF, importc: "MatrixDeterminant".} +# Get the trace of the matrix (sum of the values along the diagonal) +proc MatrixTrace*(mat: Matrix): float32 {.RMDEF, importc: "MatrixTrace".} +# Transposes provided matrix +proc MatrixTranspose*(mat: Matrix): Matrix {.RMDEF, importc: "MatrixTranspose".} +# Invert provided matrix +proc MatrixInvert*(mat: Matrix): Matrix {.RMDEF, importc: "MatrixInvert".} +# Normalize provided matrix +proc MatrixNormalize*(mat: Matrix): Matrix {.RMDEF, importc: "MatrixNormalize".} +# Get identity matrix +proc MatrixIdentity*(): Matrix {.RMDEF, importc: "MatrixIdentity".} +# Add two matrices +proc MatrixAdd*(left: Matrix; right: Matrix): Matrix {.RMDEF, importc: "MatrixAdd".} +# Subtract two matrices (left - right) +proc MatrixSubtract*(left: Matrix; right: Matrix): Matrix {.RMDEF, importc: "MatrixSubtract".} +# Get two matrix multiplication +# NOTE: When multiplying matrices... the order matters! +proc MatrixMultiply*(left: Matrix; right: Matrix): Matrix {.RMDEF, importc: "MatrixMultiply".} +# Get translation matrix +proc MatrixTranslate*(x: float32; y: float32; z: float32): Matrix {.RMDEF, importc: "MatrixTranslate".} +# Create rotation matrix from axis and angle +# NOTE: Angle should be provided in radians +proc MatrixRotate*(axis: Vector3; angle: float32): Matrix {.RMDEF, importc: "MatrixRotate".} +# Get x-rotation matrix (angle in radians) +proc MatrixRotateX*(angle: float32): Matrix {.RMDEF, importc: "MatrixRotateX".} +# Get y-rotation matrix (angle in radians) +proc MatrixRotateY*(angle: float32): Matrix {.RMDEF, importc: "MatrixRotateY".} +# Get z-rotation matrix (angle in radians) +proc MatrixRotateZ*(angle: float32): Matrix {.RMDEF, importc: "MatrixRotateZ".} +# Get xyz-rotation matrix (angles in radians) +proc MatrixRotateXYZ*(ang: Vector3): Matrix {.RMDEF, importc: "MatrixRotateXYZ".} +# Get zyx-rotation matrix (angles in radians) +proc MatrixRotateZYX*(ang: Vector3): Matrix {.RMDEF, importc: "MatrixRotateZYX".} +# Get scaling matrix +proc MatrixScale*(x: float32; y: float32; z: float32): Matrix {.RMDEF, importc: "MatrixScale".} +# Get perspective projection matrix +proc MatrixFrustum*(left: float64; right: float64; bottom: float64; top: float64; near: float64; far: float64): Matrix {.RMDEF, importc: "MatrixFrustum".} +# Get perspective projection matrix +# NOTE: Angle should be provided in radians +proc MatrixPerspective*(fovy: float64; aspect: float64; near: float64; far: float64): Matrix {.RMDEF, importc: "MatrixPerspective".} +# Get orthographic projection matrix +proc MatrixOrtho*(left: float64; right: float64; bottom: float64; top: float64; near: float64; far: float64): Matrix {.RMDEF, importc: "MatrixOrtho".} +# Get camera look-at matrix (view matrix) +proc MatrixLookAt*(eye: Vector3; target: Vector3; up: Vector3): Matrix {.RMDEF, importc: "MatrixLookAt".} +# Get float array of matrix data +proc MatrixToFloatV*(mat: Matrix): float16 {.RMDEF, importc: "MatrixToFloatV".} +# ---------------------------------------------------------------------------------- +# Module Functions Definition - Quaternion math +# ---------------------------------------------------------------------------------- +# Add two quaternions +proc QuaternionAdd*(q1: Quaternion; q2: Quaternion): Quaternion {.RMDEF, importc: "QuaternionAdd".} +# Add quaternion and float value +proc QuaternionAddValue*(q: Quaternion; add: float32): Quaternion {.RMDEF, importc: "QuaternionAddValue".} +# Subtract two quaternions +proc QuaternionSubtract*(q1: Quaternion; q2: Quaternion): Quaternion {.RMDEF, importc: "QuaternionSubtract".} +# Subtract quaternion and float value +proc QuaternionSubtractValue*(q: Quaternion; sub: float32): Quaternion {.RMDEF, importc: "QuaternionSubtractValue".} +# Get identity quaternion +proc QuaternionIdentity*(): Quaternion {.RMDEF, importc: "QuaternionIdentity".} +# Computes the length of a quaternion +proc QuaternionLength*(q: Quaternion): float32 {.RMDEF, importc: "QuaternionLength".} +# Normalize provided quaternion +proc QuaternionNormalize*(q: Quaternion): Quaternion {.RMDEF, importc: "QuaternionNormalize".} +# Invert provided quaternion +proc QuaternionInvert*(q: Quaternion): Quaternion {.RMDEF, importc: "QuaternionInvert".} +# Calculate two quaternion multiplication +proc QuaternionMultiply*(q1: Quaternion; q2: Quaternion): Quaternion {.RMDEF, importc: "QuaternionMultiply".} +# Scale quaternion by float value +proc QuaternionScale*(q: Quaternion; mul: float32): Quaternion {.RMDEF, importc: "QuaternionScale".} +# Divide two quaternions +proc QuaternionDivide*(q1: Quaternion; q2: Quaternion): Quaternion {.RMDEF, importc: "QuaternionDivide".} +# Calculate linear interpolation between two quaternions +proc QuaternionLerp*(q1: Quaternion; q2: Quaternion; amount: float32): Quaternion {.RMDEF, importc: "QuaternionLerp".} +# Calculate slerp-optimized interpolation between two quaternions +proc QuaternionNlerp*(q1: Quaternion; q2: Quaternion; amount: float32): Quaternion {.RMDEF, importc: "QuaternionNlerp".} +# Calculates spherical linear interpolation between two quaternions +proc QuaternionSlerp*(q1: Quaternion; q2: Quaternion; amount: float32): Quaternion {.RMDEF, importc: "QuaternionSlerp".} +# Calculate quaternion based on the rotation from one vector to another +proc QuaternionFromVector3ToVector3*(fromx: Vector3; to: Vector3): Quaternion {.RMDEF, importc: "QuaternionFromVector3ToVector3".} +# Get a quaternion for a given rotation matrix +proc QuaternionFromMatrix*(mat: Matrix): Quaternion {.RMDEF, importc: "QuaternionFromMatrix".} +# Get a matrix for a given quaternion +proc QuaternionToMatrix*(q: Quaternion): Matrix {.RMDEF, importc: "QuaternionToMatrix".} +# Get rotation quaternion for an angle and axis +# NOTE: angle must be provided in radians +proc QuaternionFromAxisAngle*(axis: Vector3; angle: float32): Quaternion {.RMDEF, importc: "QuaternionFromAxisAngle".} +# Get the rotation angle and axis for a given quaternion +proc QuaternionToAxisAngle*(q: Quaternion; outAxis: ptr Vector3; outAngle: float32) {.RMDEF, importc: "QuaternionToAxisAngle".} +# Get the quaternion equivalent to Euler angles +# NOTE: Rotation order is ZYX +proc QuaternionFromEuler*(pitch: float32; yaw: float32; roll: float32): Quaternion {.RMDEF, importc: "QuaternionFromEuler".} +# Get the Euler angles equivalent to quaternion (roll, pitch, yaw) +# NOTE: Angles are returned in a Vector3 struct in degrees +proc QuaternionToEuler*(q: Quaternion): Vector3 {.RMDEF, importc: "QuaternionToEuler".} +# Transform a quaternion given a transformation matrix +proc QuaternionTransform*(q: Quaternion; mat: Matrix): Quaternion {.RMDEF, importc: "QuaternionTransform".} +# Projects a Vector3 from screen space into object space +proc Vector3Unproject*(source: Vector3; projection: Matrix; view: Matrix): Vector3 {.RMDEF, importc: "Vector3Unproject".} \ No newline at end of file diff --git a/src/lsystempkg/rlgl.nim b/src/lsystempkg/rlgl.nim new file mode 100644 index 0000000..f7b011a --- /dev/null +++ b/src/lsystempkg/rlgl.nim @@ -0,0 +1,318 @@ +# +# rlgl v3.7 - raylib OpenGL abstraction layer +# +# rlgl is a wrapper for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) to +# pseudo-OpenGL 1.1 style functions (rlVertex, rlTranslate, rlRotate...). +# +# When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal +# VBO buffers (and VAOs if available). It requires calling 3 functions: +# rlglInit() - Initialize internal buffers and auxiliary resources +# rlglClose() - De-initialize internal buffers data and other auxiliar resources +# +# CONFIGURATION: +# +# #define GRAPHICS_API_OPENGL_11 +# #define GRAPHICS_API_OPENGL_21 +# #define GRAPHICS_API_OPENGL_33 +# #define GRAPHICS_API_OPENGL_ES2 +# Use selected OpenGL graphics backend, should be supported by platform +# Those preprocessor defines are only used on rlgl module, if OpenGL version is +# required by any other module, use rlGetVersion() to check it +# +# #define RLGL_IMPLEMENTATION +# Generates the implementation of the library into the included file. +# If not defined, the library is in header only mode and can be included in other headers +# or source files without problems. But only ONE file should hold the implementation. +# +# #define RLGL_STANDALONE +# Use rlgl as standalone library (no raylib dependency) +# +# #define SUPPORT_GL_DETAILS_INFO +# Show OpenGL extensions and capabilities detailed logs on init +# +# DEPENDENCIES: +# raymath - 3D math functionality (Vector3, Matrix, Quaternion) +# GLAD - OpenGL extensions loading (OpenGL 3.3 Core only) +# +# +# LICENSE: zlib/libpng +# +# Copyright (c) 2014-2021 Ramon Santamaria (@raysan5) +# +# This software is provided "as-is", without any express or implied warranty. In no event +# will the authors be held liable for any damages arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, including commercial +# applications, and to alter it and redistribute it freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not claim that you +# wrote the original software. If you use this software in a product, an acknowledgment +# in the product documentation would be appreciated but is not required. +# +# 2. Altered source versions must be plainly marked as such, and must not be misrepresented +# as being the original software. +# +# 3. This notice may not be removed or altered from any source distribution. +# +template RLGL_H*(): auto = RLGL_H +{.pragma: RLAPI, cdecl, discardable, dynlib: "libraylib" & LEXT.} +import raylib +# Security check in case no GRAPHICS_API_OPENGL_* defined +# Security check in case multiple GRAPHICS_API_OPENGL_* defined +# OpenGL 2.1 uses most of OpenGL 3.3 Core functionality +# WARNING: Specific parts are checked with #if defines +template SUPPORT_RENDER_TEXTURES_HINT*(): auto = SUPPORT_RENDER_TEXTURES_HINT +# ---------------------------------------------------------------------------------- +# Defines and Macros +# ---------------------------------------------------------------------------------- +# Default internal render batch limits +# Internal Matrix stack +# Vertex buffers id limit +# Shader and material limits +# Projection matrix culling +# Texture parameters (equivalent to OpenGL defines) +template RL_TEXTURE_WRAP_S*(): auto = 0x2802 +template RL_TEXTURE_WRAP_T*(): auto = 0x2803 +template RL_TEXTURE_MAG_FILTER*(): auto = 0x2800 +template RL_TEXTURE_MIN_FILTER*(): auto = 0x2801 +template RL_TEXTURE_FILTER_NEAREST*(): auto = 0x2600 +template RL_TEXTURE_FILTER_LINEAR*(): auto = 0x2601 +template RL_TEXTURE_FILTER_MIP_NEAREST*(): auto = 0x2700 +template RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR*(): auto = 0x2702 +template RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST*(): auto = 0x2701 +template RL_TEXTURE_FILTER_MIP_LINEAR*(): auto = 0x2703 +template RL_TEXTURE_FILTER_ANISOTROPIC*(): auto = 0x3000 +template RL_TEXTURE_WRAP_REPEAT*(): auto = 0x2901 +template RL_TEXTURE_WRAP_CLAMP*(): auto = 0x812F +template RL_TEXTURE_WRAP_MIRROR_REPEAT*(): auto = 0x8370 +template RL_TEXTURE_WRAP_MIRROR_CLAMP*(): auto = 0x8742 +# Matrix modes (equivalent to OpenGL) +template RL_MODELVIEW*(): auto = 0x1700 +template RL_PROJECTION*(): auto = 0x1701 +template RL_TEXTURE*(): auto = 0x1702 +# Primitive assembly draw modes +template RL_LINES*(): auto = 0x0001 +template RL_TRIANGLES*(): auto = 0x0004 +template RL_QUADS*(): auto = 0x0007 +# GL equivalent data types +template RL_UNSIGNED_BYTE*(): auto = 0x1401 +template RL_FLOAT*(): auto = 0x1406 +# ---------------------------------------------------------------------------------- +# Types and Structures Definition +# ---------------------------------------------------------------------------------- +type FramebufferAttachType* = enum + RL_ATTACHMENT_COLOR_CHANNEL0 = 0 + RL_ATTACHMENT_COLOR_CHANNEL1 + RL_ATTACHMENT_COLOR_CHANNEL2 + RL_ATTACHMENT_COLOR_CHANNEL3 + RL_ATTACHMENT_COLOR_CHANNEL4 + RL_ATTACHMENT_COLOR_CHANNEL5 + RL_ATTACHMENT_COLOR_CHANNEL6 + RL_ATTACHMENT_COLOR_CHANNEL7 + RL_ATTACHMENT_DEPTH = 100 + RL_ATTACHMENT_STENCIL = 200 +converter FramebufferAttachType2int32* (self: FramebufferAttachType): int32 = self.int32 +type FramebufferAttachTextureType* = enum + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0 + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z + RL_ATTACHMENT_TEXTURE2D = 100 + RL_ATTACHMENT_RENDERBUFFER = 200 +converter FramebufferAttachTextureType2int32* (self: FramebufferAttachTextureType): int32 = self.int32 +# Dynamic vertex buffers (position + texcoords + colors + indices arrays) +type VertexBuffer* {.bycopy.} = object + elementsCount*: int32 # Number of elements in the buffer (QUADS) + vCounter*: int32 # Vertex position counter to process (and draw) from full buffer + tcCounter*: int32 # Vertex texcoord counter to process (and draw) from full buffer + cCounter*: int32 # Vertex color counter to process (and draw) from full buffer + vertices*: float32 # Vertex position (XYZ - 3 components per vertex) (shader-location = 0) + texcoords*: float32 # Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) + colors*: uint8 # Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) + indices*: uint32 # Vertex indices (in case vertex data comes indexed) (6 indices per quad) + # Skipped another *indices + vaoId*: uint32 # OpenGL Vertex Array Object id + vboId*: array[0..3, uint32] # OpenGL Vertex Buffer Objects id (4 types of vertex data) +# Draw call type +# NOTE: Only texture changes register a new draw, other state-change-related elements are not +# used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any +# of those state-change happens (this is done in core module) +type DrawCall* {.bycopy.} = object + mode*: int32 # Drawing mode: LINES, TRIANGLES, QUADS + vertexCount*: int32 # Number of vertex of the draw + vertexAlignment*: int32 # Number of vertex required for index alignment (LINES, TRIANGLES) + textureId*: uint32 # Texture id to be used on the draw -> Use to create new draw call if changes +# RenderBatch type +type RenderBatch* {.bycopy.} = object + buffersCount*: int32 # Number of vertex buffers (multi-buffering support) + currentBuffer*: int32 # Current buffer tracking in case of multi-buffering + vertexBuffer*: ptr VertexBuffer # Dynamic buffer(s) for vertex data + draws*: ptr DrawCall # Draw calls array, depends on textureId + drawsCounter*: int32 # Draw calls counter + currentDepth*: float32 # Current depth value for next draw +# ------------------------------------------------------------------------------------ +# Functions Declaration - Matrix operations +# ------------------------------------------------------------------------------------ +proc rlMatrixMode*(mode: int32) {.RLAPI, importc: "rlMatrixMode".} # Choose the current matrix to be transformed +proc rlPushMatrix*() {.RLAPI, importc: "rlPushMatrix".} # Push the current matrix to stack +proc rlPopMatrix*() {.RLAPI, importc: "rlPopMatrix".} # Pop lattest inserted matrix from stack +proc rlLoadIdentity*() {.RLAPI, importc: "rlLoadIdentity".} # Reset current matrix to identity matrix +proc rlTranslatef*(x: float32; y: float32; z: float32) {.RLAPI, importc: "rlTranslatef".} # Multiply the current matrix by a translation matrix +proc rlRotatef*(angleDeg: float32; x: float32; y: float32; z: float32) {.RLAPI, importc: "rlRotatef".} # Multiply the current matrix by a rotation matrix +proc rlScalef*(x: float32; y: float32; z: float32) {.RLAPI, importc: "rlScalef".} # Multiply the current matrix by a scaling matrix +proc rlMultMatrixf*(matf: float32) {.RLAPI, importc: "rlMultMatrixf".} # Multiply the current matrix by another matrix +proc rlFrustum*(left: float64; right: float64; bottom: float64; top: float64; znear: float64; zfar: float64) {.RLAPI, importc: "rlFrustum".} +proc rlOrtho*(left: float64; right: float64; bottom: float64; top: float64; znear: float64; zfar: float64) {.RLAPI, importc: "rlOrtho".} +proc rlViewport*(x: int32; y: int32; width: int32; height: int32) {.RLAPI, importc: "rlViewport".} # Set the viewport area +# ------------------------------------------------------------------------------------ +# Functions Declaration - Vertex level operations +# ------------------------------------------------------------------------------------ +proc rlBegin*(mode: int32) {.RLAPI, importc: "rlBegin".} # Initialize drawing mode (how to organize vertex) +proc rlEnd*() {.RLAPI, importc: "rlEnd".} # Finish vertex providing +proc rlVertex2i*(x: int32; y: int32) {.RLAPI, importc: "rlVertex2i".} # Define one vertex (position) - 2 int +proc rlVertex2f*(x: float32; y: float32) {.RLAPI, importc: "rlVertex2f".} # Define one vertex (position) - 2 float +proc rlVertex3f*(x: float32; y: float32; z: float32) {.RLAPI, importc: "rlVertex3f".} # Define one vertex (position) - 3 float +proc rlTexCoord2f*(x: float32; y: float32) {.RLAPI, importc: "rlTexCoord2f".} # Define one vertex (texture coordinate) - 2 float +proc rlNormal3f*(x: float32; y: float32; z: float32) {.RLAPI, importc: "rlNormal3f".} # Define one vertex (normal) - 3 float +proc rlColor4ub*(r: uint8; g: uint8; b: uint8; a: uint8) {.RLAPI, importc: "rlColor4ub".} # Define one vertex (color) - 4 byte +proc rlColor3f*(x: float32; y: float32; z: float32) {.RLAPI, importc: "rlColor3f".} # Define one vertex (color) - 3 float +proc rlColor4f*(x: float32; y: float32; z: float32; w: float32) {.RLAPI, importc: "rlColor4f".} # Define one vertex (color) - 4 float +# ------------------------------------------------------------------------------------ +# Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2) +# NOTE: This functions are used to completely abstract raylib code from OpenGL layer, +# some of them are direct wrappers over OpenGL calls, some others are custom +# ------------------------------------------------------------------------------------ +# Vertex buffers state +proc rlEnableVertexArray*(vaoId: uint32): bool {.RLAPI, importc: "rlEnableVertexArray".} # Enable vertex array (VAO, if supported) +proc rlDisableVertexArray*() {.RLAPI, importc: "rlDisableVertexArray".} # Disable vertex array (VAO, if supported) +proc rlEnableVertexBuffer*(id: uint32) {.RLAPI, importc: "rlEnableVertexBuffer".} # Enable vertex buffer (VBO) +proc rlDisableVertexBuffer*() {.RLAPI, importc: "rlDisableVertexBuffer".} # Disable vertex buffer (VBO) +proc rlEnableVertexBufferElement*(id: uint32) {.RLAPI, importc: "rlEnableVertexBufferElement".} # Enable vertex buffer element (VBO element) +proc rlDisableVertexBufferElement*() {.RLAPI, importc: "rlDisableVertexBufferElement".} # Disable vertex buffer element (VBO element) +proc rlEnableVertexAttribute*(index: uint32) {.RLAPI, importc: "rlEnableVertexAttribute".} # Enable vertex attribute index +proc rlDisableVertexAttribute*(index: uint32) {.RLAPI, importc: "rlDisableVertexAttribute".} # Disable vertex attribute index +proc rlEnableStatePointer*(vertexAttribType: int32; buffer: pointer) {.RLAPI, importc: "rlEnableStatePointer".} +proc rlDisableStatePointer*(vertexAttribType: int32) {.RLAPI, importc: "rlDisableStatePointer".} +# Textures state +proc rlActiveTextureSlot*(slot: int32) {.RLAPI, importc: "rlActiveTextureSlot".} # Select and active a texture slot +proc rlEnableTexture*(id: uint32) {.RLAPI, importc: "rlEnableTexture".} # Enable texture +proc rlDisableTexture*() {.RLAPI, importc: "rlDisableTexture".} # Disable texture +proc rlEnableTextureCubemap*(id: uint32) {.RLAPI, importc: "rlEnableTextureCubemap".} # Enable texture cubemap +proc rlDisableTextureCubemap*() {.RLAPI, importc: "rlDisableTextureCubemap".} # Disable texture cubemap +proc rlTextureParameters*(id: uint32; param: int32; value: int32) {.RLAPI, importc: "rlTextureParameters".} # Set texture parameters (filter, wrap) +# Shader state +proc rlEnableShader*(id: uint32) {.RLAPI, importc: "rlEnableShader".} # Enable shader program +proc rlDisableShader*() {.RLAPI, importc: "rlDisableShader".} # Disable shader program +# Framebuffer state +proc rlEnableFramebuffer*(id: uint32) {.RLAPI, importc: "rlEnableFramebuffer".} # Enable render texture (fbo) +proc rlDisableFramebuffer*() {.RLAPI, importc: "rlDisableFramebuffer".} # Disable render texture (fbo), return to default framebuffer +# General render state +proc rlEnableDepthTest*() {.RLAPI, importc: "rlEnableDepthTest".} # Enable depth test +proc rlDisableDepthTest*() {.RLAPI, importc: "rlDisableDepthTest".} # Disable depth test +proc rlEnableDepthMask*() {.RLAPI, importc: "rlEnableDepthMask".} # Enable depth write +proc rlDisableDepthMask*() {.RLAPI, importc: "rlDisableDepthMask".} # Disable depth write +proc rlEnableBackfaceCulling*() {.RLAPI, importc: "rlEnableBackfaceCulling".} # Enable backface culling +proc rlDisableBackfaceCulling*() {.RLAPI, importc: "rlDisableBackfaceCulling".} # Disable backface culling +proc rlEnableScissorTest*() {.RLAPI, importc: "rlEnableScissorTest".} # Enable scissor test +proc rlDisableScissorTest*() {.RLAPI, importc: "rlDisableScissorTest".} # Disable scissor test +proc rlScissor*(x: int32; y: int32; width: int32; height: int32) {.RLAPI, importc: "rlScissor".} # Scissor test +proc rlEnableWireMode*() {.RLAPI, importc: "rlEnableWireMode".} # Enable wire mode +proc rlDisableWireMode*() {.RLAPI, importc: "rlDisableWireMode".} # Disable wire mode +proc rlSetLineWidth*(width: float32) {.RLAPI, importc: "rlSetLineWidth".} # Set the line drawing width +proc rlGetLineWidth*(): float32 {.RLAPI, importc: "rlGetLineWidth".} # Get the line drawing width +proc rlEnableSmoothLines*() {.RLAPI, importc: "rlEnableSmoothLines".} # Enable line aliasing +proc rlDisableSmoothLines*() {.RLAPI, importc: "rlDisableSmoothLines".} # Disable line aliasing +proc rlEnableStereoRender*() {.RLAPI, importc: "rlEnableStereoRender".} # Enable stereo rendering +proc rlDisableStereoRender*() {.RLAPI, importc: "rlDisableStereoRender".} # Disable stereo rendering +proc rlIsStereoRenderEnabled*(): bool {.RLAPI, importc: "rlIsStereoRenderEnabled".} # Check if stereo render is enabled +proc rlClearColor*(r: uint8; g: uint8; b: uint8; a: uint8) {.RLAPI, importc: "rlClearColor".} # Clear color buffer with color +proc rlClearScreenBuffers*() {.RLAPI, importc: "rlClearScreenBuffers".} # Clear used screen buffers (color and depth) +proc rlCheckErrors*() {.RLAPI, importc: "rlCheckErrors".} # Check and log OpenGL error codes +proc rlSetBlendMode*(mode: int32) {.RLAPI, importc: "rlSetBlendMode".} # Set blending mode +proc rlSetBlendFactors*(glSrcFactor: int32; glDstFactor: int32; glEquation: int32) {.RLAPI, importc: "rlSetBlendFactors".} # Set blending mode factor and equation (using OpenGL factors) +# ------------------------------------------------------------------------------------ +# Functions Declaration - rlgl functionality +# ------------------------------------------------------------------------------------ +# rlgl initialization functions +proc rlglInit*(width: int32; height: int32) {.RLAPI, importc: "rlglInit".} # Initialize rlgl (buffers, shaders, textures, states) +proc rlglClose*() {.RLAPI, importc: "rlglClose".} # De-inititialize rlgl (buffers, shaders, textures) +proc rlLoadExtensions*(loader: pointer) {.RLAPI, importc: "rlLoadExtensions".} # Load OpenGL extensions (loader function required) +proc rlGetVersion*(): int32 {.RLAPI, importc: "rlGetVersion".} # Get current OpenGL version +proc rlGetFramebufferWidth*(): int32 {.RLAPI, importc: "rlGetFramebufferWidth".} # Get default framebuffer width +proc rlGetFramebufferHeight*(): int32 {.RLAPI, importc: "rlGetFramebufferHeight".} # Get default framebuffer height +proc rlGetShaderDefault*(): Shader {.RLAPI, importc: "rlGetShaderDefault".} # Get default shader +proc rlGetTextureDefault*(): Texture2D {.RLAPI, importc: "rlGetTextureDefault".} # Get default texture +# Render batch management +# NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode +# but this render batch API is exposed in case of custom batches are required +proc rlLoadRenderBatch*(numBuffers: int32; bufferElements: int32): RenderBatch {.RLAPI, importc: "rlLoadRenderBatch".} # Load a render batch system +proc rlUnloadRenderBatch*(batch: RenderBatch) {.RLAPI, importc: "rlUnloadRenderBatch".} # Unload render batch system +proc rlDrawRenderBatch*(batch: ptr RenderBatch) {.RLAPI, importc: "rlDrawRenderBatch".} # Draw render batch data (Update->Draw->Reset) +proc rlSetRenderBatchActive*(batch: ptr RenderBatch) {.RLAPI, importc: "rlSetRenderBatchActive".} # Set the active render batch for rlgl (NULL for default internal) +proc rlDrawRenderBatchActive*() {.RLAPI, importc: "rlDrawRenderBatchActive".} # Update and draw internal render batch +proc rlCheckRenderBatchLimit*(vCount: int32): bool {.RLAPI, importc: "rlCheckRenderBatchLimit".} # Check internal buffer overflow for a given number of vertex +proc rlSetTexture*(id: uint32) {.RLAPI, importc: "rlSetTexture".} # Set current texture for render batch and check buffers limits +# ------------------------------------------------------------------------------------------------------------------------ +# Vertex buffers management +proc rlLoadVertexArray*(): uint32 {.RLAPI, importc: "rlLoadVertexArray".} # Load vertex array (vao) if supported +proc rlLoadVertexBuffer*(buffer: pointer; size: int32; dynamic: bool): uint32 {.RLAPI, importc: "rlLoadVertexBuffer".} # Load a vertex buffer attribute +proc rlLoadVertexBufferElement*(buffer: pointer; size: int32; dynamic: bool): uint32 {.RLAPI, importc: "rlLoadVertexBufferElement".} # Load a new attributes element buffer +proc rlUpdateVertexBuffer*(bufferId: int32; data: pointer; dataSize: int32; offset: int32) {.RLAPI, importc: "rlUpdateVertexBuffer".} # Update GPU buffer with new data +proc rlUnloadVertexArray*(vaoId: uint32) {.RLAPI, importc: "rlUnloadVertexArray".} +proc rlUnloadVertexBuffer*(vboId: uint32) {.RLAPI, importc: "rlUnloadVertexBuffer".} +proc rlSetVertexAttribute*(index: uint32; compSize: int32; typex: int32; normalized: bool; stride: int32; pointer: pointer) {.RLAPI, importc: "rlSetVertexAttribute".} +proc rlSetVertexAttributeDivisor*(index: uint32; divisor: int32) {.RLAPI, importc: "rlSetVertexAttributeDivisor".} +proc rlSetVertexAttributeDefault*(locIndex: int32; value: pointer; attribType: int32; count: int32) {.RLAPI, importc: "rlSetVertexAttributeDefault".} # Set vertex attribute default value +proc rlDrawVertexArray*(offset: int32; count: int32) {.RLAPI, importc: "rlDrawVertexArray".} +proc rlDrawVertexArrayElements*(offset: int32; count: int32; buffer: pointer) {.RLAPI, importc: "rlDrawVertexArrayElements".} +proc rlDrawVertexArrayInstanced*(offset: int32; count: int32; instances: int32) {.RLAPI, importc: "rlDrawVertexArrayInstanced".} +proc rlDrawVertexArrayElementsInstanced*(offset: int32; count: int32; buffer: pointer; instances: int32) {.RLAPI, importc: "rlDrawVertexArrayElementsInstanced".} +# Textures management +proc rlLoadTexture*(data: pointer; width: int32; height: int32; format: int32; mipmapCount: int32): uint32 {.RLAPI, importc: "rlLoadTexture".} # Load texture in GPU +proc rlLoadTextureDepth*(width: int32; height: int32; useRenderBuffer: bool): uint32 {.RLAPI, importc: "rlLoadTextureDepth".} # Load depth texture/renderbuffer (to be attached to fbo) +proc rlLoadTextureCubemap*(data: pointer; size: int32; format: int32): uint32 {.RLAPI, importc: "rlLoadTextureCubemap".} # Load texture cubemap +proc rlUpdateTexture*(id: uint32; offsetX: int32; offsetY: int32; width: int32; height: int32; format: int32; data: pointer) {.RLAPI, importc: "rlUpdateTexture".} # Update GPU texture with new data +proc rlGetGlTextureFormats*(format: int32; glInternalFormat: uint32; glFormat: uint32; glType: uint32) {.RLAPI, importc: "rlGetGlTextureFormats".} # Get OpenGL internal formats +proc rlGetPixelFormatName*(format: uint32): cstring {.RLAPI, importc: "rlGetPixelFormatName".} # Get name string for pixel format +proc rlUnloadTexture*(id: uint32) {.RLAPI, importc: "rlUnloadTexture".} # Unload texture from GPU memory +proc rlGenerateMipmaps*(texture: ptr Texture2D) {.RLAPI, importc: "rlGenerateMipmaps".} # Generate mipmap data for selected texture +proc rlReadTexturePixels*(texture: Texture2D): pointer {.RLAPI, importc: "rlReadTexturePixels".} # Read texture pixel data +proc rlReadScreenPixels*(width: int32; height: int32): uint8 {.RLAPI, importc: "rlReadScreenPixels".} # Read screen pixel data (color buffer) +# Framebuffer management (fbo) +proc rlLoadFramebuffer*(width: int32; height: int32): uint32 {.RLAPI, importc: "rlLoadFramebuffer".} # Load an empty framebuffer +proc rlFramebufferAttach*(fboId: uint32; texId: uint32; attachType: int32; texType: int32; mipLevel: int32) {.RLAPI, importc: "rlFramebufferAttach".} # Attach texture/renderbuffer to a framebuffer +proc rlFramebufferComplete*(id: uint32): bool {.RLAPI, importc: "rlFramebufferComplete".} # Verify framebuffer is complete +proc rlUnloadFramebuffer*(id: uint32) {.RLAPI, importc: "rlUnloadFramebuffer".} # Delete framebuffer from GPU +# Shaders management +proc rlLoadShaderCode*(vsCode: cstring; fsCode: cstring): uint32 {.RLAPI, importc: "rlLoadShaderCode".} # Load shader from code strings +proc rlCompileShader*(shaderCode: cstring; typex: int32): uint32 {.RLAPI, importc: "rlCompileShader".} # Compile custom shader and return shader id (type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER) +proc rlLoadShaderProgram*(vShaderId: uint32; fShaderId: uint32): uint32 {.RLAPI, importc: "rlLoadShaderProgram".} # Load custom shader program +proc rlUnloadShaderProgram*(id: uint32) {.RLAPI, importc: "rlUnloadShaderProgram".} # Unload shader program +proc rlGetLocationUniform*(shaderId: uint32; uniformName: cstring): int32 {.RLAPI, importc: "rlGetLocationUniform".} # Get shader location uniform +proc rlGetLocationAttrib*(shaderId: uint32; attribName: cstring): int32 {.RLAPI, importc: "rlGetLocationAttrib".} # Get shader location attribute +proc rlSetUniform*(locIndex: int32; value: pointer; uniformType: int32; count: int32) {.RLAPI, importc: "rlSetUniform".} # Set shader value uniform +proc rlSetUniformMatrix*(locIndex: int32; mat: Matrix) {.RLAPI, importc: "rlSetUniformMatrix".} # Set shader value matrix +proc rlSetUniformSampler*(locIndex: int32; textureId: uint32) {.RLAPI, importc: "rlSetUniformSampler".} # Set shader value sampler +proc rlSetShader*(shader: Shader) {.RLAPI, importc: "rlSetShader".} # Set shader currently active +# Matrix state management +proc rlGetMatrixModelview*(): Matrix {.RLAPI, importc: "rlGetMatrixModelview".} # Get internal modelview matrix +proc rlGetMatrixProjection*(): Matrix {.RLAPI, importc: "rlGetMatrixProjection".} # Get internal projection matrix +proc rlGetMatrixTransform*(): Matrix {.RLAPI, importc: "rlGetMatrixTransform".} # Get internal accumulated transform matrix +proc rlGetMatrixProjectionStereo*(eye: int32): Matrix {.RLAPI, importc: "rlGetMatrixProjectionStereo".} # Get internal projection matrix for stereo render (selected eye) +proc rlGetMatrixViewOffsetStereo*(eye: int32): Matrix {.RLAPI, importc: "rlGetMatrixViewOffsetStereo".} # Get internal view offset matrix for stereo render (selected eye) +proc rlSetMatrixProjection*(proj: Matrix) {.RLAPI, importc: "rlSetMatrixProjection".} # Set a custom projection matrix (replaces internal projection matrix) +proc rlSetMatrixModelview*(view: Matrix) {.RLAPI, importc: "rlSetMatrixModelview".} # Set a custom modelview matrix (replaces internal modelview matrix) +proc rlSetMatrixProjectionStereo*(right: Matrix; left: Matrix) {.RLAPI, importc: "rlSetMatrixProjectionStereo".} # Set eyes projection matrices for stereo rendering +proc rlSetMatrixViewOffsetStereo*(right: Matrix; left: Matrix) {.RLAPI, importc: "rlSetMatrixViewOffsetStereo".} # Set eyes view offsets matrices for stereo rendering +# Quick and dirty cube/quad buffers load->draw->unload +proc rlLoadDrawCube*() {.RLAPI, importc: "rlLoadDrawCube".} # Load and draw a cube +proc rlLoadDrawQuad*() {.RLAPI, importc: "rlLoadDrawQuad".} # Load and draw a quad +# +# RLGL IMPLEMENTATION +# +type rlglLoadProc* = proc() +# ---------------------------------------------------------------------------------- +# Global Variables Definition +# ---------------------------------------------------------------------------------- \ No newline at end of file diff --git a/styles/README.md b/styles/README.md new file mode 100644 index 0000000..2b07017 --- /dev/null +++ b/styles/README.md @@ -0,0 +1,36 @@ +## raygui styles + +`raygui` comes with **8 custom styles** carefully designed for the best visual experience. Those styles have been created using [rGuiStyler](https://raylibtech.itch.io/rguistyler) tool and they complement internal [default style](default), always available by `raygui`. + +To use those styles with your `raygui` development, just need to call `GuiLoadStyle()` function at initialization, passing the `.rgs` file to load. Note that most of those styles depend on custom fonts that must be available together with the `.rgs` file. + +Here it is a quick overview of those styles, you can navigate to each directory for additional information. + +#### style: [default](default) +![default style](default/style_table.png) + +#### style: [ashes](ashes) +![ashes style](ashes/style_table.png) + +#### style: [bluish](bluish) +![bluish style](bluish/style_table.png) + +#### style: [candy](candy) +![candy style](candy/style_table.png) + +#### style: [cherry](cherry) +![cherry style](cherry/style_table.png) + +#### style: [cyber](cyber) +![cyber style](cyber/style_table.png) + +#### style: [jungle](jungle) +![jungle style](jungle/style_table.png) + +#### style: [lavanda](lavanda) +![lavanda style](lavanda/style_table.png) + +#### style: [terminal](terminal) +![terminal style](terminal/style_table.png) + +*NOTE: Those styles require latest raylib 2.6-dev and latest raygui 2.6-dev.* diff --git a/styles/ashes/README.md b/styles/ashes/README.md new file mode 100644 index 0000000..dc8adc0 --- /dev/null +++ b/styles/ashes/README.md @@ -0,0 +1,16 @@ +style: ashes +------------- +What once was life now is ashes, just as slight reminiscense covers the ground, a gray sequence of tones that reminds to a distant past. + +![ashes style table](style_table.png) + +screenshot +----------- + +![ashes style screen](screenshot.png) + +about font +----------- +"V5 Loxica Lixera" font by vFive Digital (Roberto Christen). + +100% free font, downloaded from dafont.com: [v5loxica-lixera](https://www.dafont.com/v5loxica-lixera.font) diff --git a/styles/ashes/ashes.rgs b/styles/ashes/ashes.rgs new file mode 100644 index 0000000..45ab7bd --- /dev/null +++ b/styles/ashes/ashes.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 16 0 v5loxical.ttf +p 00 00 0xf0f0f0ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x868686ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0xe6e6e6ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0x929999ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xeaeaeaff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0x98a1a8ff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0x3f3f3fff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0xf6f6f6ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0x414141ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x8b8b8bff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x777777ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x959595ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x00000010 TEXT_SIZE +p 00 17 0x00000001 TEXT_SPACING +p 00 18 0x9dadb1ff DEFAULT_LINE_COLOR +p 00 19 0x6b6b6bff DEFAULT_BACKGROUND_COLOR diff --git a/styles/ashes/font_readme.txt b/styles/ashes/font_readme.txt new file mode 100644 index 0000000..1a6b338 --- /dev/null +++ b/styles/ashes/font_readme.txt @@ -0,0 +1,51 @@ + +V5 Loxica +--------------- +Instructions: + + +++ Loxica (LIXERA) ++ + +For screen use, set at 16pt. Turn +antialiasing off. Set tracking to zero +for best results. + +++ Loxica (ROBUSTA) ++ + +For screen use, set at 18pt. Turn +antialiasing off. Set tracking to zero +for best results. + + +Notes: + +1. These faces do not contain any hinting +information since they were built for use +at the sizes listed above. Naturally, for +print use you are free to experiment. + +2. Although the intended size for _lixera_ +is 16pt (vs. 18pt for _robusta_), they share +the same optical size (where lixera is the +regular weight, and robusta is the bold). + +3. Pronounciation: "lo-hee-ka lee-he-ra", and +"lo-hee-ka ro-bus-ta." + + + +--------------- +Usage: This is a free font--you may use +this and other V5 fonts at will. It may not +be sold, altered, or improperly credited, +however. All I ask is that you kindly inform +me if you find this font useful, and where +you've used it. + +Enjoy, + +©2000 +Roberto Christen +rob@vfive.com + + diff --git a/styles/ashes/screenshot.png b/styles/ashes/screenshot.png new file mode 100644 index 0000000..f86859a Binary files /dev/null and b/styles/ashes/screenshot.png differ diff --git a/styles/ashes/style_table.png b/styles/ashes/style_table.png new file mode 100644 index 0000000..8fcee09 Binary files /dev/null and b/styles/ashes/style_table.png differ diff --git a/styles/ashes/v5loxical.ttf b/styles/ashes/v5loxical.ttf new file mode 100644 index 0000000..61501cb Binary files /dev/null and b/styles/ashes/v5loxical.ttf differ diff --git a/styles/bluish/README.md b/styles/bluish/README.md new file mode 100644 index 0000000..1057dde --- /dev/null +++ b/styles/bluish/README.md @@ -0,0 +1,16 @@ +style: bluish +-------------- +Like a breeze, a slight touch of color cover the clear sky, a spacious and relaxing feeling. + +![bluish style table](style_table.png) + +screenshot +----------- + +![bluish style screen](screenshot.png) + +about font +----------- +"Homespun BRK" font by AEnigma (Brian Kent). + +100% free font, downloaded from dafont.com: [homespun-brk](https://www.dafont.com/homespun-brk.font) diff --git a/styles/bluish/bluish.rgs b/styles/bluish/bluish.rgs new file mode 100644 index 0000000..9a2b7c4 --- /dev/null +++ b/styles/bluish/bluish.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 10 0 homespun.ttf +p 00 00 0x5ca6a6ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0xb4e8f3ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0x447e77ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0x5f8792ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xcdeff7ff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0x4c6c74ff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0x3b5b5fff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0xeaffffff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0x275057ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x96aaacff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0xc8d7d9ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x8c9c9eff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x0000000a TEXT_SIZE +p 00 17 0x00000001 TEXT_SPACING +p 00 18 0x84adb7ff DEFAULT_LINE_COLOR +p 00 19 0xe8eef1ff DEFAULT_BACKGROUND_COLOR diff --git a/styles/bluish/font_readme.txt b/styles/bluish/font_readme.txt new file mode 100644 index 0000000..8dd9bdc --- /dev/null +++ b/styles/bluish/font_readme.txt @@ -0,0 +1,76 @@ +_______________________________ +Homespun Created by Brian Kent +¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ +Thanks for Downloading Homespun. + +Homespun TT [.ttf] +Homespun [8pt] [.fon] + + + 'homespun.fon' is a Windows Bitmap Font (.fon). This font is best +used at 8pt. To use it at larger point sizes (for images), try using +a graphics program like Photoshop, Paint Shop Pro, or the Paint +program that comes with Windows. Type out your text at the recommended +point size [8pt], then resize the image. Set the color mode to 256 +or 2 colors so the edges don't get blured when resizing, then after you +have the text to the size that you want, then change back to a higher +color mode and edit the image. + + For programs that don't show Bitmap Fonts in the Font Selector, you +may be able to get the font to work by typing in: +homespun brk + + When using the TTF version, try using it with anti-aliasing off. + + +If you have any questions or comments, you can e-mail me at +kentpw@norwich.net + +You can visit my Webpage <ÆNIGMA GAMES & FONTS> at +http://www.aenigmafonts.com/ + +________________ +INSTALLING FONTS +¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ + There's a couple of ways to install Fonts. The 'easy' way to +install fonts is to just Unzip/place the font file [.ttf] into your +Windows\Fonts directory (I always use this method). If you're unable +to do it the 'easy' way, then try to do it this way (for Windows +95/98/NT): + +1] Unzip the Font(s) to a folder (or somewhere, just remember where +you unzipped it) on your Computer. + +2] Next, click on the START button, then select SETTINGS then +CONTROL PANEL. + +3] When the Control Panel Window pops up, Double Click on FONTS. + +4] When the FONTS window pops up, select File then Install New Font... + +5] A Add Fonts window will pop up, just go to the folder that you +unzipped the Font(s) to, select the Font(s) and then click on OK. +Now the Font(s) are installed. + + Now you can use the Font(s) in programs that utilize Fonts. Make +sure that you install the font(s) first, then open up your apps +(so the app will recognize the font). Sometimes you'll have to +wait until your computer 'auto-refreshes' for programs to recognize +fonts (Windows is sometimes slow to do that). You can refresh your +computer quicker by going into Windows Explorer -or- My Computer and +press F5 (or in the menubar select VIEW then REFRESH). + + +__________ +DISCLAIMER +¯¯¯¯¯¯¯¯¯¯ +-The font(s) in this zip file were created by me (Brian Kent). All +of my Fonts are Freeware, you can use them any way you want to +(Personal use, Commercial use, or whatever). + +-If you have a Font related site and would like to offer my fonts on +your site, go right ahead. All I ask is that you keep this text file +intact with the Font. + +-You may not Sell or Distribute my Fonts for profit or alter them in +any way without asking me first. [e-mail - kentpw@norwich.net] diff --git a/styles/bluish/homespun.ttf b/styles/bluish/homespun.ttf new file mode 100644 index 0000000..45c23e0 Binary files /dev/null and b/styles/bluish/homespun.ttf differ diff --git a/styles/bluish/screenshot.png b/styles/bluish/screenshot.png new file mode 100644 index 0000000..3255fdc Binary files /dev/null and b/styles/bluish/screenshot.png differ diff --git a/styles/bluish/style_table.png b/styles/bluish/style_table.png new file mode 100644 index 0000000..6889f6c Binary files /dev/null and b/styles/bluish/style_table.png differ diff --git a/styles/candy/README.md b/styles/candy/README.md new file mode 100644 index 0000000..3442189 --- /dev/null +++ b/styles/candy/README.md @@ -0,0 +1,16 @@ +style: candy +------------- +Sweet, colorful, tasty! Enjoy this funfair ride and be careful with the witch of the candy house! + +![candy style table](style_table.png) + +screenshot +----------- + +![candy style screen](screenshot.png) + +about font +----------- +"V5 Eastergothic" font by vFive Digital (Roberto Christen). + +100% free font, downloaded from dafont.com: [v5eastergothic](https://www.dafont.com/v5eastergothic.font) diff --git a/styles/candy/candy.rgs b/styles/candy/candy.rgs new file mode 100644 index 0000000..0ba56a7 --- /dev/null +++ b/styles/candy/candy.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 15 0 v5easter.ttf +p 00 00 0xe58b68ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0xfeda96ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0xe59b5fff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0xee813fff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xfcd85bff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0xfc6955ff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0xb34848ff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0xeb7272ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0xbd4a4aff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x94795dff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0xc2a37aff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x9c8369ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x0000000f TEXT_SIZE +p 00 17 0x00000001 TEXT_SPACING +p 00 18 0xd77575ff DEFAULT_LINE_COLOR +p 00 19 0xfff5e1ff DEFAULT_BACKGROUND_COLOR diff --git a/styles/candy/font_readme.txt b/styles/candy/font_readme.txt new file mode 100644 index 0000000..cfd8cb2 --- /dev/null +++ b/styles/candy/font_readme.txt @@ -0,0 +1,27 @@ + +V5 Easter Gothic +---------------- +Instructions: + + +++ Easter Gothic ++ + +For screen use, set at 15pt or any multiple +of 15 (display). Turn antialiasing off. Set +tracking to 100 for best results. + +--------------- +Usage: This is a free font--you may use +this and other V5 fonts at will. It may not +be sold, altered, or improperly credited, +however. All I ask is that you kindly inform +me if you find this font useful, and where +you've used it. + +Enjoy, + +©2000 +Roberto Christen +rob@vfive.com + + diff --git a/styles/candy/screenshot.png b/styles/candy/screenshot.png new file mode 100644 index 0000000..e84aef3 Binary files /dev/null and b/styles/candy/screenshot.png differ diff --git a/styles/candy/style_table.png b/styles/candy/style_table.png new file mode 100644 index 0000000..fcbf972 Binary files /dev/null and b/styles/candy/style_table.png differ diff --git a/styles/candy/v5easter.ttf b/styles/candy/v5easter.ttf new file mode 100644 index 0000000..77a911a Binary files /dev/null and b/styles/candy/v5easter.ttf differ diff --git a/styles/cherry/README.md b/styles/cherry/README.md new file mode 100644 index 0000000..eb9f3d1 --- /dev/null +++ b/styles/cherry/README.md @@ -0,0 +1,16 @@ +style: cherry +-------------- +Sweet with a touch of liquour, covered in chocolate, just give it a try! Not suitable for every palate, only the most demanding. + +![cherry style table](style_table.png) + +screenshot +----------- + +![cherry style screen](screenshot.png) + +about font +----------- +"Westington" font by Hazel Abbiati. + +100% free font, downloaded from dafont.com: [westington](https://www.dafont.com/westington.font) diff --git a/styles/cherry/Westington.ttf b/styles/cherry/Westington.ttf new file mode 100644 index 0000000..68efae8 Binary files /dev/null and b/styles/cherry/Westington.ttf differ diff --git a/styles/cherry/cherry.rgs b/styles/cherry/cherry.rgs new file mode 100644 index 0000000..a830816 --- /dev/null +++ b/styles/cherry/cherry.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 15 0 Westington.ttf +p 00 00 0xda5757ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x753233ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0xe17373ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0xfaaa97ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xe06262ff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0xfdb4aaff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0xe03c46ff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0x5b1e20ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0xc2474fff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0xa19292ff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x706060ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x9e8585ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x0000000f TEXT_SIZE +p 00 17 0x00000000 TEXT_SPACING +p 00 18 0xfb8170ff DEFAULT_LINE_COLOR +p 00 19 0x3a1720ff DEFAULT_BACKGROUND_COLOR diff --git a/styles/cherry/screenshot.png b/styles/cherry/screenshot.png new file mode 100644 index 0000000..669a40b Binary files /dev/null and b/styles/cherry/screenshot.png differ diff --git a/styles/cherry/style_table.png b/styles/cherry/style_table.png new file mode 100644 index 0000000..b556206 Binary files /dev/null and b/styles/cherry/style_table.png differ diff --git a/styles/cyber/Kyrou 7 Wide.ttf b/styles/cyber/Kyrou 7 Wide.ttf new file mode 100644 index 0000000..4c86f19 Binary files /dev/null and b/styles/cyber/Kyrou 7 Wide.ttf differ diff --git a/styles/cyber/README.md b/styles/cyber/README.md new file mode 100644 index 0000000..10de60b --- /dev/null +++ b/styles/cyber/README.md @@ -0,0 +1,16 @@ +style: cyber +------------- +Future is now! Neons and shadows, city never sleeps! Robots waiting in the corners and expensive vending machines! You got the style! + +![cyber style table](style_table.png) + +screenshot +----------- + +![cyber style screen](screenshot.png) + +about font +----------- +"Grixel Kyrou 7 Wide" font by [Nikos Giannakopoulos](http://www.grixel.gr/). + +100% free font, downloaded from dafont.com: [grixel-kyrou-7-wide](https://www.dafont.com/grixel-kyrou-7-wide.font) diff --git a/styles/cyber/cyber.rgs b/styles/cyber/cyber.rgs new file mode 100644 index 0000000..e72b1b8 --- /dev/null +++ b/styles/cyber/cyber.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 14 0 Kyrou 7 Wide.ttf +p 00 00 0x2f7486ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x024658ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0x51bfd3ff DEFAULT_TEXT_COLOR_NORMAL +p 00 00 0x82cde0ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 00 0x3299b4ff DEFAULT_BASE_COLOR_FOCUSED +p 00 00 0xb6e1eaff DEFAULT_TEXT_COLOR_FOCUSED +p 00 00 0xeb7630ff DEFAULT_BORDER_COLOR_PRESSED +p 00 00 0xffbc51ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0xd86f36ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x134b5aff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x02313dff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x17505fff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x0000000e DEFAULT_TEXT_SIZE +p 00 25 0x00000000 DEFAULT_TEXT_SPACING +p 00 18 0x81c0d0ff DEFAULT_LINE_COLOR +p 00 19 0x00222bff DEFAULT_BACKGROUND_COLOR diff --git a/styles/cyber/font_readme.txt b/styles/cyber/font_readme.txt new file mode 100644 index 0000000..45def0a --- /dev/null +++ b/styles/cyber/font_readme.txt @@ -0,0 +1,36 @@ +Thank you for downloading the free Grixel fonts. You can use them in your personal and commercial projects too. They include Western European, Central European, Turkish and Greek characters. They are Unicode TrueType fonts and are optimized to work in both Windows XP and Mac OS X platforms using Adobe Photoshop CS2 and Macromedia Flash 8. + + +Grixel fonts are under Creative Commons Attribution-NoDerivs 2.5 License which can be found here: + +http://creativecommons.org/licenses/by-nd/2.5/ + +=============================================================== +Attribution-NoDerivs 2.5 + +You are free: + + * to copy, distribute, display, and perform the work + * to make commercial use of the work + +Under the following conditions: + +by +Attribution. You must attribute the work in the manner specified by the author or licensor. + +nd +No Derivative Works. You may not alter, transform, or build upon this work. + + * For any reuse or distribution, you must make clear to others the license terms of this work. + * Any of these conditions can be waived if you get permission from the copyright holder. + +Your fair use and other rights are in no way affected by the above. +=============================================================== + + +In no event shall Nikos Giannakopoulos be held liable to you for any consequential or incidental damages, including any lost revenue, profits, goodwill or savings, or for any claim by any third party caused by using these fonts. + +Please read the UsageGuides.pdf before you use them. + + +Grixel - Greek pixel fonts | Nikos Giannakopoulos | www.grixel.gr \ No newline at end of file diff --git a/styles/cyber/screenshot.png b/styles/cyber/screenshot.png new file mode 100644 index 0000000..5f0b4b7 Binary files /dev/null and b/styles/cyber/screenshot.png differ diff --git a/styles/cyber/style_table.png b/styles/cyber/style_table.png new file mode 100644 index 0000000..b16d320 Binary files /dev/null and b/styles/cyber/style_table.png differ diff --git a/styles/default/README.md b/styles/default/README.md new file mode 100644 index 0000000..e1f15d0 --- /dev/null +++ b/styles/default/README.md @@ -0,0 +1,14 @@ +style: default +--------------- +raylib style, simple and easy-to-use. Light colors, wide borders, a sophisticated touch. + +![default style table](style_table.png) + +screenshot +----------- + +![default style screen](screenshot.png) + +about font +----------- +raylib font by Ramon Santamaria ([@raysan5](https://twitter.com/raysan5)). diff --git a/styles/default/default.rgs b/styles/default/default.rgs new file mode 100644 index 0000000..fa325a6 --- /dev/null +++ b/styles/default/default.rgs @@ -0,0 +1,69 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +p 00 00 0x838383ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0xc9c9c9ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0x686868ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0x5bb2d9ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xc9effeff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0x6c9bbcff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0x0492c7ff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0x97e8ffff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0x368bafff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0xb5c1c2ff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0xe6e9e9ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0xaeb7b8ff DEFAULT_TEXT_COLOR_DISABLED +p 00 12 0x1 DEFAULT_BORDER_WIDTH +p 00 13 0x0 DEFAULT_TEXT_PADDING +p 00 14 0x1 DEFAULT_TEXT_ALIGNMENT +p 00 15 0x0 DEFAULT_RESERVED +p 00 16 0xa DEFAULT_TEXT_SIZE +p 00 17 0x1 DEFAULT_TEXT_SPACING +p 00 18 0x90abb5ff DEFAULT_LINE_COLOR +p 00 19 0xf5f5f5ff DEFAULT_BACKGROUND_COLOR +p 01 14 0x0 LABEL_TEXT_ALIGNMENT +p 02 12 0x2 BUTTON_BORDER_WIDTH +p 03 16 0x2 TOGGLE_GROUP_PADDING +p 04 16 0xf SLIDER_SLIDER_WIDTH +p 04 13 0x5 SLIDER_TEXT_PADDING +p 05 16 0x1 PROGRESSBAR_PROGRESS_PADDING +p 06 13 0x5 CHECKBOX_TEXT_PADDING +p 06 14 0x2 CHECKBOX_TEXT_ALIGNMENT +p 06 16 0x1 CHECKBOX_CHECK_PADDING +p 07 16 0x1e COMBOBOX_COMBO_BUTTON_WIDTH +p 07 17 0x2 COMBOBOX_COMBO_BUTTON_PADDING +p 08 16 0x10 DROPDOWNBOX_ARROW_PADDING +p 08 17 0x2 DROPDOWNBOX_DROPDOWN_ITEMS_PADDING +p 09 13 0x5 TEXTBOX_TEXT_PADDING +p 09 14 0x0 TEXTBOX_TEXT_ALIGNMENT +p 09 16 0x5 TEXTBOX_TEXT_LINES_PADDING +p 09 17 0xf0fffeff TEXTBOX_COLOR_SELECTED_FG +p 09 18 0x839affe0 TEXTBOX_COLOR_SELECTED_BG +p 10 13 0x4 VALUEBOX_TEXT_PADDING +p 10 14 0x0 VALUEBOX_TEXT_ALIGNMENT +p 11 13 0x4 SPINNER_TEXT_PADDING +p 11 14 0x0 SPINNER_TEXT_ALIGNMENT +p 11 16 0x14 SPINNER_SPIN_BUTTON_WIDTH +p 11 17 0x2 SPINNER_SPIN_BUTTON_PADDING +p 12 16 0x1e LISTVIEW_LIST_ITEMS_HEIGHT +p 12 17 0x2 LISTVIEW_LIST_ITEMS_PADDING +p 12 18 0xa LISTVIEW_SCROLLBAR_WIDTH +p 12 19 0x2 LISTVIEW_SCROLLBAR_SIDE +p 13 16 0x6 COLORPICKER_COLOR_SELECTOR_SIZE +p 13 17 0x14 COLORPICKER_HUEBAR_WIDTH +p 13 18 0xa COLORPICKER_HUEBAR_PADDING +p 13 19 0x6 COLORPICKER_HUEBAR_SELECTOR_HEIGHT +p 13 20 0x2 COLORPICKER_HUEBAR_SELECTOR_OVERFLOW +p 14 12 0x0 SCROLLBAR_BORDER_WIDTH +p 14 16 0x6 SCROLLBAR_ARROWS_SIZE +p 14 17 0x0 SCROLLBAR_ARROWS_VISIBLE +p 14 18 0x0 SCROLLBAR_SCROLL_SLIDER_PADDING +p 14 19 0x10 SCROLLBAR_SCROLL_SLIDER_SIZE +p 14 20 0x0 SCROLLBAR_SCROLL_PADDING +p 14 21 0xa SCROLLBAR_SCROLL_SPEED +p 15 13 0xa STATUSBAR_TEXT_PADDING +p 15 14 0x0 STATUSBAR_TEXT_ALIGNMENT diff --git a/styles/default/screenshot.png b/styles/default/screenshot.png new file mode 100644 index 0000000..c3b750a Binary files /dev/null and b/styles/default/screenshot.png differ diff --git a/styles/default/style_table.png b/styles/default/style_table.png new file mode 100644 index 0000000..191a14f Binary files /dev/null and b/styles/default/style_table.png differ diff --git a/styles/jungle/Pixel Intv.otf b/styles/jungle/Pixel Intv.otf new file mode 100644 index 0000000..e8c54a7 Binary files /dev/null and b/styles/jungle/Pixel Intv.otf differ diff --git a/styles/jungle/README.md b/styles/jungle/README.md new file mode 100644 index 0000000..a08b6fc --- /dev/null +++ b/styles/jungle/README.md @@ -0,0 +1,16 @@ +style: jungle +-------------- +Sunset in the jungle, trees do not let to see the last rays of sun on the horizon, small creek in the path, mug on the shoes, a touch of danger and the adventure feeling, get into your jeep and drive with this style. + +![jungle style table](style_table.png) + +screenshot +----------- + +![jungle style screen](screenshot.png) + +about font +----------- +"Pixel Intv" font by [Pixel Sagas](http://www.pixelsagas.com) (Neale and Shayna Davidson). + +100% free font, downloaded from dafont.com: [pixel-intv](https://www.dafont.com/pixel-intv.font) diff --git a/styles/jungle/font_readme.txt b/styles/jungle/font_readme.txt new file mode 100644 index 0000000..b4e6c6e --- /dev/null +++ b/styles/jungle/font_readme.txt @@ -0,0 +1,47 @@ +Shareware/ Font License + +Pixel Sagas Freeware Fonts EULA (End User License Agreement) and Software Inclusion Agreement + +"Purchaser" and "User" may be used interchangeably in this agreement. + +"Pixel Sagas" and "Neale Davidson" may be used interchangeably in this agreement. These all refer to the intellectual and legal property of Neale Davidson. + +Usage + +Pixel Saga's Shareware Fonts are free to use for personal, non-commercial purposes. No payment is necessary to use Pixel Saga's Freeware Fonts for personal use, and there is no limit to the amount of prints, pages, or other medium to be produced using them. However, you cannot offer the font for commercial sale, or offer for direct download. The inclusion othe font name and/or site URL in the credits or documentation when it is used is appreciated, but this is not mandatory. + +Payment + +Payment is not required for the use of Pixel Saga's Shareware Fonts. Commercial use requires a modest fee which can be paid through the pixelsagas.com web site through Paypal.com's services. The transaction receipt for any shareware "commercial license" purchase will suffice as proof of license. + +Support + +Font installation help is available at http://www.pixelsagas.com. If you experience problems with any Pixel Saga's Freeware font (such as spacing issues or missing characters), please verify that you have the correct and current version of the fonts. In the case of Freeware fonts, downloading the font directly from the Pixel Sagas site will ensure that the font files have not been altered. + +Software Inclusion Agreement + +Pixel Saga's software products are protected by copyright laws and International copyright treaties, as well as other intellectual property laws and treaties. All Pixel Saga's software products are licensed, not sold. + +1) GRANT OF LICENSE + +This document grants the user the following rights: + +Installation and Use. The user may install and use an unlimited number of copies of the software product. The user may not offer Pixel Sagas freeware fonts for direct download unless the user has received explicit, written permission from Neale Davidson. Otherwise please direct users to the http://www.pixelsagas.com website. Pixel Sagas freeware fonts may, however, be embedded for web, publication, or general software use. + +2) WARRANTIES + +None + +Pixel Sagas expressly disclaims any warranty for the software product. The software product and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or non-infringement. The entire risk arising out of use or performance of the software product remains with the user. + +No Liability For Consequential Damages. + +In no event shall Neale Davidson or Pixel Sagas be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if Pixel Sagas has been advised of the possibility of such damages. + +3) MISCELLANEOUS + +Should the user have any questions concerning this document or you desire to contact Neale Davidson for any reason, please email jaynz@pixelsagas.com . + +Governing Law + +This agreement is governed by and subject to the laws of the United States of America. diff --git a/styles/jungle/jungle.rgs b/styles/jungle/jungle.rgs new file mode 100644 index 0000000..1852268 --- /dev/null +++ b/styles/jungle/jungle.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 12 0 Pixel Intv.otf +p 00 00 0x60827dff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x2c3334ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0x82a29fff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0x5f9aa8ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0x334e57ff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0x6aa9b8ff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0xa9cb8dff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0x3b6357ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0x97af81ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x5b6462ff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x2c3334ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x666b69ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x0000000c TEXT_SIZE +p 00 17 0x00000000 TEXT_SPACING +p 00 18 0x638465ff DEFAULT_LINE_COLOR +p 00 19 0x2b3a3aff DEFAULT_BACKGROUND_COLOR diff --git a/styles/jungle/screenshot.png b/styles/jungle/screenshot.png new file mode 100644 index 0000000..bc6afef Binary files /dev/null and b/styles/jungle/screenshot.png differ diff --git a/styles/jungle/style_table.png b/styles/jungle/style_table.png new file mode 100644 index 0000000..17d5f96 Binary files /dev/null and b/styles/jungle/style_table.png differ diff --git a/styles/lavanda/Cartridge.ttf b/styles/lavanda/Cartridge.ttf new file mode 100644 index 0000000..19d7280 Binary files /dev/null and b/styles/lavanda/Cartridge.ttf differ diff --git a/styles/lavanda/README.md b/styles/lavanda/README.md new file mode 100644 index 0000000..396dfc5 --- /dev/null +++ b/styles/lavanda/README.md @@ -0,0 +1,16 @@ +style: lavanda +--------------- +Walk thought the fields full of lavanda, feels like a dream, a touch of fantasy, just relax and close your eyes, could you feel it? + +![lavanda style table](style_table.png) + +screenshot +----------- + +![lavanda style screen](screenshot.png) + +about font +----------- +"Cartridge" font by [jeti](https://fontenddev.com/) + +Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), downloaded from dafont.com: [cartridge](https://www.dafont.com/cartridge.font) diff --git a/styles/lavanda/font_readme.txt b/styles/lavanda/font_readme.txt new file mode 100644 index 0000000..c9ff454 --- /dev/null +++ b/styles/lavanda/font_readme.txt @@ -0,0 +1,6 @@ +Cartridge by jeti: A decorative, Art Nouveau-inspired font with a dainty, fantastical hand-lettered feel. + +You are free to use this font for personal or commercial projects, all I ask is that you include credit. + +Licensed under CC BY 4.0: https://creativecommons.org/licenses/by/4.0/ +More info: https://fontenddev.com/fonts/cartridge/ diff --git a/styles/lavanda/lavanda.rgs b/styles/lavanda/lavanda.rgs new file mode 100644 index 0000000..23de947 --- /dev/null +++ b/styles/lavanda/lavanda.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 16 0 Cartridge.ttf +p 00 00 0xab9bd3ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x3e4350ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0xdadaf4ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0xee84a0ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0xf4b7c7ff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0xb7657bff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0xd5c8dbff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0x966ec0ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0xd7ccf7ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x8fa2bdff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x6b798dff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x8292a9ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x00000010 TEXT_SIZE +p 00 17 0x00000001 TEXT_SPACING +p 00 18 0x84adb7ff DEFAULT_LINE_COLOR +p 00 19 0x5b5b81ff DEFAULT_BACKGROUND_COLOR diff --git a/styles/lavanda/screenshot.png b/styles/lavanda/screenshot.png new file mode 100644 index 0000000..d6b621c Binary files /dev/null and b/styles/lavanda/screenshot.png differ diff --git a/styles/lavanda/style_table.png b/styles/lavanda/style_table.png new file mode 100644 index 0000000..c067fe1 Binary files /dev/null and b/styles/lavanda/style_table.png differ diff --git a/styles/terminal/Mecha.ttf b/styles/terminal/Mecha.ttf new file mode 100644 index 0000000..dd564a8 Binary files /dev/null and b/styles/terminal/Mecha.ttf differ diff --git a/styles/terminal/README.md b/styles/terminal/README.md new file mode 100644 index 0000000..6b10d2d --- /dev/null +++ b/styles/terminal/README.md @@ -0,0 +1,16 @@ +style: terminal +---------------- +Start your terminal and type your commands! Feel the connection the data flow, that's your style! + +![terminal style table](style_table.png) + +screenshot +----------- + +![terminal style screen](screenshot.png) + +about font +----------- +"Mecha" font by Captain Falcon. + +100% free font, downloaded from dafont.com: [mecha-cf](https://www.dafont.com/mecha-cf.font) diff --git a/styles/terminal/screenshot.png b/styles/terminal/screenshot.png new file mode 100644 index 0000000..7b8562b Binary files /dev/null and b/styles/terminal/screenshot.png differ diff --git a/styles/terminal/style_table.png b/styles/terminal/style_table.png new file mode 100644 index 0000000..7b527b2 Binary files /dev/null and b/styles/terminal/style_table.png differ diff --git a/styles/terminal/terminal.rgs b/styles/terminal/terminal.rgs new file mode 100644 index 0000000..fed8709 --- /dev/null +++ b/styles/terminal/terminal.rgs @@ -0,0 +1,24 @@ +# +# rgs style text file (v3.1) - raygui style file generated using rGuiStyler +# +# Style properties: +# f +# p +# +f 16 0 Mecha.ttf +p 00 00 0x1c8d00ff DEFAULT_BORDER_COLOR_NORMAL +p 00 01 0x161313ff DEFAULT_BASE_COLOR_NORMAL +p 00 02 0x38f620ff DEFAULT_TEXT_COLOR_NORMAL +p 00 03 0xc3fbc6ff DEFAULT_BORDER_COLOR_FOCUSED +p 00 04 0x43bf2eff DEFAULT_BASE_COLOR_FOCUSED +p 00 05 0xdcfadcff DEFAULT_TEXT_COLOR_FOCUSED +p 00 06 0x1f5b19ff DEFAULT_BORDER_COLOR_PRESSED +p 00 07 0x43ff28ff DEFAULT_BASE_COLOR_PRESSED +p 00 08 0x1e6f15ff DEFAULT_TEXT_COLOR_PRESSED +p 00 09 0x223b22ff DEFAULT_BORDER_COLOR_DISABLED +p 00 10 0x182c18ff DEFAULT_BASE_COLOR_DISABLED +p 00 11 0x244125ff DEFAULT_TEXT_COLOR_DISABLED +p 00 16 0x00000010 TEXT_SIZE +p 00 57 0x00000000 TEXT_SPACING +p 00 18 0xe6fce3ff DEFAULT_LINE_COLOR +p 00 19 0x0c1505ff DEFAULT_BACKGROUND_COLOR