Files
simian/scripts/as.predefined
T
nick aa4c7cf58a
CI / build-and-test (push) Failing after 11m9s
feat: entt scripting support
2026-03-05 23:22:09 +13:00

113 lines
3.2 KiB
Plaintext

typedef void string;
string format(const string&in fmt, const ?&in ...);
// Array template (provided by scriptarray add-on)
external shared interface array<T> {
uint length() const;
void resize(uint);
void insertAt(uint, const T&in);
void insertLast(const T&in);
void removeAt(uint);
void removeLast();
T& opIndex(uint);
const T& opIndex(uint) const;
}
// Logging functions
void Print(const string&in);
void Log(int level, const string&in);
int LOG_TRACE;
int LOG_DEBUG;
int LOG_INFO;
int LOG_WARNING;
int LOG_ERROR;
int LOG_FATAL;
// Toast notification functions
namespace Toast {
void Info(const string&in msg);
void Warning(const string&in);
void Error(const string&in);
void Success(const string&in);
}
// ECS functions
namespace ECS {
// Entity management
uint CreateEntity();
void DestroyEntity(uint entity);
bool IsValid(uint entity);
// Transform component
void AddTransform(uint entity, float x, float y, float z);
void SetPosition(uint entity, float x, float y, float z);
void GetPosition(uint entity, float &out x, float &out y, float &out z);
void SetScale(uint entity, float x, float y, float z);
void SetRotation(uint entity, float rotation);
float GetRotation(uint entity);
bool HasTransform(uint entity);
void RemoveTransform(uint entity);
// Velocity component
void AddVelocity(uint entity, float vx, float vy, float vz, float angular = 0.0f);
void SetVelocity(uint entity, float vx, float vy, float vz);
void SetAngularVelocity(uint entity, float angular);
bool HasVelocity(uint entity);
void RemoveVelocity(uint entity);
// Sprite component
void AddSprite(uint entity, int modelId, uint color, float outlineSize = 0.0f);
void SetSpriteColor(uint entity, uint color);
void SetSpriteModel(uint entity, int modelId);
void SetSpriteOutline(uint entity, float outlineSize);
bool HasSprite(uint entity);
void RemoveSprite(uint entity);
// Tag component
void AddTag(uint entity, const string &in name);
string GetTag(uint entity);
void SetTag(uint entity, const string &in name);
bool HasTag(uint entity);
void RemoveTag(uint entity);
}
namespace Texture {
class Image {
int width;
int height;
int mipmaps;
int format;
};
Image@ LoadImage(const string&in path);
void Unload(const Image@&in image);
class Texture2D {
int id;
int width;
int height;
int mipmaps;
int format;
};
Texture2D@ LoadTexture(const string&in path);
Texture2D@ LoadFromImage(const Image@&in image);
void Draw(const Texture2D@&in texture, int x, int y, int color);
void Unload(const Texture2D@&in texture);
}
namespace Math {
float Sin(float angle);
float Cos(float angle);
float Tan(float angle);
float ASin(float value);
float ACos(float value);
float ATan(float value);
float ATan2(float y, float x);
float Sqrt(float value);
float Pow(float base, float exponent);
float Log(float value);
float Log10(float value);
float Exp(float exponent);
float Floor(float value);
float Ceil(float value);
float Modf(float x, float y);
float Abs(float value);
}