Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example extern class taking from our own LunaTea development code.
package;
//Expose metatag is used to make sure that when the code is being referenced in the target language it'll be exposed
//for user's to override. I use this in JS to allow for modification, which is core to RPGMakerMV/MZ.
//Native metatag is used to make sure that when the code is compiled it uses the proper name.
//Native works both on classes and fields, which you can see for the x, y fields below.
@:expose("Point")
@:native("Point")
extern class Point extends pixi.core.math.Point {
/**
* The point class.
*
* @class Point
* @constructor
* @param {Number} x The x coordinate
* @param {Number} y The y coordinate
*/
public function new(?x: Float, ?y: Float);
/**
* The x coordinate.
*
* @property x
* @type Number
*/
@:native("x")
public var _x: Float;
/**
* The y coordinate.
*
* @property y
* @type Number
*/
@:native("y")
public var _y: Float;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment