Fixed auto generated docs for angelscript

This commit is contained in:
Chewico 2025-05-23 23:24:59 +02:00
parent f7d69eb21d
commit ea8420f0d8
9 changed files with 924 additions and 522 deletions

View File

@ -1,6 +1,6 @@
[Window][DockSpace Demo]
Pos=0,0
Size=1741,1159
Size=1280,720
Collapsed=0
[Window][Debug##Default]
@ -9,53 +9,53 @@ Size=400,400
Collapsed=0
[Window][Terrain Editor]
Pos=1315,24
Size=426,893
Pos=854,24
Size=426,454
Collapsed=0
DockId=0x00000006,1
DockId=0x00000006,0
[Window][Viewport]
Pos=361,24
Size=952,893
Collapsed=0
DockId=0x00000005,1
[Window][ViewportPannel]
Pos=361,24
Size=952,893
Size=491,454
Collapsed=0
DockId=0x00000005,0
[Window][ViewportPannel]
Pos=361,24
Size=491,454
Collapsed=0
DockId=0x00000005,1
[Window][ShaderExplorer]
Pos=0,919
Size=1741,240
Pos=0,480
Size=1280,240
Collapsed=0
DockId=0x00000004,1
[Window][TreePannel]
Pos=0,24
Size=359,893
Size=359,454
Collapsed=0
DockId=0x00000001,0
[Window][MeshExplorer]
Pos=0,919
Size=1741,240
Pos=0,480
Size=1280,240
Collapsed=0
DockId=0x00000004,0
[Window][PropertiesPannel]
Pos=1315,24
Size=426,893
Pos=854,24
Size=426,454
Collapsed=0
DockId=0x00000006,0
DockId=0x00000006,1
[Docking][Data]
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1741,1135 Split=Y Selected=0x34A4C10F
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
DockNode ID=0x00000003 Parent=0xA1672E74 SizeRef=1280,454 Split=X
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=359,696 Selected=0xE45B9F93
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1380,696 Split=X Selected=0x34A4C10F
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=952,454 CentralNode=1 Selected=0x34A4C10F
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=426,454 Selected=0x2A2C795E
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=426,454 Selected=0xA35A27E3
DockNode ID=0x00000004 Parent=0xA1672E74 SizeRef=1280,240 Selected=0xD962995A

View File

@ -11,14 +11,10 @@ namespace Deer {
EntityHandleStruct getRootEntity();
EntityHandleStruct getEntity(int);
std::string getName();
};
EnvironmentHandleStruct getMainEnvironment();
EnvironmentHandleStruct createEnvironment(std::string&);
EnvironmentHandleStruct getEnvironment(std::string&);
EnvironmentHandleStruct createEnvironment();
void registerEnvironmentStructs();
void registerEnvironmentFunctions();

View File

@ -27,20 +27,12 @@ namespace Deer {
return EntityHandleStruct(id, environmentId);
}
std::string EnvironmentStruct::getName() {
return EnvironmentManager::getEnvironmentName(environmentId);
}
EnvironmentHandleStruct getMainEnvironment() {
return EnvironmentHandleStruct(0);
}
EnvironmentHandleStruct createEnvironment(std::string& name) {
return EnvironmentHandleStruct(EnvironmentManager::createEnvironment(name));
}
EnvironmentHandleStruct getEnvironment(std::string& name) {
return EnvironmentHandleStruct(EnvironmentManager::getEnvironmentId(name));
EnvironmentHandleStruct createEnvironment() {
return EnvironmentHandleStruct(EnvironmentManager::createEnvironment());
}
}
}

View File

@ -18,15 +18,12 @@ namespace Deer {
void registerEnvironmentFunctions() {
scriptEngine->SetDefaultNamespace("Engine");
REGISTER_GLOBAL_FUNC("Environment getMainEnvironment()", getMainEnvironment);
REGISTER_GLOBAL_FUNC("Environment createEnvironment(const string&in)", createEnvironment);
REGISTER_GLOBAL_FUNC("Environment getEnvironment(const string&in)", getEnvironment);
REGISTER_GLOBAL_FUNC("Environment createEnvironment()", createEnvironment);
scriptEngine->SetDefaultNamespace("");
REGISTER_OBJECT_METHOD("Environment", "void render(FrameBuffer, SceneCamera&in)", EnvironmentStruct, render);
REGISTER_OBJECT_METHOD("Environment", "Entity getRootEntity()", EnvironmentStruct, getRootEntity);
REGISTER_OBJECT_METHOD("Environment", "Entity getEntity(int)", EnvironmentStruct, getEntity);
REGISTER_OBJECT_METHOD("Environment", "string get_name() const property", EnvironmentStruct, getName);
}
}
}

View File

@ -22,10 +22,19 @@
#include "Deer/Path.h"
std::stringstream stream;
void printEnumList(const asIScriptEngine& engine)
{
for (int i = 0; i < engine.GetEnumCount(); ++i)
{
void printFuncList(const asIScriptEngine& engine) {
for (int i = 0; i < engine.GetFuncdefCount(); ++i) {
asITypeInfo* t = engine.GetFuncdefByIndex(i);
if (!t) continue;
asIScriptFunction* f = t->GetFuncdefSignature();
stream << "funcdef "<< f->GetDeclaration(false, false, true) << ";\n";
}
}
void printEnumList(const asIScriptEngine& engine) {
for (int i = 0; i < engine.GetEnumCount(); ++i) {
const auto e = engine.GetEnumByIndex(i);
if (!e) continue;
@ -41,7 +50,7 @@ void printEnumList(const asIScriptEngine& engine)
stream << "\n";
}
stream << "}\n";
if (!ns.empty()) stream << "}\n";
if (!ns.empty()) stream << "}\n\n";
}
}
@ -49,13 +58,15 @@ void printClassTypeList(const asIScriptEngine& engine)
{
for (int i = 0; i < engine.GetObjectTypeCount(); ++i)
{
const auto t = engine.GetObjectTypeByIndex(i);
asITypeInfo* t = engine.GetObjectTypeByIndex(i);
if (!t) continue;
std::string_view ns = t->GetNamespace();
if (!ns.empty()) stream << "namespace " << ns << " {\n";
stream << "class " << t->GetName();
if (std::string("any") == t->GetName())
stream << " " ;
if (t->GetSubTypeCount() > 0)
{
stream << "<";
@ -70,26 +81,36 @@ void printClassTypeList(const asIScriptEngine& engine)
stream << " {\n";
for (int j = 0; j < t->GetFactoryCount(); ++j)
{
asIScriptFunction* f = t->GetFactoryByIndex(j);
stream << "\t" << f->GetDeclaration(false, false, true) << ";\n";
}
for (int j = 0; j < t->GetBehaviourCount(); ++j)
{
asEBehaviours behaviours;
const auto f = t->GetBehaviourByIndex(j, &behaviours);
if (behaviours == asBEHAVE_CONSTRUCT ||
behaviours == asBEHAVE_DESTRUCT)
{
stream << "\t" << f->GetDeclaration(false, true, true) << ";\n";
}
behaviours == asBEHAVE_DESTRUCT ||
behaviours == asBEHAVE_FACTORY)
stream << "\t" << f->GetDeclaration(false, false, true) << ";\n";
}
for (int j = 0; j < t->GetMethodCount(); ++j)
{
const auto m = t->GetMethodByIndex(j);
stream << "\t" << m->GetDeclaration(false, true, true) << ";\n";
stream << "\t" << m->GetDeclaration(false, false, true);
if (m->IsProperty())
stream << " property";
stream << ";\n";
}
for (int j = 0; j < t->GetPropertyCount(); ++j)
{
stream << "\t" << t->GetPropertyDeclaration(j, true) << ";\n";
stream << "\t" << t->GetPropertyDeclaration(j, false) << ";\n";
}
for (int j = 0; j < t->GetChildFuncdefCount(); ++j)
@ -98,7 +119,7 @@ void printClassTypeList(const asIScriptEngine& engine)
}
stream << "}\n";
if (!ns.empty()) stream << "}\n";
if (!ns.empty()) stream << "}\n\n";
}
}
@ -155,6 +176,8 @@ void printGlobalTypedef(const asIScriptEngine& engine)
void printAngelInfo(const asIScriptEngine& engine)
{
printFuncList(engine);
printEnumList(engine);
printClassTypeList(engine);
@ -173,7 +196,7 @@ void extract_angelScript() {
std::string str = stream.str();
Deer::Path filePath = Deer::DataStore::rootPath / DEER_EDITOR_PATH / "as.predefined_tmp";
Deer::Path filePath = Deer::DataStore::rootPath / DEER_EDITOR_PATH / "as.predefined";
std::ofstream file(filePath, std::ios::out | std::ios::binary);
file.write(reinterpret_cast<const char*>(str.c_str()), str.size());

View File

@ -1,4 +1,3 @@
class MeshExplorer : DockPanel {
string currentPath = "";

View File

@ -1,14 +1,13 @@
dictionary meshFrameBuffer;
Environment renderEnvironment;
FrameBuffer getMeshFrameBuffer(string mesh) {
if (meshFrameBuffer.exists(mesh))
return cast<FrameBuffer>(meshFrameBuffer[mesh]);
return generateMeshFrameBuffer(mesh);
}
FrameBuffer generateMeshFrameBuffer(string mesh) {
FrameBuffer fb = Engine::createRGBA8FrameBuffer(mesh, 64, 64);
return fb;
}

View File

@ -1,23 +1,71 @@
funcdef void ReciverFunc(any@ value);
funcdef void TransferFunc(any@ from, any@ data);
enum key
{
None = 0,
A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
K0, K1, K2, K3, K4, K5, K6, K7, K8, K9,
Tab, Enter, Escape, Backspace, Space, Delete, Insert, Home, End, PageUp, PageDown,
Right, Up, Down, Left,
RightCtrl, LeftShift, RightShift,
LeftAlt, RightAlt, LeftSuper,
RightSuper, LeftCtrl,
MouseLeft,MouseRight,MouseMiddle
};
//This file was generated automatically
funcdef bool less(const T&in a, const T&in b);
funcdef void ReciverFunc(any@);
funcdef void TransferFunc(any@, any@);
enum key {
A = 546,
B = 547,
C = 548,
D = 549,
E = 550,
F = 551,
G = 552,
H = 553,
I = 554,
J = 555,
K = 556,
L = 557,
M = 558,
N = 559,
O = 560,
P = 561,
Q = 562,
R = 563,
S = 564,
T = 565,
U = 566,
V = 567,
W = 568,
X = 569,
Y = 570,
Z = 571,
K0 = 536,
K1 = 537,
K2 = 538,
K3 = 539,
K4 = 540,
K5 = 541,
K6 = 542,
K7 = 543,
K8 = 544,
K9 = 545,
Tab = 512,
Enter = 525,
Escape = 526,
Backspace = 523,
Space = 524,
Delete = 522,
Insert = 521,
Home = 519,
End = 520,
PageUp = 517,
PageDown = 518,
Right = 514,
Up = 515,
Down = 516,
Left = 513,
RightCtrl = 531,
LeftShift = 528,
RightShift = 532,
LeftAlt = 529,
RightAlt = 533,
LeftSuper = 530,
RightSuper = 534,
LeftCtrl = 527,
MouseLeft = 641,
MouseRight = 642,
MouseMiddle = 643
}
enum ResourceType {
Mesh = 1,
Shader = 2
@ -66,448 +114,10 @@ class string {
void insert(uint pos, const string&in other);
void erase(uint pos, int count = - 1);
}
class ref {
~ref();
ref();
ref(const ref&in);
ref(const ?&in);
void opCast(?&out);
ref& opHndlAssign(const ref&in);
ref& opHndlAssign(const ?&in);
bool opEquals(const ref&in) const;
bool opEquals(const ?&in) const;
}
class any {
any& opAssign(any&in);
any();
any(?&in);
void store(?&in);
void store(const int64&in);
void store(const double&in);
bool retrieve(?&out);
bool retrieve(int64&out);
bool retrieve(double&out);
}
class Entity {
// Gets the entity's name
string get_name() const property;
// Sets the entity's name
void set_name(string&in) property;
// Gets the unique entity ID
int get_id() const property;
// Creates a new child entity with the given name
Entity createChild(const string&in);
// Returns true if this entity is the root entity
bool get_isRoot() const property;
// Destroys this entity
void destroy();
// Returns true if the entity currently exists
bool get_exists() const property;
// Gets the parent entity
Entity get_parent() property;
// Sets the parent entity
void set_parent(Entity) property;
// Checks if this entity is a descendant of the given entity
bool isDescendantOf(Entity);
// Compares this entity with another entity for equality
bool opEquals(const Entity&in) const;
// Gets the collection of child entities
EntityChilds get_childs() const property;
// Gets the transform component of the entity
TransformComponent get_transform() const property;
// Mesh component methods
MeshComponent getMeshComponent();
MeshComponent createMeshComponent();
bool hasMeshComponent();
void removeMeshComponent();
// Shader component methods
ShaderComponent getShaderComponent();
ShaderComponent createShaderComponent();
bool hasShaderComponent();
void removeShaderComponent();
// Camera component methods
CameraComponent getCameraComponent();
CameraComponent createCameraComponent();
bool hasCameraComponent();
void removeCameraComponent();
}
class EntityChilds {
// Gets the number of child entities
int get_count() const property;
// Access child entity by index
Entity opIndex(int) const;
}
class TransformComponent {
// Gets/sets position vector
vec3 get_position() const property;
void set_position(const vec3) property;
// Gets/sets scale vector
vec3 get_scale() const property;
void set_scale(const vec3) property;
// Gets/sets rotation vector (Euler angles)
vec3 get_rotation() const property;
void set_rotation(const vec3) property;
}
class MeshComponent {
// Is mesh component active?
bool get_isActive() const property;
void set_isActive(const bool) property;
// Does this component have a mesh assigned?
bool get_hasMesh() const property;
// Clears the mesh data
void clear();
// Gets/sets mesh identifier
string getMesh();
void setMesh(string&in);
}
class ShaderComponent {
// Does this component have a shader assigned?
bool get_hasShader() const property;
// Clears the shader data
void clear();
// Gets/sets shader identifier
string getShader();
void setShader(const string&in);
}
class CameraComponent {
// Gets/sets field of view
float get_fov() const property;
void set_fov(float) property;
// Gets/sets aspect ratio
float get_aspectRatio() const property;
void set_aspectRatio(float) property;
// Gets/sets near clipping plane distance
float get_nearZ() const property;
void set_nearZ(float) property;
// Gets/sets far clipping plane distance
float get_farZ() const property;
void set_farZ(float) property;
}
class vec3 {
// Default constructor (zero vector)
vec3();
// Constructor with components (y,z default to 0)
vec3(float, float = 0, float = 0);
// Vector addition
vec3 opAdd(const vec3&in);
// Vector subtraction
vec3 opSub(const vec3&in) const;
// Negation
vec3 opNeg() const;
// Multiply by scalar
vec3 opMul(float) const;
vec3 opMul_r(float) const;
float x;
float y;
float z;
}
class quat {
~quat();
quat();
quat(const quat&in);
quat(float, float, float, float);
// Quaternion multiplication
quat opMul(const quat&in) const;
// Gets/sets Euler angles representation of the quaternion
vec3 getEuler() const;
void setEuler(vec3);
float x;
float y;
float z;
float w;
}
class Transform {
Transform();
vec3 position;
vec3 scale;
quat rotation;
// Returns a vec3 relative to the transform
vec3 relative(vec3);
}
class Camera {
~Camera();
float fov;
float aspect;
float nearZ;
float farZ;
}
class SceneCamera {
~SceneCamera();
Camera camera;
Transform transform;
}
class FrameBuffer {
// Clears the framebuffer with RGBA color
void clearRGBA(int, int, int, int);
// Gets the height of the framebuffer
int get_height() const property;
// Resizes the framebuffer
void resize(int, int);
// Gets the framebuffer's name
string get_name() const property;
bool isValid();
}
class Environment {
// Renders the scene with the given camera and framebuffer target
void render(FrameBuffer, SceneCamera);
// Gets the root entity of the environment
Entity getRootEntity();
// Gets an entity by its ID
Entity getEntity(int);
// Gets the environment's name
string get_name() const property;
}
class DockPanel {
// Called to render the dock panel UI
void onRender();
void onInit();
void onMenuBar();
}
// Format a signed 64-bit integer to string with optional formatting and width
string formatInt(int64 val, const string& in options = "", uint width = 0);
// Format an unsigned 64-bit integer to string with optional formatting and width
string formatUInt(uint64 val, const string& in options = "", uint width = 0);
// Format a double-precision float to string with options, width, and precision
string formatFloat(double val, const string& in options = "", uint width = 0, uint precision = 0);
// Parse a signed 64-bit integer from string with base, returning byte count parsed
int64 parseInt(const string& in str, uint base = 10, uint& out byteCount = 0);
// Parse an unsigned 64-bit integer from string with base, returning byte count parsed
uint64 parseUInt(const string& in str, uint base = 10, uint& out byteCount = 0);
// Parse a double-precision float from string, returning byte count parsed
double parseFloat(const string& in str, uint& out byteCount = 0);
namespace Engine {
// Print a message to the engine's console or log
void print(const string& in message);
// Retrieve the root entity of the scene or hierarchy
Entity getRoot();
// Create an RGBA8 framebuffer with a name and size
FrameBuffer createRGBA8FrameBuffer(const string& in name, int width, int height);
// Retrieve an existing framebuffer by name
FrameBuffer getFrameBuffer(const string& in name);
// Get the main environment instance
Environment getMainEnvironment();
// Create a new environment with the given name
Environment createEnvironment(const string& in name);
// Retrieve an environment by name
Environment getEnvironment(const string& in name);
}
namespace Resource {
// Get the number of resources of a given type and category
int getResourceCount(ResourceType type, const string& in category);
// Get the name of a resource by type, category, and resource ID
string getResourceNameById(ResourceType type, const string& in category, int id);
// Get the file path of a resource by type, category, and resource ID
string getResourcePathById(ResourceType type, const string& in category, int id);
// Get the number of directories of a given resource type and category
int getDirCount(ResourceType type, const string& in category);
// Get the path of a directory by resource type, category, and directory ID
string getDirPathById(ResourceType type, const string& in category, int id);
// Get the name of a directory by resource type, category, and directory ID
string getDirNameById(ResourceType type, const string& in category, int id);
}
namespace UI {
// Columns
// Setup automatic columns with given count
void setupAutomaticColumns(int count);
// Setup fixed columns count
void setupColumns(int count);
// End columns layout
void endColumns();
// Move to next column
void nextColumn();
// Tree nodes
// Draw leaf node with label and open state
void treeNodeLeaf(const string& in label, bool open);
// Draw tree node with label, open state, data, and callback
bool treeNode(const string& in label, bool open, any@ data, ReciverFunc@ cb);
// Draw component node with label, data, and callback
bool componentNode(const string& in label, any@ data, ReciverFunc@ cb);
// Draw component node with context menu support
bool componentNode_contextMenu(const string& in label, any@ data, ReciverFunc@ cb, ReciverFunc@ ctxMenu);
// Popups & Context menus
// Show a context menu popup with callback
void contextMenuPopup(const string& in label, any@ data, ReciverFunc@ cb);
// Popup attached to an item with label, data, and callback
void contextItemPopup(const string& in label, any@ data, ReciverFunc@ cb);
// Show a modal popup blocking interaction until closed
void modalPopup(const string& in label, ReciverFunc@ cb);
// Show a simple popup window with callback
void simplePopup(const string& in label, ReciverFunc@ cb);
// Open a popup with label and associated data
void openPopup(const string& in label, any@ data);
// Close the currently opened popup
void closePopup();
// Drag & Drop
// Start a drag-drop source with type, data, and payload string
void dragDropSource(const string& in type, any@ data, const string& in payload);
// Define a drag-drop target with type, data, and transfer callback
void dragDropTarget(const string& in type, any@ data, TransferFunc@ transfer);
// Buttons & Controls
// Create a clickable button with label
bool button(const string& in label);
// Create a centered button
bool buttonCenter(const string& in label);
// Create a button aligned to the end of the line
bool buttonEnd(const string& in label);
// Checkbox toggle with label and current value
bool checkbox(const string& in label, bool val);
// Disabled checkbox with label and current value
bool checkboxDisabled(const string& in label, bool val);
// Drawing
// Draw a framebuffer with given width and height
void drawFrameBuffer(FrameBuffer fb, int w, int h);
// Draw a framebuffer centered with given dimensions
void drawFrameBufferCentered(FrameBuffer fb, int w, int h);
// Draw an icon with name and size
void drawIcon(const string& in icon, int size);
// Draw a centered icon with name and size
void drawIconCentered(const string& in icon, int size);
// Input & Interaction
// Text input field with label, initial value, and output string
bool inputText(const string& in label, const string& in initial, string& out result);
// Check if an item was clicked with specific mouse button
bool isItemClicked(int button);
// Check if mouse was double-clicked with specific button
bool isMouseDoubleClicked(int button);
// Sliders
// Slider for a float value with step increment
float magicSlider(const string& in label, float val, float step);
// Slider for a vec3 value with step increment
vec3 magicSlider3(const string& in label, vec3 val, float step);
// Menu Items
// Selectable menu item with label
bool menuItem(const string& in label);
// Disabled (non-selectable) menu item with label
void menuItemDisabled(const string& in label);
// Menu space with label, data, and callback
void menuSpace(const string& in label, any@ data, ReciverFunc@ cb);
// Layout
// Place next UI element on the same line
void sameline();
// Draw a horizontal separator line
void separator();
// Add vertical space
void space();
// Add multiple vertical spaces with optional spacing
void space(int count, int spacing=10);
// Text
// Draw normal text
void text(const string& in txt);
// Draw centered text
void textCenter(const string& in txt);
// Draw colored text with RGB and string
void textColor(float r, float g, float b, const string& in txt);
// Draw text aligned to end
void textEnd(const string& in txt);
// Titles
// Draw a title text
void title(const string& in txt);
// Draw a centered title
void titleCenter(const string& in txt);
// Draw a vertically offset centered title
void titleCenterY(const string& in txt, int yOffset);
// Draw a title aligned to the end
void titleEnd(const string& in txt);
bool isPannelActive();
bool isKeyDown(key);
bool isKeyPressed(key);
bool isMouseDraggin(key);
float getMouseDragDeltaX();
float getMouseDragDeltaY();
float getMouseDeltaX();
float getMouseDeltaY();
int getAvailableSizeX();
int getAvailableSizeY();
void disablePannelPadding(bool);
int sliderInt(string&in, int value, int min, int max);
float slider(string&in, float value, float min, float max);
}
class array<T> {
T[]@ array(int&in);
T[]@ array(int&in, uint length);
T[]@ array(int&in, uint length, const T&in value);
T& opIndex(uint index);
const T& opIndex(uint index) const;
T[]& opAssign(const T[]&in);
@ -531,10 +141,9 @@ class array<T> {
int findByRef(uint startAt, const T&in value) const;
bool opEquals(const T[]&in) const;
bool isEmpty() const;
//void sort(T[]::less&in, uint startAt = 0, uint count = uint ( - 1 ));
void sort(T[]::less&in, uint startAt = 0, uint count = uint ( - 1 ));
funcdef bool less(const T&in, const T&in);
}
class dictionaryValue {
~dictionaryValue();
dictionaryValue();
@ -550,6 +159,7 @@ class dictionaryValue {
double opConv();
}
class dictionary {
dictionary@ dictionary();
dictionary& opAssign(const dictionary&in);
void set(const string&in, const ?&in);
bool get(const string&in, ?&out) const;
@ -565,4 +175,226 @@ class dictionary {
string[]@ getKeys() const;
dictionaryValue& opIndex(const string&in);
const dictionaryValue& opIndex(const string&in) const;
}
}
class ref {
~ref();
ref();
ref(const ref&in);
ref(const ?&in);
void opCast(?&out);
ref& opHndlAssign(const ref&in);
ref& opHndlAssign(const ?&in);
bool opEquals(const ref&in) const;
bool opEquals(const ?&in) const;
}
class any {
any@ any();
any@ any(?&in);
any@ any(const int64&in);
any@ any(const double&in);
any& opAssign(any&in);
void store(?&in);
void store(const int64&in);
void store(const double&in);
bool retrieve(?&out);
bool retrieve(int64&out);
bool retrieve(double&out);
}
class Entity {
string get_name() const property;
void set_name(string&in) property;
int get_id() const property;
Entity createChild(const string&in);
bool get_isRoot() const property;
void destroy();
bool get_exists() const property;
Entity get_parent() property;
void set_parent(Entity) property;
bool isDescendantOf(Entity);
bool opEquals(const Entity&in) const;
EntityChilds get_childs() const property;
TransformComponent get_transform() const property;
MeshComponent getMeshComponent();
MeshComponent createMeshComponent();
bool hasMeshComponent();
void removeMeshComponent();
ShaderComponent getShaderComponent();
ShaderComponent createShaderComponent();
bool hasShaderComponent();
void removeShaderComponent();
CameraComponent getCameraComponent();
CameraComponent createCameraComponent();
bool hasCameraComponent();
void removeCameraComponent();
}
class EntityChilds {
int get_count() const property;
Entity opIndex(int) const;
}
class TransformComponent {
vec3 get_position() const property;
vec3 get_scale() const property;
vec3 get_rotation() const property;
void set_position(const vec3) property;
void set_scale(const vec3) property;
void set_rotation(const vec3) property;
}
class MeshComponent {
bool get_isActive() const property;
bool get_hasMesh() const property;
void clear();
string getMesh();
void setMesh(string&in);
void set_isActive(const bool) property;
}
class ShaderComponent {
bool get_hasShader() const property;
void clear();
string getShader();
void setShader(const string&in);
}
class CameraComponent {
float get_fov() const property;
float get_aspectRatio() const property;
float get_nearZ() const property;
float get_farZ() const property;
void set_fov(float) property;
void set_aspectRatio(float) property;
void set_nearZ(float) property;
void set_farZ(float) property;
}
class vec3 {
vec3();
vec3(float, float = 0, float = 0);
vec3 opAdd(const vec3&in);
vec3 opSub(const vec3&in) const;
vec3 opNeg() const;
vec3 opMul(float) const;
vec3 opMul_r(float) const;
float x;
float y;
float z;
}
class quat {
~quat();
quat();
quat(float, float, float, float);
quat opMul(const quat&in) const;
vec3 getEuler() const;
void setEuler(vec3);
float x;
float y;
float z;
float w;
}
class Transform {
Transform();
vec3 relative(vec3);
vec3 position;
vec3 scale;
quat rotation;
}
class Camera {
Camera();
float fov;
float aspect;
float nearZ;
float farZ;
}
class SceneCamera {
SceneCamera();
Camera camera;
Transform transform;
}
class FrameBuffer {
FrameBuffer();
void clearRGBA(int, int, int, int);
int get_height() const property;
void resize(int, int);
string get_name() const property;
bool isValid();
}
class Environment {
void render(FrameBuffer, SceneCamera&in);
Entity getRootEntity();
Entity getEntity(int);
}
class DockPanel {
void onRender();
}
string formatInt(int64 val, const string&in options = "", uint width = 0);
string formatUInt(uint64 val, const string&in options = "", uint width = 0);
string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0);
int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0);
uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0);
double parseFloat(const string&in, uint&out byteCount = 0);
namespace Engine { Entity getRoot(); }
namespace UI { bool button(const string&in); }
namespace UI { bool buttonCenter(const string&in); }
namespace UI { bool buttonEnd(const string&in); }
namespace UI { bool checkbox(const string&in, bool); }
namespace UI { bool checkboxDisabled(const string&in, bool); }
namespace UI { void drawFrameBuffer(FrameBuffer, int, int); }
namespace UI { void drawFrameBufferCentered(FrameBuffer, int, int); }
namespace UI { void drawIcon(const string&in, int); }
namespace UI { void drawIconCentered(const string&in, int); }
namespace UI { bool inputText(const string&in, const string&in, string&out); }
namespace UI { bool isItemClicked(int); }
namespace UI { bool isMouseDoubleClicked(int); }
namespace UI { float magicSlider(const string&in, float, float); }
namespace UI { vec3 magicSlider3(const string&in, vec3, float); }
namespace UI { bool menuItem(const string&in); }
namespace UI { void menuItemDisabled(const string&in); }
namespace UI { void menuSpace(const string&in, any@, ReciverFunc@); }
namespace UI { void sameline(); }
namespace UI { void separator(); }
namespace UI { void space(); }
namespace UI { void space(int, int = 10); }
namespace UI { void text(const string&in); }
namespace UI { void textCenter(const string&in); }
namespace UI { void textColor(float, float, float, const string&in); }
namespace UI { void textEnd(const string&in); }
namespace UI { void title(const string&in); }
namespace UI { void titleCenter(const string&in); }
namespace UI { void titleCenterY(const string&in, int); }
namespace UI { void titleEnd(const string&in); }
namespace UI { bool isKeyDown(key); }
namespace UI { bool isKeyPressed(key); }
namespace UI { bool isMouseDraggin(key); }
namespace UI { bool isPannelActive(); }
namespace UI { float getMouseDragDeltaX(); }
namespace UI { float getMouseDragDeltaY(); }
namespace UI { float getMouseDeltaX(); }
namespace UI { float getMouseDeltaY(); }
namespace UI { int getAvailableSizeX(); }
namespace UI { int getAvailableSizeY(); }
namespace UI { void disablePannelPadding(bool); }
namespace UI { int sliderInt(string&in, int, int, int); }
namespace UI { float slider(string&in, float, float, float); }
namespace Engine { FrameBuffer createRGBA8FrameBuffer(const string&in, int, int); }
namespace Engine { FrameBuffer getFrameBuffer(const string&in); }
namespace Engine { Environment getMainEnvironment(); }
namespace Engine { Environment createEnvironment(); }
namespace UI { void setupAutomaticColumns(int); }
namespace UI { void setupColumns(int); }
namespace UI { void endColumns(); }
namespace UI { void nextColumn(); }
namespace Resource { int getResourceCount(ResourceType, const string&in); }
namespace Resource { string getResourceNameById(ResourceType, const string&in, int); }
namespace Resource { string getResourcePathById(ResourceType, const string&in, int); }
namespace Resource { int getDirCount(ResourceType, const string&in); }
namespace Resource { string getDirPathById(ResourceType, const string&in, int); }
namespace Resource { string getDirNameById(ResourceType, const string&in, int); }
namespace Engine { void print(const string&in); }
namespace UI { void treeNodeLeaf(const string&in, bool); }
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
namespace UI { bool componentNode_contextMenu(const string&in, any@, ReciverFunc@, ReciverFunc@); }
namespace UI { void contextItemPopup(const string&in, any@, ReciverFunc@); }
namespace UI { void contextMenuPopup(const string&in, any@, ReciverFunc@); }
namespace UI { void modalPopup(const string&in, ReciverFunc@); }
namespace UI { void simplePopup(const string&in, ReciverFunc@); }
namespace UI { void openPopup(const string&in, any@); }
namespace UI { void closePopup(); }
namespace UI { void dragDropSource(const string&in, any@, const string&in); }
namespace UI { void dragDropTarget(const string&in, any@, TransferFunc@); }

View File

@ -0,0 +1,564 @@
funcdef void ReciverFunc(any@ value);
funcdef void TransferFunc(any@ from, any@ data);
enum key
{
None = 0,
A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
K0, K1, K2, K3, K4, K5, K6, K7, K8, K9,
Tab, Enter, Escape, Backspace, Space, Delete, Insert, Home, End, PageUp, PageDown,
Right, Up, Down, Left,
RightCtrl, LeftShift, RightShift,
LeftAlt, RightAlt, LeftSuper,
RightSuper, LeftCtrl,
MouseLeft,MouseRight,MouseMiddle
};
//This file was generated automatically
enum ResourceType {
Mesh = 1,
Shader = 2
}
class string {
~string();
string();
string(const string&in);
string& opAssign(const string&in);
string& opAddAssign(const string&in);
bool opEquals(const string&in) const;
int opCmp(const string&in) const;
string opAdd(const string&in) const;
uint length() const;
void resize(uint);
bool isEmpty() const;
uint8& opIndex(uint);
const uint8& opIndex(uint) const;
string& opAssign(double);
string& opAddAssign(double);
string opAdd(double) const;
string opAdd_r(double) const;
string& opAssign(float);
string& opAddAssign(float);
string opAdd(float) const;
string opAdd_r(float) const;
string& opAssign(int64);
string& opAddAssign(int64);
string opAdd(int64) const;
string opAdd_r(int64) const;
string& opAssign(uint64);
string& opAddAssign(uint64);
string opAdd(uint64) const;
string opAdd_r(uint64) const;
string& opAssign(bool);
string& opAddAssign(bool);
string opAdd(bool) const;
string opAdd_r(bool) const;
string substr(uint start = 0, int count = - 1) const;
int findFirst(const string&in, uint start = 0) const;
int findFirstOf(const string&in, uint start = 0) const;
int findFirstNotOf(const string&in, uint start = 0) const;
int findLast(const string&in, int start = - 1) const;
int findLastOf(const string&in, int start = - 1) const;
int findLastNotOf(const string&in, int start = - 1) const;
void insert(uint pos, const string&in other);
void erase(uint pos, int count = - 1);
}
class ref {
~ref();
ref();
ref(const ref&in);
ref(const ?&in);
void opCast(?&out);
ref& opHndlAssign(const ref&in);
ref& opHndlAssign(const ?&in);
bool opEquals(const ref&in) const;
bool opEquals(const ?&in) const;
}
class any {
any& opAssign(any&in);
any();
any(?&in);
void store(?&in);
void store(const int64&in);
void store(const double&in);
bool retrieve(?&out);
bool retrieve(int64&out);
bool retrieve(double&out);
}
class Entity {
// Gets the entity's name
string get_name() const property;
// Sets the entity's name
void set_name(string&in) property;
// Gets the unique entity ID
int get_id() const property;
// Creates a new child entity with the given name
Entity createChild(const string&in);
// Returns true if this entity is the root entity
bool get_isRoot() const property;
// Destroys this entity
void destroy();
// Returns true if the entity currently exists
bool get_exists() const property;
// Gets the parent entity
Entity get_parent() property;
// Sets the parent entity
void set_parent(Entity) property;
// Checks if this entity is a descendant of the given entity
bool isDescendantOf(Entity);
// Compares this entity with another entity for equality
bool opEquals(const Entity&in) const;
// Gets the collection of child entities
EntityChilds get_childs() const property;
// Gets the transform component of the entity
TransformComponent get_transform() const property;
// Mesh component methods
MeshComponent getMeshComponent();
MeshComponent createMeshComponent();
bool hasMeshComponent();
void removeMeshComponent();
// Shader component methods
ShaderComponent getShaderComponent();
ShaderComponent createShaderComponent();
bool hasShaderComponent();
void removeShaderComponent();
// Camera component methods
CameraComponent getCameraComponent();
CameraComponent createCameraComponent();
bool hasCameraComponent();
void removeCameraComponent();
}
class EntityChilds {
// Gets the number of child entities
int get_count() const property;
// Access child entity by index
Entity opIndex(int) const;
}
class TransformComponent {
// Gets/sets position vector
vec3 get_position() const property;
void set_position(const vec3) property;
// Gets/sets scale vector
vec3 get_scale() const property;
void set_scale(const vec3) property;
// Gets/sets rotation vector (Euler angles)
vec3 get_rotation() const property;
void set_rotation(const vec3) property;
}
class MeshComponent {
// Is mesh component active?
bool get_isActive() const property;
void set_isActive(const bool) property;
// Does this component have a mesh assigned?
bool get_hasMesh() const property;
// Clears the mesh data
void clear();
// Gets/sets mesh identifier
string getMesh();
void setMesh(string&in);
}
class ShaderComponent {
// Does this component have a shader assigned?
bool get_hasShader() const property;
// Clears the shader data
void clear();
// Gets/sets shader identifier
string getShader();
void setShader(const string&in);
}
class CameraComponent {
// Gets/sets field of view
float get_fov() const property;
void set_fov(float) property;
// Gets/sets aspect ratio
float get_aspectRatio() const property;
void set_aspectRatio(float) property;
// Gets/sets near clipping plane distance
float get_nearZ() const property;
void set_nearZ(float) property;
// Gets/sets far clipping plane distance
float get_farZ() const property;
void set_farZ(float) property;
}
class vec3 {
// Default constructor (zero vector)
vec3();
// Constructor with components (y,z default to 0)
vec3(float, float = 0, float = 0);
// Vector addition
vec3 opAdd(const vec3&in);
// Vector subtraction
vec3 opSub(const vec3&in) const;
// Negation
vec3 opNeg() const;
// Multiply by scalar
vec3 opMul(float) const;
vec3 opMul_r(float) const;
float x;
float y;
float z;
}
class quat {
~quat();
quat();
quat(const quat&in);
quat(float, float, float, float);
// Quaternion multiplication
quat opMul(const quat&in) const;
// Gets/sets Euler angles representation of the quaternion
vec3 getEuler() const;
void setEuler(vec3);
float x;
float y;
float z;
float w;
}
class Transform {
Transform();
vec3 position;
vec3 scale;
quat rotation;
// Returns a vec3 relative to the transform
vec3 relative(vec3);
}
class Camera {
~Camera();
float fov;
float aspect;
float nearZ;
float farZ;
}
class SceneCamera {
~SceneCamera();
Camera camera;
Transform transform;
}
class FrameBuffer {
// Clears the framebuffer with RGBA color
void clearRGBA(int, int, int, int);
// Gets the height of the framebuffer
int get_height() const property;
// Resizes the framebuffer
void resize(int, int);
// Gets the framebuffer's name
string get_name() const property;
bool isValid();
}
class Environment {
// Renders the scene with the given camera and framebuffer target
void render(FrameBuffer, SceneCamera);
// Gets the root entity of the environment
Entity getRootEntity();
// Gets an entity by its ID
Entity getEntity(int);
}
class DockPanel {
// Called to render the dock panel UI
void onRender();
void onInit();
void onMenuBar();
}
// Format a signed 64-bit integer to string with optional formatting and width
string formatInt(int64 val, const string& in options = "", uint width = 0);
// Format an unsigned 64-bit integer to string with optional formatting and width
string formatUInt(uint64 val, const string& in options = "", uint width = 0);
// Format a double-precision float to string with options, width, and precision
string formatFloat(double val, const string& in options = "", uint width = 0, uint precision = 0);
// Parse a signed 64-bit integer from string with base, returning byte count parsed
int64 parseInt(const string& in str, uint base = 10, uint& out byteCount = 0);
// Parse an unsigned 64-bit integer from string with base, returning byte count parsed
uint64 parseUInt(const string& in str, uint base = 10, uint& out byteCount = 0);
// Parse a double-precision float from string, returning byte count parsed
double parseFloat(const string& in str, uint& out byteCount = 0);
namespace Engine {
// Print a message to the engine's console or log
void print(const string& in message);
// Retrieve the root entity of the scene or hierarchy
Entity getRoot();
// Create an RGBA8 framebuffer with a name and size
FrameBuffer createRGBA8FrameBuffer(const string& in name, int width, int height);
// Retrieve an existing framebuffer by name
FrameBuffer getFrameBuffer(const string& in name);
// Get the main environment instance
Environment getMainEnvironment();
// Create a new environment
Environment createEnvironment();
}
namespace Resource {
// Get the number of resources of a given type and category
int getResourceCount(ResourceType type, const string& in category);
// Get the name of a resource by type, category, and resource ID
string getResourceNameById(ResourceType type, const string& in category, int id);
// Get the file path of a resource by type, category, and resource ID
string getResourcePathById(ResourceType type, const string& in category, int id);
// Get the number of directories of a given resource type and category
int getDirCount(ResourceType type, const string& in category);
// Get the path of a directory by resource type, category, and directory ID
string getDirPathById(ResourceType type, const string& in category, int id);
// Get the name of a directory by resource type, category, and directory ID
string getDirNameById(ResourceType type, const string& in category, int id);
}
namespace UI {
// Columns
// Setup automatic columns with given count
void setupAutomaticColumns(int count);
// Setup fixed columns count
void setupColumns(int count);
// End columns layout
void endColumns();
// Move to next column
void nextColumn();
// Tree nodes
// Draw leaf node with label and open state
void treeNodeLeaf(const string& in label, bool open);
// Draw tree node with label, open state, data, and callback
bool treeNode(const string& in label, bool open, any@ data, ReciverFunc@ cb);
// Draw component node with label, data, and callback
bool componentNode(const string& in label, any@ data, ReciverFunc@ cb);
// Draw component node with context menu support
bool componentNode_contextMenu(const string& in label, any@ data, ReciverFunc@ cb, ReciverFunc@ ctxMenu);
// Popups & Context menus
// Show a context menu popup with callback
void contextMenuPopup(const string& in label, any@ data, ReciverFunc@ cb);
// Popup attached to an item with label, data, and callback
void contextItemPopup(const string& in label, any@ data, ReciverFunc@ cb);
// Show a modal popup blocking interaction until closed
void modalPopup(const string& in label, ReciverFunc@ cb);
// Show a simple popup window with callback
void simplePopup(const string& in label, ReciverFunc@ cb);
// Open a popup with label and associated data
void openPopup(const string& in label, any@ data);
// Close the currently opened popup
void closePopup();
// Drag & Drop
// Start a drag-drop source with type, data, and payload string
void dragDropSource(const string& in type, any@ data, const string& in payload);
// Define a drag-drop target with type, data, and transfer callback
void dragDropTarget(const string& in type, any@ data, TransferFunc@ transfer);
// Buttons & Controls
// Create a clickable button with label
bool button(const string& in label);
// Create a centered button
bool buttonCenter(const string& in label);
// Create a button aligned to the end of the line
bool buttonEnd(const string& in label);
// Checkbox toggle with label and current value
bool checkbox(const string& in label, bool val);
// Disabled checkbox with label and current value
bool checkboxDisabled(const string& in label, bool val);
// Drawing
// Draw a framebuffer with given width and height
void drawFrameBuffer(FrameBuffer fb, int w, int h);
// Draw a framebuffer centered with given dimensions
void drawFrameBufferCentered(FrameBuffer fb, int w, int h);
// Draw an icon with name and size
void drawIcon(const string& in icon, int size);
// Draw a centered icon with name and size
void drawIconCentered(const string& in icon, int size);
// Input & Interaction
// Text input field with label, initial value, and output string
bool inputText(const string& in label, const string& in initial, string& out result);
// Check if an item was clicked with specific mouse button
bool isItemClicked(int button);
// Check if mouse was double-clicked with specific button
bool isMouseDoubleClicked(int button);
// Sliders
// Slider for a float value with step increment
float magicSlider(const string& in label, float val, float step);
// Slider for a vec3 value with step increment
vec3 magicSlider3(const string& in label, vec3 val, float step);
// Menu Items
// Selectable menu item with label
bool menuItem(const string& in label);
// Disabled (non-selectable) menu item with label
void menuItemDisabled(const string& in label);
// Menu space with label, data, and callback
void menuSpace(const string& in label, any@ data, ReciverFunc@ cb);
// Layout
// Place next UI element on the same line
void sameline();
// Draw a horizontal separator line
void separator();
// Add vertical space
void space();
// Add multiple vertical spaces with optional spacing
void space(int count, int spacing=10);
// Text
// Draw normal text
void text(const string& in txt);
// Draw centered text
void textCenter(const string& in txt);
// Draw colored text with RGB and string
void textColor(float r, float g, float b, const string& in txt);
// Draw text aligned to end
void textEnd(const string& in txt);
// Titles
// Draw a title text
void title(const string& in txt);
// Draw a centered title
void titleCenter(const string& in txt);
// Draw a vertically offset centered title
void titleCenterY(const string& in txt, int yOffset);
// Draw a title aligned to the end
void titleEnd(const string& in txt);
bool isPannelActive();
bool isKeyDown(key);
bool isKeyPressed(key);
bool isMouseDraggin(key);
float getMouseDragDeltaX();
float getMouseDragDeltaY();
float getMouseDeltaX();
float getMouseDeltaY();
int getAvailableSizeX();
int getAvailableSizeY();
void disablePannelPadding(bool);
int sliderInt(string&in, int value, int min, int max);
float slider(string&in, float value, float min, float max);
}
class array<T> {
T& opIndex(uint index);
const T& opIndex(uint index) const;
T[]& opAssign(const T[]&in);
void insertAt(uint index, const T&in value);
void insertAt(uint index, const T[]&inout arr);
void insertLast(const T&in value);
void removeAt(uint index);
void removeLast();
void removeRange(uint start, uint count);
uint length() const;
void reserve(uint length);
void resize(uint length);
void sortAsc();
void sortAsc(uint startAt, uint count);
void sortDesc();
void sortDesc(uint startAt, uint count);
void reverse();
int find(const T&in value) const;
int find(uint startAt, const T&in value) const;
int findByRef(const T&in value) const;
int findByRef(uint startAt, const T&in value) const;
bool opEquals(const T[]&in) const;
bool isEmpty() const;
//void sort(T[]::less&in, uint startAt = 0, uint count = uint ( - 1 ));
funcdef bool less(const T&in, const T&in);
}
class dictionaryValue {
~dictionaryValue();
dictionaryValue();
dictionaryValue& opAssign(const dictionaryValue&in);
dictionaryValue& opHndlAssign(const ?&in);
dictionaryValue& opHndlAssign(const dictionaryValue&in);
dictionaryValue& opAssign(const ?&in);
dictionaryValue& opAssign(double);
dictionaryValue& opAssign(int64);
void opCast(?&out);
void opConv(?&out);
int64 opConv();
double opConv();
}
class dictionary {
dictionary& opAssign(const dictionary&in);
void set(const string&in, const ?&in);
bool get(const string&in, ?&out) const;
void set(const string&in, const int64&in);
bool get(const string&in, int64&out) const;
void set(const string&in, const double&in);
bool get(const string&in, double&out) const;
bool exists(const string&in) const;
bool isEmpty() const;
uint getSize() const;
bool delete(const string&in);
void deleteAll();
string[]@ getKeys() const;
dictionaryValue& opIndex(const string&in);
const dictionaryValue& opIndex(const string&in) const;
}