Skip to content

Instantly share code, notes, and snippets.

@KinoAR
Created April 18, 2021 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KinoAR/df2b8236a73d8a53fd1941a82d50f772 to your computer and use it in GitHub Desktop.
Save KinoAR/df2b8236a73d8a53fd1941a82d50f772 to your computer and use it in GitHub Desktop.
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