Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,44 @@
package externs;
import cpp.UInt8;
import cpp.Pointer;
@:include("./../lib/LibInclude.h")
@:sourceFile("./../lib/RGB.cpp")
@:native("RGB")
extern class RGB
{
public var r:UInt8;
public var g:UInt8;
public var b:UInt8;
public function getLuma():Int;
public function toInt():Int;
@:native("new RGB")
public static function create(r:Int, g:Int, b:Int):Pointer<RGB>;
@:native("~RGB")
public function deleteMe():Void;
}
// By extending RGB we keep the same API as far as haxe is concerned, but store the data (not pointer)
// The native Reference class knows how to take the reference to the structure
@:native("cpp.Reference<RGB>")
extern class RGBRef extends RGB
{
}
// By extending RGBRef, we can keep the same api,
// rather than a pointer
@:native("cpp.Struct<RGB>")
extern class RGBStruct extends RGBRef
{
}

View File

@ -0,0 +1,38 @@
package externs;
import externs.RectangleApi;
@:include("./RectangleDef.h")
@:structAccess
@:native("Rectangle")
extern class Rectangle
{
@:native("Rectangle::instanceCount")
static var instanceCount:Int;
public var x:Int;
public var y:Int;
public var width:Int;
public var height:Int;
public function area() : Int;
@:native("new Rectangle")
@:overload( function():cpp.Star<Rectangle>{} )
@:overload( function(x:Int):cpp.Star<Rectangle>{} )
@:overload( function(x:Int, y:Int):cpp.Star<Rectangle>{} )
@:overload( function(x:Int, y:Int, width:Int):cpp.Star<Rectangle>{} )
static function create(x:Int, y:Int, width:Int, height:Int):cpp.Star<Rectangle>;
@:native("Rectangle")
@:overload( function():Rectangle {} )
@:overload( function(x:Int):Rectangle {} )
@:overload( function(x:Int, y:Int):Rectangle {} )
@:overload( function(x:Int, y:Int, width:Int):Rectangle {} )
static function make(x:Int, y:Int, width:Int, height:Int):Rectangle;
@:native("~Rectangle")
public function delete():Void;
}
typedef RectanglePtr = cpp.Star<Rectangle>;

View File

@ -0,0 +1,9 @@
package externs;
// This class acts as a container for the Rectangle implementation, which will get included
// in the cpp file, and therfore get compiled and linked with the correct flags
@:cppInclude("./RectangleImpl.cpp")
@:keep
class RectangleApi
{
}

View File

@ -0,0 +1,26 @@
#ifndef RECTANGLE_DEF_INCLUDED
#define RECTANGLE_DEF_INCLUDED
struct Rectangle
{
static int instanceCount;
int x;
int y;
int width;
int height;
inline Rectangle(int inX=0, int inY=0, int inW=0, int inH=0) :
x(inX), y(inY), width(inW), height(inH)
{
instanceCount++;
}
inline ~Rectangle()
{
instanceCount--;
}
int area();
};
#endif

View File

@ -0,0 +1,8 @@
#include "RectangleDef.h"
int Rectangle::instanceCount = 0;
int Rectangle::area()
{
return width*height;
}

View File

@ -0,0 +1,4 @@
package externs;
@:native("short *") @:unreflective
extern class ShortPtr { }