mirror of https://github.com/mode777/rayjs.git
add bindings for rgui and reasings
This commit is contained in:
parent
5412dd1116
commit
930b087864
|
@ -37,4 +37,6 @@ file(GLOB files src/*.c)
|
||||||
add_executable(${CMAKE_PROJECT_NAME} ${files})
|
add_executable(${CMAKE_PROJECT_NAME} ${files})
|
||||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE include)
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE include)
|
||||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src)
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src)
|
||||||
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE thirdparty/raylib/examples/shapes)
|
||||||
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE thirdparty/raylib/examples/shaders)
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} quickjs raylib)
|
target_link_libraries(${CMAKE_PROJECT_NAME} quickjs raylib)
|
|
@ -33,7 +33,7 @@ export class HeaderParser {
|
||||||
return input.split('\n').map(x => x.replace("// ","")).join('\n').trim()
|
return input.split('\n').map(x => x.replace("// ","")).join('\n').trim()
|
||||||
}
|
}
|
||||||
parseFunctionDefinitions(input: string): RayLibFunction[] {
|
parseFunctionDefinitions(input: string): RayLibFunction[] {
|
||||||
const matches = [...input.matchAll(/^[A-Z]+API (.+?)(\w+)\(([^\)]+)\);(?:[^\/]+\/\/ (.+))?/gm)]
|
const matches = [...input.matchAll(/^[A-Z]+ (.+?)(\w+)\(([^\)]+)\);(?: +\/\/ (.+))?$/gm)]
|
||||||
return matches.map(groups => ({
|
return matches.map(groups => ({
|
||||||
returnType: groups![1].trim(),
|
returnType: groups![1].trim(),
|
||||||
name: groups![2],
|
name: groups![2],
|
||||||
|
@ -41,14 +41,15 @@ export class HeaderParser {
|
||||||
description: groups![4] || ""
|
description: groups![4] || ""
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
parseFunctions(input: string): RayLibFunction[] {
|
parseFunctions(input: string, noPrefix: boolean = false): RayLibFunction[] {
|
||||||
const matches = [...input.matchAll(/((?:\/\/ .+\n)*)[A-Z]+API\s+([\w<>]+)\s+([\w<>]+)\((.*)\)/gm)]
|
const matches = noPrefix
|
||||||
console.log(matches[0])
|
? [...input.matchAll(/((?:\/\/.+\n)+)^(.+?)(\w+)\(([^\)]+)\)/gm)]
|
||||||
|
: [...input.matchAll(/((?:\/\/.+\n)+)^[A-Z]+ (.+?)(\w+)\(([^\)]+)\)/gm)]
|
||||||
return matches.map(groups => ({
|
return matches.map(groups => ({
|
||||||
returnType: groups![1].trim(),
|
returnType: groups![2].trim(),
|
||||||
name: groups![2],
|
name: groups![3],
|
||||||
params: this.parseFunctionArgs(groups![3]),
|
params: this.parseFunctionArgs(groups![4]),
|
||||||
description: groups![4] || ""
|
description: groups![1] ? this.parseComments(groups![1]) : ""
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
parseFunctionArgs(input: string): RayLibParamDescription[] {
|
parseFunctionArgs(input: string): RayLibParamDescription[] {
|
||||||
|
|
|
@ -4,30 +4,6 @@ import { ApiDescription, ApiFunction } from "./api";
|
||||||
import { RayLibHeader } from "./raylib-header";
|
import { RayLibHeader } from "./raylib-header";
|
||||||
import { HeaderParser } from "./header-parser";
|
import { HeaderParser } from "./header-parser";
|
||||||
|
|
||||||
function parseHeader(path: string, prefix: string): RayLibFunction[] {
|
|
||||||
const i = readFileSync(path, 'utf8')
|
|
||||||
const regex = new RegExp(`((?:\\/\\/ .+\\n)*)${prefix}\\s+([\\w<>]+)\\s+([\\w<>]+)\\((.*)\\)`, 'gm')
|
|
||||||
const m = [...i.matchAll(regex)]
|
|
||||||
const res = m.map(groups => {
|
|
||||||
const args = groups[4].split(',').filter(x => x !== 'void').map(arg => {
|
|
||||||
arg = arg.trim().replace(" *", "* ")
|
|
||||||
const frags = arg.split(' ')
|
|
||||||
const name = frags.pop()
|
|
||||||
const type = frags.join(' ').replace("*", " *")
|
|
||||||
|
|
||||||
return { name: name || "", type: type }
|
|
||||||
})
|
|
||||||
const comments = groups[1].split('\n').map(x => x.replace("// ","")).join('\n').trim()
|
|
||||||
return {
|
|
||||||
name: groups[3],
|
|
||||||
returnType: groups[2],
|
|
||||||
params: args,
|
|
||||||
description: comments
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
function main(){
|
function main(){
|
||||||
|
|
||||||
// Load the pre-generated raylib api
|
// Load the pre-generated raylib api
|
||||||
|
@ -40,25 +16,42 @@ function main(){
|
||||||
params: [{type: "Model *",name:"model"},{type:"int",name:"materialIndex"},{type:"Material",name:"material"}]
|
params: [{type: "Model *",name:"model"},{type:"int",name:"materialIndex"},{type:"Material",name:"material"}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const rguiHeader = readFileSync("thirdparty/raylib/examples/shapes/raygui.h","utf8");
|
|
||||||
const parser = new HeaderParser()
|
const parser = new HeaderParser()
|
||||||
//writeFileSync("enums.json",JSON.stringify(parser.parseEnums(rayguiHeader)))
|
|
||||||
//writeFileSync("functions.json",JSON.stringify(parser.parseFunctions(rayguiHeader)))
|
|
||||||
|
|
||||||
const rmathHeader = readFileSync("thirdparty/raylib/src/raymath.h","utf8");
|
const rmathHeader = readFileSync("thirdparty/raylib/src/raymath.h","utf8");
|
||||||
const mathApi = parseHeader("thirdparty/raylib/src/raymath.h", "RMAPI");
|
const mathApi = parser.parseFunctions(rmathHeader)
|
||||||
mathApi.forEach(x => api.functions.push(x))
|
mathApi.forEach(x => api.functions.push(x))
|
||||||
|
|
||||||
const rcameraHeader = readFileSync("thirdparty/raylib/src/rcamera.h","utf8");
|
const rcameraHeader = readFileSync("thirdparty/raylib/src/rcamera.h","utf8");
|
||||||
const cameraApi = parseHeader("thirdparty/raylib/src/rcamera.h", "RLAPI");
|
const cameraApi = parser.parseFunctionDefinitions(rcameraHeader);
|
||||||
//cameraApi.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
|
||||||
cameraApi.forEach(x => api.functions.push(x))
|
cameraApi.forEach(x => api.functions.push(x))
|
||||||
|
|
||||||
|
const rguiHeader = readFileSync("thirdparty/raylib/examples/shapes/raygui.h","utf8");
|
||||||
|
const rguiFunctions = parser.parseFunctionDefinitions(rguiHeader);
|
||||||
|
const rguiEnums = parser.parseFunctionDefinitions(rguiHeader);
|
||||||
|
//rguiApi.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||||
|
rguiFunctions.forEach(x => api.functions.push(x))
|
||||||
|
|
||||||
|
const rlightsHeader = readFileSync("thirdparty/raylib/examples/shaders/rlights.h","utf8");
|
||||||
|
const rlightsFunctions = parser.parseFunctions(rlightsHeader, true);
|
||||||
|
api.functions.push(rlightsFunctions[0])
|
||||||
|
api.functions.push(rlightsFunctions[1])
|
||||||
|
|
||||||
|
const reasingsHeader = readFileSync("thirdparty/raylib/examples/shapes/reasings.h","utf8");
|
||||||
|
const reasingsFunctions = parser.parseFunctions(reasingsHeader);
|
||||||
|
//reasingsFunctions.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||||
|
reasingsFunctions.forEach(x => api.functions.push(x))
|
||||||
|
|
||||||
const apiDesc = new ApiDescription(api)
|
const apiDesc = new ApiDescription(api)
|
||||||
|
|
||||||
const core = new RayLibHeader("raylib_core", apiDesc)
|
const core = new RayLibHeader("raylib_core", apiDesc)
|
||||||
core.includes.include("raymath.h")
|
core.includes.include("raymath.h")
|
||||||
core.includes.include("rcamera.h")
|
core.includes.include("rcamera.h")
|
||||||
|
core.includes.line("#define RAYGUI_IMPLEMENTATION")
|
||||||
|
core.includes.include("raygui.h")
|
||||||
|
core.includes.line("#define RLIGHTS_IMPLEMENTATION")
|
||||||
|
core.includes.include("rlights.h")
|
||||||
|
core.includes.include("reasings.h")
|
||||||
|
|
||||||
core.addApiStructByName("Color", {
|
core.addApiStructByName("Color", {
|
||||||
properties: {
|
properties: {
|
||||||
|
@ -1047,6 +1040,92 @@ function main(){
|
||||||
core.addApiFunctionByName("GetCameraViewMatrix")
|
core.addApiFunctionByName("GetCameraViewMatrix")
|
||||||
core.addApiFunctionByName("GetCameraProjectionMatrix")
|
core.addApiFunctionByName("GetCameraProjectionMatrix")
|
||||||
|
|
||||||
|
// module: rgui
|
||||||
|
core.addApiFunctionByName("GuiEnable")
|
||||||
|
core.addApiFunctionByName("GuiDisable")
|
||||||
|
core.addApiFunctionByName("GuiLock")
|
||||||
|
core.addApiFunctionByName("GuiUnlock")
|
||||||
|
core.addApiFunctionByName("GuiIsLocked")
|
||||||
|
core.addApiFunctionByName("GuiFade")
|
||||||
|
core.addApiFunctionByName("GuiSetState")
|
||||||
|
core.addApiFunctionByName("GuiGetState")
|
||||||
|
core.addApiFunctionByName("GuiSetFont")
|
||||||
|
core.addApiFunctionByName("GuiGetFont")
|
||||||
|
core.addApiFunctionByName("GuiSetStyle")
|
||||||
|
core.addApiFunctionByName("GuiGetStyle")
|
||||||
|
core.addApiFunctionByName("GuiWindowBox")
|
||||||
|
core.addApiFunctionByName("GuiGroupBox")
|
||||||
|
core.addApiFunctionByName("GuiLine")
|
||||||
|
core.addApiFunctionByName("GuiPanel")
|
||||||
|
core.addApiFunctionByName("GuiScrollPanel")
|
||||||
|
core.addApiFunctionByName("GuiLabel")
|
||||||
|
core.addApiFunctionByName("GuiButton")
|
||||||
|
core.addApiFunctionByName("GuiLabelButton")
|
||||||
|
core.addApiFunctionByName("GuiToggle")
|
||||||
|
core.addApiFunctionByName("GuiToggleGroup")
|
||||||
|
core.addApiFunctionByName("GuiCheckBox")
|
||||||
|
core.addApiFunctionByName("GuiComboBox")
|
||||||
|
//core.addApiFunctionByName("GuiDropdownBox")
|
||||||
|
//core.addApiFunctionByName("GuiSpinner")
|
||||||
|
//core.addApiFunctionByName("GuiValueBox")
|
||||||
|
core.addApiFunctionByName("GuiTextBox")
|
||||||
|
core.addApiFunctionByName("GuiTextBoxMulti")
|
||||||
|
core.addApiFunctionByName("GuiSlider")
|
||||||
|
core.addApiFunctionByName("GuiSliderBar")
|
||||||
|
core.addApiFunctionByName("GuiProgressBar")
|
||||||
|
core.addApiFunctionByName("GuiStatusBar")
|
||||||
|
core.addApiFunctionByName("GuiDummyRec")
|
||||||
|
core.addApiFunctionByName("GuiGrid")
|
||||||
|
//core.addApiFunctionByName("GuiListView")
|
||||||
|
//core.addApiFunctionByName("GuiListViewEx")
|
||||||
|
core.addApiFunctionByName("GuiMessageBox")
|
||||||
|
//core.addApiFunctionByName("GuiTextInputBox")
|
||||||
|
core.addApiFunctionByName("GuiColorPicker")
|
||||||
|
core.addApiFunctionByName("GuiColorPanel")
|
||||||
|
core.addApiFunctionByName("GuiColorBarAlpha")
|
||||||
|
core.addApiFunctionByName("GuiColorBarHue")
|
||||||
|
core.addApiFunctionByName("GuiLoadStyle")
|
||||||
|
core.addApiFunctionByName("GuiLoadStyleDefault")
|
||||||
|
core.addApiFunctionByName("GuiIconText")
|
||||||
|
core.addApiFunctionByName("GuiDrawIcon")
|
||||||
|
//core.addApiFunctionByName("GuiGetIcons")
|
||||||
|
//core.addApiFunctionByName("GuiGetIconData")
|
||||||
|
//core.addApiFunctionByName("GuiSetIconData")
|
||||||
|
core.addApiFunctionByName("GuiSetIconScale")
|
||||||
|
core.addApiFunctionByName("GuiSetIconPixel")
|
||||||
|
core.addApiFunctionByName("GuiClearIconPixel")
|
||||||
|
core.addApiFunctionByName("GuiCheckIconPixel")
|
||||||
|
|
||||||
|
// module: rlights
|
||||||
|
// TODO: Parse and support light struct
|
||||||
|
// core.addApiFunctionByName("CreateLight")
|
||||||
|
// core.addApiFunctionByName("UpdateLightValues")
|
||||||
|
|
||||||
|
// module: reasings
|
||||||
|
core.addApiFunctionByName("EaseLinearNone")
|
||||||
|
core.addApiFunctionByName("EaseLinearIn")
|
||||||
|
core.addApiFunctionByName("EaseLinearOut")
|
||||||
|
core.addApiFunctionByName("EaseLinearInOut")
|
||||||
|
core.addApiFunctionByName("EaseSineIn")
|
||||||
|
core.addApiFunctionByName("EaseSineOut")
|
||||||
|
core.addApiFunctionByName("EaseSineInOut")
|
||||||
|
core.addApiFunctionByName("EaseCircIn")
|
||||||
|
core.addApiFunctionByName("EaseCircOut")
|
||||||
|
core.addApiFunctionByName("EaseCircInOut")
|
||||||
|
core.addApiFunctionByName("EaseCubicIn")
|
||||||
|
core.addApiFunctionByName("EaseCubicOut")
|
||||||
|
core.addApiFunctionByName("EaseCubicInOut")
|
||||||
|
core.addApiFunctionByName("EaseQuadIn")
|
||||||
|
core.addApiFunctionByName("EaseQuadOut")
|
||||||
|
core.addApiFunctionByName("EaseQuadInOut")
|
||||||
|
core.addApiFunctionByName("EaseExpoIn")
|
||||||
|
core.addApiFunctionByName("EaseExpoOut")
|
||||||
|
core.addApiFunctionByName("EaseExpoInOut")
|
||||||
|
core.addApiFunctionByName("EaseBackIn")
|
||||||
|
core.addApiFunctionByName("EaseBounceOut")
|
||||||
|
core.addApiFunctionByName("EaseBounceInOut")
|
||||||
|
core.addApiFunctionByName("EaseElasticIn")
|
||||||
|
|
||||||
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
||||||
core.exportGlobalStruct("Color", x.name, x.values, x.description)
|
core.exportGlobalStruct("Color", x.name, x.values, x.description)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1366,7 +1366,7 @@ declare function getCameraForward(camera: Camera3D): Vector3;
|
||||||
declare function getCameraUp(camera: Camera3D): Vector3;
|
declare function getCameraUp(camera: Camera3D): Vector3;
|
||||||
/** */
|
/** */
|
||||||
declare function getCameraRight(camera: Camera3D): Vector3;
|
declare function getCameraRight(camera: Camera3D): Vector3;
|
||||||
/** Camera movement */
|
/** */
|
||||||
declare function cameraMoveForward(camera: Camera3D, distance: number, moveInWorldPlane: boolean): void;
|
declare function cameraMoveForward(camera: Camera3D, distance: number, moveInWorldPlane: boolean): void;
|
||||||
/** */
|
/** */
|
||||||
declare function cameraMoveUp(camera: Camera3D, distance: number): void;
|
declare function cameraMoveUp(camera: Camera3D, distance: number): void;
|
||||||
|
@ -1374,7 +1374,7 @@ declare function cameraMoveUp(camera: Camera3D, distance: number): void;
|
||||||
declare function cameraMoveRight(camera: Camera3D, distance: number, moveInWorldPlane: boolean): void;
|
declare function cameraMoveRight(camera: Camera3D, distance: number, moveInWorldPlane: boolean): void;
|
||||||
/** */
|
/** */
|
||||||
declare function cameraMoveToTarget(camera: Camera3D, delta: number): void;
|
declare function cameraMoveToTarget(camera: Camera3D, delta: number): void;
|
||||||
/** Camera rotation */
|
/** */
|
||||||
declare function cameraYaw(camera: Camera3D, angle: number, rotateAroundTarget: boolean): void;
|
declare function cameraYaw(camera: Camera3D, angle: number, rotateAroundTarget: boolean): void;
|
||||||
/** */
|
/** */
|
||||||
declare function cameraPitch(camera: Camera3D, angle: number, lockView: boolean, rotateAroundTarget: boolean, rotateUp: boolean): void;
|
declare function cameraPitch(camera: Camera3D, angle: number, lockView: boolean, rotateAroundTarget: boolean, rotateUp: boolean): void;
|
||||||
|
@ -1384,6 +1384,142 @@ declare function cameraRoll(camera: Camera3D, angle: number): void;
|
||||||
declare function getCameraViewMatrix(camera: Camera3D): Matrix;
|
declare function getCameraViewMatrix(camera: Camera3D): Matrix;
|
||||||
/** */
|
/** */
|
||||||
declare function getCameraProjectionMatrix(camera: Camera3D, aspect: number): Matrix;
|
declare function getCameraProjectionMatrix(camera: Camera3D, aspect: number): Matrix;
|
||||||
|
/** Enable gui controls (global state) */
|
||||||
|
declare function guiEnable(): void;
|
||||||
|
/** Disable gui controls (global state) */
|
||||||
|
declare function guiDisable(): void;
|
||||||
|
/** Lock gui controls (global state) */
|
||||||
|
declare function guiLock(): void;
|
||||||
|
/** Unlock gui controls (global state) */
|
||||||
|
declare function guiUnlock(): void;
|
||||||
|
/** Check if gui is locked (global state) */
|
||||||
|
declare function guiIsLocked(): boolean;
|
||||||
|
/** Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f */
|
||||||
|
declare function guiFade(alpha: number): void;
|
||||||
|
/** Set gui state (global state) */
|
||||||
|
declare function guiSetState(state: number): void;
|
||||||
|
/** Get gui state (global state) */
|
||||||
|
declare function guiGetState(): number;
|
||||||
|
/** Set gui custom font (global state) */
|
||||||
|
declare function guiSetFont(font: Font): void;
|
||||||
|
/** Get gui custom font (global state) */
|
||||||
|
declare function guiGetFont(): Font;
|
||||||
|
/** Set one style property */
|
||||||
|
declare function guiSetStyle(control: number, property: number, value: number): void;
|
||||||
|
/** Get one style property */
|
||||||
|
declare function guiGetStyle(control: number, property: number): number;
|
||||||
|
/** Window Box control, shows a window that can be closed */
|
||||||
|
declare function guiWindowBox(bounds: Rectangle, title: string): boolean;
|
||||||
|
/** Group Box control with text name */
|
||||||
|
declare function guiGroupBox(bounds: Rectangle, text: string): void;
|
||||||
|
/** Line separator control, could contain text */
|
||||||
|
declare function guiLine(bounds: Rectangle, text: string): void;
|
||||||
|
/** Panel control, useful to group controls */
|
||||||
|
declare function guiPanel(bounds: Rectangle, text: string): void;
|
||||||
|
/** Scroll Panel control */
|
||||||
|
declare function guiScrollPanel(bounds: Rectangle, text: string, content: Rectangle, scroll: Vector2): Rectangle;
|
||||||
|
/** Label control, shows text */
|
||||||
|
declare function guiLabel(bounds: Rectangle, text: string): void;
|
||||||
|
/** Button control, returns true when clicked */
|
||||||
|
declare function guiButton(bounds: Rectangle, text: string): boolean;
|
||||||
|
/** Label button control, show true when clicked */
|
||||||
|
declare function guiLabelButton(bounds: Rectangle, text: string): boolean;
|
||||||
|
/** Toggle Button control, returns true when active */
|
||||||
|
declare function guiToggle(bounds: Rectangle, text: string, active: boolean): boolean;
|
||||||
|
/** Toggle Group control, returns active toggle index */
|
||||||
|
declare function guiToggleGroup(bounds: Rectangle, text: string, active: number): number;
|
||||||
|
/** Check Box control, returns true when active */
|
||||||
|
declare function guiCheckBox(bounds: Rectangle, text: string, checked: boolean): boolean;
|
||||||
|
/** Combo Box control, returns selected item index */
|
||||||
|
declare function guiComboBox(bounds: Rectangle, text: string, active: number): number;
|
||||||
|
/** Text Box control, updates input text */
|
||||||
|
declare function guiTextBox(bounds: Rectangle, text: string, textSize: number, editMode: boolean): boolean;
|
||||||
|
/** Text Box control with multiple lines */
|
||||||
|
declare function guiTextBoxMulti(bounds: Rectangle, text: string, textSize: number, editMode: boolean): boolean;
|
||||||
|
/** Slider control, returns selected value */
|
||||||
|
declare function guiSlider(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number;
|
||||||
|
/** Slider Bar control, returns selected value */
|
||||||
|
declare function guiSliderBar(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number;
|
||||||
|
/** Progress Bar control, shows current progress value */
|
||||||
|
declare function guiProgressBar(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number;
|
||||||
|
/** Status Bar control, shows info text */
|
||||||
|
declare function guiStatusBar(bounds: Rectangle, text: string): void;
|
||||||
|
/** Dummy control for placeholders */
|
||||||
|
declare function guiDummyRec(bounds: Rectangle, text: string): void;
|
||||||
|
/** Grid control, returns mouse cell position */
|
||||||
|
declare function guiGrid(bounds: Rectangle, text: string, spacing: number, subdivs: number): Vector2;
|
||||||
|
/** Message Box control, displays a message */
|
||||||
|
declare function guiMessageBox(bounds: Rectangle, title: string, message: string, buttons: string): number;
|
||||||
|
/** Color Picker control (multiple color controls) */
|
||||||
|
declare function guiColorPicker(bounds: Rectangle, text: string, color: Color): Color;
|
||||||
|
/** Color Panel control */
|
||||||
|
declare function guiColorPanel(bounds: Rectangle, text: string, color: Color): Color;
|
||||||
|
/** Color Bar Alpha control */
|
||||||
|
declare function guiColorBarAlpha(bounds: Rectangle, text: string, alpha: number): number;
|
||||||
|
/** Color Bar Hue control */
|
||||||
|
declare function guiColorBarHue(bounds: Rectangle, text: string, value: number): number;
|
||||||
|
/** Load style file over global style variable (.rgs) */
|
||||||
|
declare function guiLoadStyle(fileName: string): void;
|
||||||
|
/** Load style default over global style */
|
||||||
|
declare function guiLoadStyleDefault(): void;
|
||||||
|
/** Get text with icon id prepended (if supported) */
|
||||||
|
declare function guiIconText(iconId: number, text: string): string;
|
||||||
|
/** */
|
||||||
|
declare function guiDrawIcon(iconId: number, posX: number, posY: number, pixelSize: number, color: Color): void;
|
||||||
|
/** Set icon scale (1 by default) */
|
||||||
|
declare function guiSetIconScale(scale: number): void;
|
||||||
|
/** Set icon pixel value */
|
||||||
|
declare function guiSetIconPixel(iconId: number, x: number, y: number): void;
|
||||||
|
/** Clear icon pixel value */
|
||||||
|
declare function guiClearIconPixel(iconId: number, x: number, y: number): void;
|
||||||
|
/** Check icon pixel value */
|
||||||
|
declare function guiCheckIconPixel(iconId: number, x: number, y: number): boolean;
|
||||||
|
/** Linear Easing functions */
|
||||||
|
declare function easeLinearNone(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Linear */
|
||||||
|
declare function easeLinearIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Linear In */
|
||||||
|
declare function easeLinearOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Linear Out */
|
||||||
|
declare function easeLinearInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Sine Easing functions */
|
||||||
|
declare function easeSineIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Sine In */
|
||||||
|
declare function easeSineOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Sine Out */
|
||||||
|
declare function easeSineInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Circular Easing functions */
|
||||||
|
declare function easeCircIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Circular In */
|
||||||
|
declare function easeCircOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Circular Out */
|
||||||
|
declare function easeCircInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Cubic Easing functions */
|
||||||
|
declare function easeCubicIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Cubic In */
|
||||||
|
declare function easeCubicOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Cubic Out */
|
||||||
|
declare function easeCubicInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Quadratic Easing functions */
|
||||||
|
declare function easeQuadIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Quadratic In */
|
||||||
|
declare function easeQuadOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Quadratic Out */
|
||||||
|
declare function easeQuadInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Exponential Easing functions */
|
||||||
|
declare function easeExpoIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Exponential In */
|
||||||
|
declare function easeExpoOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Exponential Out */
|
||||||
|
declare function easeExpoInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Back Easing functions */
|
||||||
|
declare function easeBackIn(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Bounce Easing functions */
|
||||||
|
declare function easeBounceOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Ease: Bounce In */
|
||||||
|
declare function easeBounceInOut(t: number, b: number, c: number, d: number): number;
|
||||||
|
/** Elastic Easing functions */
|
||||||
|
declare function easeElasticIn(t: number, b: number, c: number, d: number): number;
|
||||||
/** (PI/180.0) */
|
/** (PI/180.0) */
|
||||||
declare var DEG2RAD: number;
|
declare var DEG2RAD: number;
|
||||||
/** (180.0/PI) */
|
/** (180.0/PI) */
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* raylib [shapes] example - draw circle sector (with gui options)
|
|
||||||
*
|
|
||||||
* Example originally created with raylib 2.5, last time updated with raylib 2.5
|
|
||||||
*
|
|
||||||
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
* Example 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) 2018-2023 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include <raylib.h>
|
|
||||||
|
|
||||||
#define RAYGUI_IMPLEMENTATION
|
|
||||||
#include "raygui.h" // Required for GUI controls
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
// Program main entry point
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
// Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
const int screenWidth = 800;
|
|
||||||
const int screenHeight = 450;
|
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw circle sector");
|
|
||||||
|
|
||||||
Vector2 center = {(GetScreenWidth() - 300)/2.0f, GetScreenHeight()/2.0f };
|
|
||||||
|
|
||||||
float outerRadius = 180.0f;
|
|
||||||
float startAngle = 0.0f;
|
|
||||||
float endAngle = 180.0f;
|
|
||||||
int segments = 0;
|
|
||||||
int minSegments = 4;
|
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Main game loop
|
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
||||||
{
|
|
||||||
// Update
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// NOTE: All variables update happens inside GUI control functions
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f));
|
|
||||||
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
|
||||||
|
|
||||||
DrawCircleSector(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.3f));
|
|
||||||
DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.6f));
|
|
||||||
|
|
||||||
// Draw GUI controls
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", NULL, startAngle, 0, 720);
|
|
||||||
endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", NULL, endAngle, 0, 720);
|
|
||||||
|
|
||||||
outerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", NULL, outerRadius, 0, 200);
|
|
||||||
segments = (int)GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", NULL, (float)segments, 0, 100);
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
minSegments = (int)ceilf((endAngle - startAngle) / 90);
|
|
||||||
DrawText(TextFormat("MODE: %s", (segments >= minSegments)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= minSegments)? MAROON : DARKGRAY);
|
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
|
||||||
|
|
||||||
EndDrawing();
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
// De-Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - draw circle sector (with gui options)
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 2.5, last time updated with raylib 2.5
|
||||||
|
*
|
||||||
|
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example 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) 2018-2023 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const screenWidth = 800;
|
||||||
|
const screenHeight = 450;
|
||||||
|
|
||||||
|
initWindow(screenWidth, screenHeight, "raylib [shapes] example - draw circle sector");
|
||||||
|
|
||||||
|
const center = new Vector2((getScreenWidth() - 300)/2.0, getScreenHeight()/2.0);
|
||||||
|
|
||||||
|
let outerRadius = 180.0;
|
||||||
|
let startAngle = 0.0;
|
||||||
|
let endAngle = 180.0;
|
||||||
|
let segments = 0;
|
||||||
|
let minSegments = 4;
|
||||||
|
|
||||||
|
setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!windowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// NOTE: All variables update happens inside GUI control functions
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
beginDrawing();
|
||||||
|
|
||||||
|
clearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
drawLine(500, 0, 500, getScreenHeight(), fade(LIGHTGRAY, 0.6));
|
||||||
|
drawRectangle(500, 0, getScreenWidth() - 500, getScreenHeight(), fade(LIGHTGRAY, 0.3));
|
||||||
|
|
||||||
|
drawCircleSector(center, outerRadius, startAngle, endAngle, segments, fade(MAROON, 0.3));
|
||||||
|
drawCircleSectorLines(center, outerRadius, startAngle, endAngle, segments, fade(MAROON, 0.6));
|
||||||
|
|
||||||
|
// Draw GUI controls
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
startAngle = guiSliderBar(new Rectangle(600, 40, 120, 20), "StartAngle", startAngle, startAngle, 0, 720);
|
||||||
|
endAngle = guiSliderBar(new Rectangle(600, 70, 120, 20), "EndAngle", endAngle, endAngle, 0, 720);
|
||||||
|
|
||||||
|
outerRadius = guiSliderBar(new Rectangle(600, 140, 120, 20), "Radius", Math.round(outerRadius), outerRadius, 0, 200);
|
||||||
|
segments = guiSliderBar(new Rectangle(600, 170, 120, 20), "Segments", Math.floor(segments), segments, 0, 100);
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
minSegments = Math.ceil((endAngle - startAngle) / 90);
|
||||||
|
drawText("MODE: " + (segments >= minSegments) ? "MANUAL" : "AUTO", 600, 200, 10, (segments >= minSegments)? MAROON : DARKGRAY);
|
||||||
|
|
||||||
|
drawFPS(10, 10);
|
||||||
|
|
||||||
|
endDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
closeWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
|
@ -350,7 +350,7 @@ class HeaderParser {
|
||||||
return input.split('\n').map(x => x.replace("// ", "")).join('\n').trim();
|
return input.split('\n').map(x => x.replace("// ", "")).join('\n').trim();
|
||||||
}
|
}
|
||||||
parseFunctionDefinitions(input) {
|
parseFunctionDefinitions(input) {
|
||||||
const matches = [...input.matchAll(/^[A-Z]+API (.+?)(\w+)\(([^\)]+)\);(?:[^\/]+\/\/ (.+))?/gm)];
|
const matches = [...input.matchAll(/^[A-Z]+ (.+?)(\w+)\(([^\)]+)\);(?: +\/\/ (.+))?$/gm)];
|
||||||
return matches.map(groups => ({
|
return matches.map(groups => ({
|
||||||
returnType: groups[1].trim(),
|
returnType: groups[1].trim(),
|
||||||
name: groups[2],
|
name: groups[2],
|
||||||
|
@ -358,14 +358,15 @@ class HeaderParser {
|
||||||
description: groups[4] || ""
|
description: groups[4] || ""
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
parseFunctions(input) {
|
parseFunctions(input, noPrefix = false) {
|
||||||
const matches = [...input.matchAll(/((?:\/\/ .+\n)*)[A-Z]+API\s+([\w<>]+)\s+([\w<>]+)\((.*)\)/gm)];
|
const matches = noPrefix
|
||||||
console.log(matches[0]);
|
? [...input.matchAll(/((?:\/\/.+\n)+)^(.+?)(\w+)\(([^\)]+)\)/gm)]
|
||||||
|
: [...input.matchAll(/((?:\/\/.+\n)+)^[A-Z]+ (.+?)(\w+)\(([^\)]+)\)/gm)];
|
||||||
return matches.map(groups => ({
|
return matches.map(groups => ({
|
||||||
returnType: groups[1].trim(),
|
returnType: groups[2].trim(),
|
||||||
name: groups[2],
|
name: groups[3],
|
||||||
params: this.parseFunctionArgs(groups[3]),
|
params: this.parseFunctionArgs(groups[4]),
|
||||||
description: groups[4] || ""
|
description: groups[1] ? this.parseComments(groups[1]) : ""
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
parseFunctionArgs(input) {
|
parseFunctionArgs(input) {
|
||||||
|
@ -968,28 +969,6 @@ const fs_1 = __webpack_require__(/*! fs */ "fs");
|
||||||
const api_1 = __webpack_require__(/*! ./api */ "./src/api.ts");
|
const api_1 = __webpack_require__(/*! ./api */ "./src/api.ts");
|
||||||
const raylib_header_1 = __webpack_require__(/*! ./raylib-header */ "./src/raylib-header.ts");
|
const raylib_header_1 = __webpack_require__(/*! ./raylib-header */ "./src/raylib-header.ts");
|
||||||
const header_parser_1 = __webpack_require__(/*! ./header-parser */ "./src/header-parser.ts");
|
const header_parser_1 = __webpack_require__(/*! ./header-parser */ "./src/header-parser.ts");
|
||||||
function parseHeader(path, prefix) {
|
|
||||||
const i = (0, fs_1.readFileSync)(path, 'utf8');
|
|
||||||
const regex = new RegExp(`((?:\\/\\/ .+\\n)*)${prefix}\\s+([\\w<>]+)\\s+([\\w<>]+)\\((.*)\\)`, 'gm');
|
|
||||||
const m = [...i.matchAll(regex)];
|
|
||||||
const res = m.map(groups => {
|
|
||||||
const args = groups[4].split(',').filter(x => x !== 'void').map(arg => {
|
|
||||||
arg = arg.trim().replace(" *", "* ");
|
|
||||||
const frags = arg.split(' ');
|
|
||||||
const name = frags.pop();
|
|
||||||
const type = frags.join(' ').replace("*", " *");
|
|
||||||
return { name: name || "", type: type };
|
|
||||||
});
|
|
||||||
const comments = groups[1].split('\n').map(x => x.replace("// ", "")).join('\n').trim();
|
|
||||||
return {
|
|
||||||
name: groups[3],
|
|
||||||
returnType: groups[2],
|
|
||||||
params: args,
|
|
||||||
description: comments
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
function main() {
|
function main() {
|
||||||
// Load the pre-generated raylib api
|
// Load the pre-generated raylib api
|
||||||
const api = JSON.parse((0, fs_1.readFileSync)("thirdparty/raylib/parser/output/raylib_api.json", 'utf8'));
|
const api = JSON.parse((0, fs_1.readFileSync)("thirdparty/raylib/parser/output/raylib_api.json", 'utf8'));
|
||||||
|
@ -999,21 +978,35 @@ function main() {
|
||||||
returnType: "void",
|
returnType: "void",
|
||||||
params: [{ type: "Model *", name: "model" }, { type: "int", name: "materialIndex" }, { type: "Material", name: "material" }]
|
params: [{ type: "Model *", name: "model" }, { type: "int", name: "materialIndex" }, { type: "Material", name: "material" }]
|
||||||
});
|
});
|
||||||
const rguiHeader = (0, fs_1.readFileSync)("thirdparty/raylib/examples/shapes/raygui.h", "utf8");
|
|
||||||
const parser = new header_parser_1.HeaderParser();
|
const parser = new header_parser_1.HeaderParser();
|
||||||
//writeFileSync("enums.json",JSON.stringify(parser.parseEnums(rayguiHeader)))
|
|
||||||
//writeFileSync("functions.json",JSON.stringify(parser.parseFunctions(rayguiHeader)))
|
|
||||||
const rmathHeader = (0, fs_1.readFileSync)("thirdparty/raylib/src/raymath.h", "utf8");
|
const rmathHeader = (0, fs_1.readFileSync)("thirdparty/raylib/src/raymath.h", "utf8");
|
||||||
const mathApi = parseHeader("thirdparty/raylib/src/raymath.h", "RMAPI");
|
const mathApi = parser.parseFunctions(rmathHeader);
|
||||||
mathApi.forEach(x => api.functions.push(x));
|
mathApi.forEach(x => api.functions.push(x));
|
||||||
const rcameraHeader = (0, fs_1.readFileSync)("thirdparty/raylib/src/rcamera.h", "utf8");
|
const rcameraHeader = (0, fs_1.readFileSync)("thirdparty/raylib/src/rcamera.h", "utf8");
|
||||||
const cameraApi = parseHeader("thirdparty/raylib/src/rcamera.h", "RLAPI");
|
const cameraApi = parser.parseFunctionDefinitions(rcameraHeader);
|
||||||
//cameraApi.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
|
||||||
cameraApi.forEach(x => api.functions.push(x));
|
cameraApi.forEach(x => api.functions.push(x));
|
||||||
|
const rguiHeader = (0, fs_1.readFileSync)("thirdparty/raylib/examples/shapes/raygui.h", "utf8");
|
||||||
|
const rguiFunctions = parser.parseFunctionDefinitions(rguiHeader);
|
||||||
|
const rguiEnums = parser.parseFunctionDefinitions(rguiHeader);
|
||||||
|
//rguiApi.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||||
|
rguiFunctions.forEach(x => api.functions.push(x));
|
||||||
|
const rlightsHeader = (0, fs_1.readFileSync)("thirdparty/raylib/examples/shaders/rlights.h", "utf8");
|
||||||
|
const rlightsFunctions = parser.parseFunctions(rlightsHeader, true);
|
||||||
|
api.functions.push(rlightsFunctions[0]);
|
||||||
|
api.functions.push(rlightsFunctions[1]);
|
||||||
|
const reasingsHeader = (0, fs_1.readFileSync)("thirdparty/raylib/examples/shapes/reasings.h", "utf8");
|
||||||
|
const reasingsFunctions = parser.parseFunctions(reasingsHeader);
|
||||||
|
//reasingsFunctions.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
|
||||||
|
reasingsFunctions.forEach(x => api.functions.push(x));
|
||||||
const apiDesc = new api_1.ApiDescription(api);
|
const apiDesc = new api_1.ApiDescription(api);
|
||||||
const core = new raylib_header_1.RayLibHeader("raylib_core", apiDesc);
|
const core = new raylib_header_1.RayLibHeader("raylib_core", apiDesc);
|
||||||
core.includes.include("raymath.h");
|
core.includes.include("raymath.h");
|
||||||
core.includes.include("rcamera.h");
|
core.includes.include("rcamera.h");
|
||||||
|
core.includes.line("#define RAYGUI_IMPLEMENTATION");
|
||||||
|
core.includes.include("raygui.h");
|
||||||
|
core.includes.line("#define RLIGHTS_IMPLEMENTATION");
|
||||||
|
core.includes.include("rlights.h");
|
||||||
|
core.includes.include("reasings.h");
|
||||||
core.addApiStructByName("Color", {
|
core.addApiStructByName("Color", {
|
||||||
properties: {
|
properties: {
|
||||||
r: { get: true, set: true },
|
r: { get: true, set: true },
|
||||||
|
@ -1944,6 +1937,89 @@ function main() {
|
||||||
core.addApiFunctionByName("CameraRoll");
|
core.addApiFunctionByName("CameraRoll");
|
||||||
core.addApiFunctionByName("GetCameraViewMatrix");
|
core.addApiFunctionByName("GetCameraViewMatrix");
|
||||||
core.addApiFunctionByName("GetCameraProjectionMatrix");
|
core.addApiFunctionByName("GetCameraProjectionMatrix");
|
||||||
|
// module: rgui
|
||||||
|
core.addApiFunctionByName("GuiEnable");
|
||||||
|
core.addApiFunctionByName("GuiDisable");
|
||||||
|
core.addApiFunctionByName("GuiLock");
|
||||||
|
core.addApiFunctionByName("GuiUnlock");
|
||||||
|
core.addApiFunctionByName("GuiIsLocked");
|
||||||
|
core.addApiFunctionByName("GuiFade");
|
||||||
|
core.addApiFunctionByName("GuiSetState");
|
||||||
|
core.addApiFunctionByName("GuiGetState");
|
||||||
|
core.addApiFunctionByName("GuiSetFont");
|
||||||
|
core.addApiFunctionByName("GuiGetFont");
|
||||||
|
core.addApiFunctionByName("GuiSetStyle");
|
||||||
|
core.addApiFunctionByName("GuiGetStyle");
|
||||||
|
core.addApiFunctionByName("GuiWindowBox");
|
||||||
|
core.addApiFunctionByName("GuiGroupBox");
|
||||||
|
core.addApiFunctionByName("GuiLine");
|
||||||
|
core.addApiFunctionByName("GuiPanel");
|
||||||
|
core.addApiFunctionByName("GuiScrollPanel");
|
||||||
|
core.addApiFunctionByName("GuiLabel");
|
||||||
|
core.addApiFunctionByName("GuiButton");
|
||||||
|
core.addApiFunctionByName("GuiLabelButton");
|
||||||
|
core.addApiFunctionByName("GuiToggle");
|
||||||
|
core.addApiFunctionByName("GuiToggleGroup");
|
||||||
|
core.addApiFunctionByName("GuiCheckBox");
|
||||||
|
core.addApiFunctionByName("GuiComboBox");
|
||||||
|
//core.addApiFunctionByName("GuiDropdownBox")
|
||||||
|
//core.addApiFunctionByName("GuiSpinner")
|
||||||
|
//core.addApiFunctionByName("GuiValueBox")
|
||||||
|
core.addApiFunctionByName("GuiTextBox");
|
||||||
|
core.addApiFunctionByName("GuiTextBoxMulti");
|
||||||
|
core.addApiFunctionByName("GuiSlider");
|
||||||
|
core.addApiFunctionByName("GuiSliderBar");
|
||||||
|
core.addApiFunctionByName("GuiProgressBar");
|
||||||
|
core.addApiFunctionByName("GuiStatusBar");
|
||||||
|
core.addApiFunctionByName("GuiDummyRec");
|
||||||
|
core.addApiFunctionByName("GuiGrid");
|
||||||
|
//core.addApiFunctionByName("GuiListView")
|
||||||
|
//core.addApiFunctionByName("GuiListViewEx")
|
||||||
|
core.addApiFunctionByName("GuiMessageBox");
|
||||||
|
//core.addApiFunctionByName("GuiTextInputBox")
|
||||||
|
core.addApiFunctionByName("GuiColorPicker");
|
||||||
|
core.addApiFunctionByName("GuiColorPanel");
|
||||||
|
core.addApiFunctionByName("GuiColorBarAlpha");
|
||||||
|
core.addApiFunctionByName("GuiColorBarHue");
|
||||||
|
core.addApiFunctionByName("GuiLoadStyle");
|
||||||
|
core.addApiFunctionByName("GuiLoadStyleDefault");
|
||||||
|
core.addApiFunctionByName("GuiIconText");
|
||||||
|
core.addApiFunctionByName("GuiDrawIcon");
|
||||||
|
//core.addApiFunctionByName("GuiGetIcons")
|
||||||
|
//core.addApiFunctionByName("GuiGetIconData")
|
||||||
|
//core.addApiFunctionByName("GuiSetIconData")
|
||||||
|
core.addApiFunctionByName("GuiSetIconScale");
|
||||||
|
core.addApiFunctionByName("GuiSetIconPixel");
|
||||||
|
core.addApiFunctionByName("GuiClearIconPixel");
|
||||||
|
core.addApiFunctionByName("GuiCheckIconPixel");
|
||||||
|
// module: rlights
|
||||||
|
// TODO: Parse and support light struct
|
||||||
|
// core.addApiFunctionByName("CreateLight")
|
||||||
|
// core.addApiFunctionByName("UpdateLightValues")
|
||||||
|
// module: reasings
|
||||||
|
core.addApiFunctionByName("EaseLinearNone");
|
||||||
|
core.addApiFunctionByName("EaseLinearIn");
|
||||||
|
core.addApiFunctionByName("EaseLinearOut");
|
||||||
|
core.addApiFunctionByName("EaseLinearInOut");
|
||||||
|
core.addApiFunctionByName("EaseSineIn");
|
||||||
|
core.addApiFunctionByName("EaseSineOut");
|
||||||
|
core.addApiFunctionByName("EaseSineInOut");
|
||||||
|
core.addApiFunctionByName("EaseCircIn");
|
||||||
|
core.addApiFunctionByName("EaseCircOut");
|
||||||
|
core.addApiFunctionByName("EaseCircInOut");
|
||||||
|
core.addApiFunctionByName("EaseCubicIn");
|
||||||
|
core.addApiFunctionByName("EaseCubicOut");
|
||||||
|
core.addApiFunctionByName("EaseCubicInOut");
|
||||||
|
core.addApiFunctionByName("EaseQuadIn");
|
||||||
|
core.addApiFunctionByName("EaseQuadOut");
|
||||||
|
core.addApiFunctionByName("EaseQuadInOut");
|
||||||
|
core.addApiFunctionByName("EaseExpoIn");
|
||||||
|
core.addApiFunctionByName("EaseExpoOut");
|
||||||
|
core.addApiFunctionByName("EaseExpoInOut");
|
||||||
|
core.addApiFunctionByName("EaseBackIn");
|
||||||
|
core.addApiFunctionByName("EaseBounceOut");
|
||||||
|
core.addApiFunctionByName("EaseBounceInOut");
|
||||||
|
core.addApiFunctionByName("EaseElasticIn");
|
||||||
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
|
||||||
core.exportGlobalStruct("Color", x.name, x.values, x.description);
|
core.exportGlobalStruct("Color", x.name, x.values, x.description);
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -317,6 +317,7 @@ int app_run_quickjs(int argc, char** argv){
|
||||||
ChangeDirectory(originalCwd);
|
ChangeDirectory(originalCwd);
|
||||||
js_run(argc, argv);
|
js_run(argc, argv);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* also used to initialize the worker context */
|
/* also used to initialize the worker context */
|
||||||
|
|
Loading…
Reference in New Issue