// null0 - Haxe bindings for the null0 fantasy console // // Generated by tools/gen_cart_haxe.js - do not edit. // // Usage: // // ```haxe // class Main { // static function main() { // Null0.onUpdate = () -> { // Null0.clear(Null0.BLUE); // Null0.drawCircle(100, 100, 50, Null0.RED); // }; // } // } // ``` // // Notes: // - haxe try/catch is not supported (the wasm engine carts run in has no // exception handling); an uncaught throw aborts the cart. // - functions returning structs (Color/Vector/...) return host-owned // objects - use them within the current callback, don't stash them. class Null0 { /** The screen image (destination handle 0). */ public static inline var SCREEN:Image = 0; public static inline var SCREEN_WIDTH = 640; public static inline var SCREEN_HEIGHT = 480; /** The default font (handle 0). */ public static inline var FONT_DEFAULT:Font = 0; // colors public static var LIGHTGRAY(get, never):Color; static inline function get_LIGHTGRAY():Color return new Color(200, 200, 200, 255); public static var GRAY(get, never):Color; static inline function get_GRAY():Color return new Color(130, 130, 130, 255); public static var DARKGRAY(get, never):Color; static inline function get_DARKGRAY():Color return new Color(80, 80, 80, 255); public static var YELLOW(get, never):Color; static inline function get_YELLOW():Color return new Color(253, 249, 0, 255); public static var GOLD(get, never):Color; static inline function get_GOLD():Color return new Color(255, 203, 0, 255); public static var ORANGE(get, never):Color; static inline function get_ORANGE():Color return new Color(255, 161, 0, 255); public static var PINK(get, never):Color; static inline function get_PINK():Color return new Color(255, 109, 194, 255); public static var RED(get, never):Color; static inline function get_RED():Color return new Color(230, 41, 55, 255); public static var MAROON(get, never):Color; static inline function get_MAROON():Color return new Color(190, 33, 55, 255); public static var GREEN(get, never):Color; static inline function get_GREEN():Color return new Color(0, 228, 48, 255); public static var LIME(get, never):Color; static inline function get_LIME():Color return new Color(0, 158, 47, 255); public static var DARKGREEN(get, never):Color; static inline function get_DARKGREEN():Color return new Color(0, 117, 44, 255); public static var SKYBLUE(get, never):Color; static inline function get_SKYBLUE():Color return new Color(102, 191, 255, 255); public static var BLUE(get, never):Color; static inline function get_BLUE():Color return new Color(0, 121, 241, 255); public static var DARKBLUE(get, never):Color; static inline function get_DARKBLUE():Color return new Color(0, 82, 172, 255); public static var PURPLE(get, never):Color; static inline function get_PURPLE():Color return new Color(200, 122, 255, 255); public static var VIOLET(get, never):Color; static inline function get_VIOLET():Color return new Color(135, 60, 190, 255); public static var DARKPURPLE(get, never):Color; static inline function get_DARKPURPLE():Color return new Color(112, 31, 126, 255); public static var BEIGE(get, never):Color; static inline function get_BEIGE():Color return new Color(211, 176, 131, 255); public static var BROWN(get, never):Color; static inline function get_BROWN():Color return new Color(127, 106, 79, 255); public static var DARKBROWN(get, never):Color; static inline function get_DARKBROWN():Color return new Color(76, 63, 47, 255); public static var WHITE(get, never):Color; static inline function get_WHITE():Color return new Color(255, 255, 255, 255); public static var BLACK(get, never):Color; static inline function get_BLACK():Color return new Color(0, 0, 0, 255); public static var BLANK(get, never):Color; static inline function get_BLANK():Color return new Color(0, 0, 0, 0); public static var MAGENTA(get, never):Color; static inline function get_MAGENTA():Color return new Color(255, 0, 255, 255); public static var RAYWHITE(get, never):Color; static inline function get_RAYWHITE():Color return new Color(245, 245, 245, 255); public static inline var NULL0_VERSION = "0.0.18"; // callbacks - assign these in main(), eg: Null0.onUpdate = () -> { ... } @:hlNative("null0hx", "set_callback") static function _setCallback(name:String, cb:Dynamic):Void {} /** Called on load, after main(). */ public static var onLoad(null, set):Void->Void; static function set_onLoad(f:Void->Void):Void->Void { _setCallback("load", f); return f; } /** Called every frame. */ public static var onUpdate(null, set):Void->Void; static function set_onUpdate(f:Void->Void):Void->Void { _setCallback("update", f); return f; } /** Called when the cart is unloaded. */ public static var onUnload(null, set):Void->Void; static function set_onUnload(f:Void->Void):Void->Void { _setCallback("unload", f); return f; } /** Mapped controller (keys and gamepad will trigger) callback for when a "button" is unpressed. */ public static var onButtonUp(null, set):(GamepadButton, Int)->Void; static function set_onButtonUp(f:(GamepadButton, Int)->Void):(GamepadButton, Int)->Void { _setCallback("buttonUp", f); return f; } /** Mapped controller (keys and gamepad will trigger) callback for when a "button" is pressed. */ public static var onButtonDown(null, set):(GamepadButton, Int)->Void; static function set_onButtonDown(f:(GamepadButton, Int)->Void):(GamepadButton, Int)->Void { _setCallback("buttonDown", f); return f; } /** Called when keys are unpressed. */ public static var onKeyUp(null, set):(Key)->Void; static function set_onKeyUp(f:(Key)->Void):(Key)->Void { _setCallback("keyUp", f); return f; } /** Called when keys are pressed. */ public static var onKeyDown(null, set):(Key)->Void; static function set_onKeyDown(f:(Key)->Void):(Key)->Void { _setCallback("keyDown", f); return f; } /** Called when mouse-button is pressed. */ public static var onMouseDown(null, set):(MouseButton)->Void; static function set_onMouseDown(f:(MouseButton)->Void):(MouseButton)->Void { _setCallback("mouseDown", f); return f; } /** Called when mouse-button is released. */ public static var onMouseUp(null, set):(MouseButton)->Void; static function set_onMouseUp(f:(MouseButton)->Void):(MouseButton)->Void { _setCallback("mouseUp", f); return f; } /** Called when mouse is moved. */ public static var onMouseMoved(null, set):(Single, Single)->Void; static function set_onMouseMoved(f:(Single, Single)->Void):(Single, Single)->Void { _setCallback("mouseMoved", f); return f; } // COLORS /** Tint a color with another color. */ @:hlNative("null0hx", "color_tint") public static function colorTint(color:Color, tint:Color):Color { return null; } /** Fade a color. */ @:hlNative("null0hx", "color_fade") public static function colorFade(color:Color, alpha:Single):Color { return null; } /** Change the brightness of a color. */ @:hlNative("null0hx", "color_brightness") public static function colorBrightness(color:Color, factor:Single):Color { return null; } /** Invert a color. */ @:hlNative("null0hx", "color_invert") public static function colorInvert(color:Color):Color { return null; } /** Blend 2 colors together. */ @:hlNative("null0hx", "color_alpha_blend") public static function colorAlphaBlend(dst:Color, src:Color):Color { return null; } /** Change contrast of a color. */ @:hlNative("null0hx", "color_contrast") public static function colorContrast(color:Color, contrast:Single):Color { return null; } /** Interpolate colors. */ @:hlNative("null0hx", "color_bilinear_interpolate") public static function colorBilinearInterpolate(color00:Color, color01:Color, color10:Color, color11:Color, coordinateX:Single, coordinateY:Single):Color { return null; } // GRAPHICS /** Create a new blank image. */ @:hlNative("null0hx", "new_image") public static function newImage(width:Int, height:Int, color:Color):Image { return 0; } /** Copy an image to a new image. */ @:hlNative("null0hx", "image_copy") public static function imageCopy(image:Image):Image { return 0; } /** Create an image from a region of another image. */ @:hlNative("null0hx", "image_subimage") public static function imageSubimage(image:Image, x:Int, y:Int, width:Int, height:Int):Image { return 0; } /** Clear the screen. */ @:hlNative("null0hx", "clear") public static function clear(color:Color):Void { } /** Draw a single pixel on the screen. */ @:hlNative("null0hx", "draw_point") public static function drawPoint(x:Int, y:Int, color:Color):Void { } /** Draw a line on the screen. */ @:hlNative("null0hx", "draw_line") public static function drawLine(startPosX:Int, startPosY:Int, endPosX:Int, endPosY:Int, color:Color):Void { } /** Draw a filled rectangle on the screen. */ @:hlNative("null0hx", "draw_rectangle") public static function drawRectangle(posX:Int, posY:Int, width:Int, height:Int, color:Color):Void { } /** Draw a filled triangle on the screen. */ @:hlNative("null0hx", "draw_triangle") public static function drawTriangle(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, color:Color):Void { } /** Draw a filled ellipse on the screen. */ @:hlNative("null0hx", "draw_ellipse") public static function drawEllipse(centerX:Int, centerY:Int, radiusX:Int, radiusY:Int, color:Color):Void { } /** Draw a filled circle on the screen. */ @:hlNative("null0hx", "draw_circle") public static function drawCircle(centerX:Int, centerY:Int, radius:Int, color:Color):Void { } /** Draw a filled polygon on the screen. */ public static function drawPolygon(points:Array, color:Color):Void { _drawPolygon(points, color); } @:hlNative("null0hx", "draw_polygon") static function _drawPolygon(points:Array, color:Color):Void { } /** Draw a filled arc on the screen. */ @:hlNative("null0hx", "draw_arc") public static function drawArc(centerX:Int, centerY:Int, radius:Single, startAngle:Single, endAngle:Single, segments:Int, color:Color):Void { } /** Draw a filled round-rectangle on the screen. */ @:hlNative("null0hx", "draw_rectangle_rounded") public static function drawRectangleRounded(x:Int, y:Int, width:Int, height:Int, cornerRadius:Int, color:Color):Void { } /** Draw an image on the screen. */ @:hlNative("null0hx", "draw_image") public static function drawImage(src:Image, posX:Int, posY:Int):Void { } /** Draw a tinted image on the screen. */ @:hlNative("null0hx", "draw_image_tint") public static function drawImageTint(src:Image, posX:Int, posY:Int, tint:Color):Void { } /** Draw an image, rotated, on the screen. */ @:hlNative("null0hx", "draw_image_rotated") public static function drawImageRotated(src:Image, posX:Int, posY:Int, degrees:Single, offsetX:Single, offsetY:Single, filter:ImageFilter):Void { } /** Draw an image, flipped, on the screen. */ @:hlNative("null0hx", "draw_image_flipped") public static function drawImageFlipped(src:Image, posX:Int, posY:Int, flipHorizontal:Bool, flipVertical:Bool, flipDiagonal:Bool):Void { } /** Draw an image, scaled, on the screen. */ @:hlNative("null0hx", "draw_image_scaled") public static function drawImageScaled(src:Image, posX:Int, posY:Int, scaleX:Single, scaleY:Single, offsetX:Single, offsetY:Single, filter:ImageFilter):Void { } /** Draw some text on the screen. */ @:hlNative("null0hx", "draw_text") public static function drawText(font:Font, text:String, posX:Int, posY:Int, color:Color):Void { } /** Save an image to persistant storage. */ @:hlNative("null0hx", "save_image") public static function saveImage(image:Image, filename:String):Void { } /** Load an image from a file in cart. */ @:hlNative("null0hx", "load_image") public static function loadImage(filename:String):Image { return 0; } /** Resize an image, return copy. */ @:hlNative("null0hx", "image_resize") public static function imageResize(image:Image, newWidth:Int, newHeight:Int, filter:ImageFilter):Image { return 0; } /** Scale an image, return copy. */ @:hlNative("null0hx", "image_scale") public static function imageScale(image:Image, scaleX:Single, scaleY:Single, filter:ImageFilter):Image { return 0; } /** Replace a color in an image, in-place. */ @:hlNative("null0hx", "image_color_replace") public static function imageColorReplace(image:Image, color:Color, replace:Color):Void { } /** Tint a color in an image, in-place. */ @:hlNative("null0hx", "image_color_tint") public static function imageColorTint(image:Image, color:Color):Void { } /** Fade a color in an image, in-place. */ @:hlNative("null0hx", "image_color_fade") public static function imageColorFade(image:Image, alpha:Single):Void { } /** Copy a font to a new font. */ @:hlNative("null0hx", "font_copy") public static function fontCopy(font:Font):Font { return 0; } /** Scale a font, return a new font. */ @:hlNative("null0hx", "font_scale") public static function fontScale(font:Font, scaleX:Single, scaleY:Single, filter:ImageFilter):Font { return 0; } /** Load a BMF font from a file in cart. */ @:hlNative("null0hx", "load_font_bmf") public static function loadFontBmf(filename:String, characters:String):Font { return 0; } /** Load a BMF font from an image. */ @:hlNative("null0hx", "load_font_bmf_from_image") public static function loadFontBmfFromImage(image:Image, characters:String):Font { return 0; } /** Measure the size of some text. */ public static function measureText(font:Font, text:String, ?textLength:Int):Dimensions { return _measureText(font, text, textLength == null ? haxe.io.Bytes.ofString(text).length : textLength); } @:hlNative("null0hx", "measure_text") static function _measureText(font:Font, text:String, textLength:Int):Dimensions { return null; } /** Meaure an image (use 0 for screen). */ @:hlNative("null0hx", "measure_image") public static function measureImage(image:Image):Dimensions { return null; } /** Load a TTY font from a file in cart. */ @:hlNative("null0hx", "load_font_tty") public static function loadFontTty(filename:String, glyphWidth:Int, glyphHeight:Int, characters:String):Font { return 0; } /** Load a TTY font from an image. */ @:hlNative("null0hx", "load_font_tty_from_image") public static function loadFontTtyFromImage(image:Image, glyphWidth:Int, glyphHeight:Int, characters:String):Font { return 0; } /** Load a TTF font from a file in cart. */ @:hlNative("null0hx", "load_font_ttf") public static function loadFontTtf(filename:String, fontSize:Int):Font { return 0; } /** Invert the colors in an image, in-place. */ @:hlNative("null0hx", "image_color_invert") public static function imageColorInvert(image:Image):Void { } /** Calculate a rectangle representing the available alpha border in an image. */ @:hlNative("null0hx", "image_alpha_border") public static function imageAlphaBorder(image:Image, threshold:Single):Rectangle { return null; } /** Crop an image, in-place. */ @:hlNative("null0hx", "image_crop") public static function imageCrop(image:Image, x:Int, y:Int, width:Int, height:Int):Void { } /** Crop an image based on the alpha border, in-place. */ @:hlNative("null0hx", "image_alpha_crop") public static function imageAlphaCrop(image:Image, threshold:Single):Void { } /** Adjust the brightness of an image, in-place. */ @:hlNative("null0hx", "image_color_brightness") public static function imageColorBrightness(image:Image, factor:Single):Void { } /** Flip an image, in-place. */ @:hlNative("null0hx", "image_flip") public static function imageFlip(image:Image, horizontal:Bool, vertical:Bool):Void { } /** Change the contrast of an image, in-place. */ @:hlNative("null0hx", "image_color_contrast") public static function imageColorContrast(image:Image, contrast:Single):Void { } /** Use an image as an alpha-mask on another image. */ @:hlNative("null0hx", "image_alpha_mask") public static function imageAlphaMask(image:Image, alphaMask:Image, posX:Int, posY:Int):Void { } /** Create a new image, rotating another image. */ @:hlNative("null0hx", "image_rotate") public static function imageRotate(image:Image, degrees:Single, filter:ImageFilter):Image { return 0; } /** Create a new image of a gradient. */ @:hlNative("null0hx", "image_gradient") public static function imageGradient(width:Int, height:Int, topLeft:Color, topRight:Color, bottomLeft:Color, bottomRight:Color):Image { return 0; } /** Unload an image. */ @:hlNative("null0hx", "unload_image") public static function unloadImage(image:Image):Void { } /** Unload a font. */ @:hlNative("null0hx", "unload_font") public static function unloadFont(font:Font):Void { } /** Clear an image. */ @:hlNative("null0hx", "clear_image") public static function clearImage(destination:Image, color:Color):Void { } /** Draw a single pixel on an image. */ @:hlNative("null0hx", "draw_point_on_image") public static function drawPointOnImage(destination:Image, x:Int, y:Int, color:Color):Void { } /** Draw a line on an image. */ @:hlNative("null0hx", "draw_line_on_image") public static function drawLineOnImage(destination:Image, startPosX:Int, startPosY:Int, endPosX:Int, endPosY:Int, color:Color):Void { } /** Draw a filled rectangle on an image. */ @:hlNative("null0hx", "draw_rectangle_on_image") public static function drawRectangleOnImage(destination:Image, posX:Int, posY:Int, width:Int, height:Int, color:Color):Void { } /** Draw a filled triangle on an image. */ @:hlNative("null0hx", "draw_triangle_on_image") public static function drawTriangleOnImage(destination:Image, x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, color:Color):Void { } /** Draw a filled ellipse on an image. */ @:hlNative("null0hx", "draw_ellipse_on_image") public static function drawEllipseOnImage(destination:Image, centerX:Int, centerY:Int, radiusX:Int, radiusY:Int, color:Color):Void { } /** Draw a circle on an image. */ @:hlNative("null0hx", "draw_circle_on_image") public static function drawCircleOnImage(destination:Image, centerX:Int, centerY:Int, radius:Int, color:Color):Void { } /** Draw a filled polygon on an image. */ public static function drawPolygonOnImage(destination:Image, points:Array, color:Color):Void { _drawPolygonOnImage(destination, points, color); } @:hlNative("null0hx", "draw_polygon_on_image") static function _drawPolygonOnImage(destination:Image, points:Array, color:Color):Void { } /** Draw a filled round-rectangle on an image. */ @:hlNative("null0hx", "draw_rectangle_rounded_on_image") public static function drawRectangleRoundedOnImage(destination:Image, x:Int, y:Int, width:Int, height:Int, cornerRadius:Int, color:Color):Void { } /** Draw an image on an image. */ @:hlNative("null0hx", "draw_image_on_image") public static function drawImageOnImage(destination:Image, src:Image, posX:Int, posY:Int):Void { } /** Draw a tinted image on an image. */ @:hlNative("null0hx", "draw_image_tint_on_image") public static function drawImageTintOnImage(destination:Image, src:Image, posX:Int, posY:Int, tint:Color):Void { } /** Draw an image, rotated, on an image. */ @:hlNative("null0hx", "draw_image_rotated_on_image") public static function drawImageRotatedOnImage(destination:Image, src:Image, posX:Int, posY:Int, degrees:Single, offsetX:Single, offsetY:Single, filter:ImageFilter):Void { } /** Draw an image, flipped, on an image. */ @:hlNative("null0hx", "draw_image_flipped_on_image") public static function drawImageFlippedOnImage(destination:Image, src:Image, posX:Int, posY:Int, flipHorizontal:Bool, flipVertical:Bool, flipDiagonal:Bool):Void { } /** Draw an image, scaled, on an image. */ @:hlNative("null0hx", "draw_image_scaled_on_image") public static function drawImageScaledOnImage(destination:Image, src:Image, posX:Int, posY:Int, scaleX:Single, scaleY:Single, offsetX:Single, offsetY:Single, filter:ImageFilter):Void { } /** Draw some text on an image. */ @:hlNative("null0hx", "draw_text_on_image") public static function drawTextOnImage(destination:Image, font:Font, text:String, posX:Int, posY:Int, color:Color):Void { } /** Draw a outlined (with thickness) rectangle on the screen. */ @:hlNative("null0hx", "draw_rectangle_outline") public static function drawRectangleOutline(posX:Int, posY:Int, width:Int, height:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) triangle on the screen. */ @:hlNative("null0hx", "draw_triangle_outline") public static function drawTriangleOutline(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) ellipse on the screen. */ @:hlNative("null0hx", "draw_ellipse_outline") public static function drawEllipseOutline(centerX:Int, centerY:Int, radiusX:Int, radiusY:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) circle on the screen. */ @:hlNative("null0hx", "draw_circle_outline") public static function drawCircleOutline(centerX:Int, centerY:Int, radius:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) polygon on the screen. */ public static function drawPolygonOutline(points:Array, thickness:Int, color:Color):Void { _drawPolygonOutline(points, thickness, color); } @:hlNative("null0hx", "draw_polygon_outline") static function _drawPolygonOutline(points:Array, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) arc on the screen. */ @:hlNative("null0hx", "draw_arc_outline") public static function drawArcOutline(centerX:Int, centerY:Int, radius:Single, startAngle:Single, endAngle:Single, segments:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) round-rectangle on the screen. */ @:hlNative("null0hx", "draw_rectangle_rounded_outline") public static function drawRectangleRoundedOutline(x:Int, y:Int, width:Int, height:Int, cornerRadius:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) rectangle on an image. */ @:hlNative("null0hx", "draw_rectangle_outline_on_image") public static function drawRectangleOutlineOnImage(destination:Image, posX:Int, posY:Int, width:Int, height:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) triangle on an image. */ @:hlNative("null0hx", "draw_triangle_outline_on_image") public static function drawTriangleOutlineOnImage(destination:Image, x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) ellipse on an image. */ @:hlNative("null0hx", "draw_ellipse_outline_on_image") public static function drawEllipseOutlineOnImage(destination:Image, centerX:Int, centerY:Int, radiusX:Int, radiusY:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) circle on an image. */ @:hlNative("null0hx", "draw_circle_outline_on_image") public static function drawCircleOutlineOnImage(destination:Image, centerX:Int, centerY:Int, radius:Int, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) polygon on an image. */ public static function drawPolygonOutlineOnImage(destination:Image, points:Array, thickness:Int, color:Color):Void { _drawPolygonOutlineOnImage(destination, points, thickness, color); } @:hlNative("null0hx", "draw_polygon_outline_on_image") static function _drawPolygonOutlineOnImage(destination:Image, points:Array, thickness:Int, color:Color):Void { } /** Draw a outlined (with thickness) round-rectangle on an image. */ @:hlNative("null0hx", "draw_rectangle_rounded_outline_on_image") public static function drawRectangleRoundedOutlineOnImage(destination:Image, x:Int, y:Int, width:Int, height:Int, cornerRadius:Int, thickness:Int, color:Color):Void { } // GUI /** Begin a GUI window. Returns false if the window is collapsed or closed - skip its contents, but still call gui_end_window. */ @:hlNative("null0hx", "gui_begin_window") public static function guiBeginWindow(title:String, rect:Rectangle):Bool { return false; } /** End the current GUI window. */ @:hlNative("null0hx", "gui_end_window") public static function guiEndWindow():Void { } /** A button. Returns true when it is clicked. */ @:hlNative("null0hx", "gui_button") public static function guiButton(label:String):Bool { return false; } /** A static text label. */ @:hlNative("null0hx", "gui_label") public static function guiLabel(text:String):Void { } /** A block of wrapping text. */ @:hlNative("null0hx", "gui_text") public static function guiText(text:String):Void { } /** A checkbox. Returns the (possibly changed) state. */ @:hlNative("null0hx", "gui_checkbox") public static function guiCheckbox(label:String, state:Bool):Bool { return false; } /** A slider. Returns the (possibly changed) value. */ @:hlNative("null0hx", "gui_slider") public static function guiSlider(value:Single, low:Single, high:Single):Single { return 0; } /** Set the current layout row - the column widths (negative for flexible), and the row height. */ public static function guiLayoutRow(widths:Array, height:Int):Void { _guiLayoutRow(widths, height); } @:hlNative("null0hx", "gui_layout_row") static function _guiLayoutRow(widths:Array, height:Int):Void { } /** Finish building the GUI for this frame. Called automatically at the end of update if you do not call it. */ @:hlNative("null0hx", "gui_end") public static function guiEnd():Void { } /** Draw the GUI to an image (0 is the screen). */ @:hlNative("null0hx", "gui_draw") public static function guiDraw(dst:Image):Void { } // INPUT /** Has the key been pressed? (tracks unpress/read correctly.) */ @:hlNative("null0hx", "key_pressed") public static function keyPressed(key:Key):Bool { return false; } /** Is the key currently down? */ @:hlNative("null0hx", "key_down") public static function keyDown(key:Key):Bool { return false; } /** Has the key been released? (tracks press/read correctly.) */ @:hlNative("null0hx", "key_released") public static function keyReleased(key:Key):Bool { return false; } /** Is the key currently up? */ @:hlNative("null0hx", "key_up") public static function keyUp(key:Key):Bool { return false; } /** Has the button been pressed? (tracks unpress/read correctly.) */ @:hlNative("null0hx", "gamepad_button_pressed") public static function gamepadButtonPressed(gamepad:Int, button:GamepadButton):Bool { return false; } /** Is the button currently down? */ @:hlNative("null0hx", "gamepad_button_down") public static function gamepadButtonDown(gamepad:Int, button:GamepadButton):Bool { return false; } /** Has the button been released? (tracks press/read correctly.) */ @:hlNative("null0hx", "gamepad_button_released") public static function gamepadButtonReleased(gamepad:Int, button:GamepadButton):Bool { return false; } /** Get current position of mouse. */ @:hlNative("null0hx", "mouse_position") public static function mousePosition():Vector { return null; } /** Has the button been pressed? (tracks unpress/read correctly.) */ @:hlNative("null0hx", "mouse_button_pressed") public static function mouseButtonPressed(button:MouseButton):Bool { return false; } /** Is the button currently down? */ @:hlNative("null0hx", "mouse_button_down") public static function mouseButtonDown(button:MouseButton):Bool { return false; } /** Has the button been released? (tracks press/read correctly.) */ @:hlNative("null0hx", "mouse_button_released") public static function mouseButtonReleased(button:MouseButton):Bool { return false; } /** Is the button currently up? */ @:hlNative("null0hx", "mouse_button_up") public static function mouseButtonUp(button:MouseButton):Bool { return false; } // SOUND /** Load a sound from a file in cart. */ @:hlNative("null0hx", "load_sound") public static function loadSound(filename:String):Sound { return 0; } /** Play a sound. */ @:hlNative("null0hx", "play_sound") public static function playSound(sound:Sound, loop:Bool):Void { } /** Stop a sound. */ @:hlNative("null0hx", "stop_sound") public static function stopSound(sound:Sound):Void { } /** Unload a sound. */ @:hlNative("null0hx", "unload_sound") public static function unloadSound(sound:Sound):Void { } /** Speak some text and return a sound. Set things to 0 for defaults. */ @:hlNative("null0hx", "tts_sound") public static function ttsSound(text:String, phonetic:Bool, pitch:Int, speed:Int, throat:Int, mouth:Int, sing:Bool):Sound { return 0; } /** Create Sfx sound. */ @:hlNative("null0hx", "sfx_sound") public static function sfxSound(params:SfxParams):Sound { return 0; } /** Create Sfx parameters. */ @:hlNative("null0hx", "sfx_generate") public static function sfxGenerate(type:SfxPresetType):SfxParams { return null; } // TILE /** Load a tilemap (a Tiled map, exported as JSON) from a file in cart. */ @:hlNative("null0hx", "load_tilemap") public static function loadTilemap(filename:String):Tilemap { return 0; } /** Unload a tilemap. */ @:hlNative("null0hx", "unload_tilemap") public static function unloadTilemap(tilemap:Tilemap):Void { } /** Update a tilemap's animation timers (deltaTime is in seconds). */ @:hlNative("null0hx", "tile_update") public static function tileUpdate(tilemap:Tilemap, deltaTime:Single):Void { } /** Get the size of a tilemap, in tiles. */ @:hlNative("null0hx", "tile_map_size") public static function tileMapSize(tilemap:Tilemap):Dimensions { return null; } /** Get the size of a single tile of a tilemap, in pixels. */ @:hlNative("null0hx", "tile_tile_size") public static function tileTileSize(tilemap:Tilemap):Dimensions { return null; } /** Get a custom property of a tilemap, by name (PROP_NONE when there is no such property.) */ @:hlNative("null0hx", "tile_map_prop") public static function tileMapProp(tilemap:Tilemap, name:String):TilemapProp { return null; } /** Get the number of custom properties on a tilemap. */ @:hlNative("null0hx", "tile_map_prop_count") public static function tileMapPropCount(tilemap:Tilemap):Int { return 0; } /** Get a custom property of a tilemap, by index (PROP_NONE when out of range.) */ @:hlNative("null0hx", "tile_map_prop_at") public static function tileMapPropAt(tilemap:Tilemap, index:Int):TilemapProp { return null; } /** Draw a tilemap on the screen. */ @:hlNative("null0hx", "tile_draw") public static function tileDraw(tilemap:Tilemap, posX:Int, posY:Int):Void { } /** Draw a tilemap on the screen, tinted by a color. */ @:hlNative("null0hx", "tile_draw_tint") public static function tileDrawTint(tilemap:Tilemap, posX:Int, posY:Int, tint:Color):Void { } /** Draw a tilemap on an image. */ @:hlNative("null0hx", "tile_draw_on_image") public static function tileDrawOnImage(dst:Image, tilemap:Tilemap, posX:Int, posY:Int):Void { } /** Render a whole tilemap to a new image. */ @:hlNative("null0hx", "tilemap_image") public static function tilemapImage(tilemap:Tilemap):Image { return 0; } /** Get the number of layers in a tilemap. Layers are numbered depth-first, so the children of a group layer have their own indexes too. */ @:hlNative("null0hx", "tile_layer_count") public static function tileLayerCount(tilemap:Tilemap):Int { return 0; } /** Get the index of a layer of a tilemap, by name (-1 when there is no such layer.) */ @:hlNative("null0hx", "tile_layer_index") public static function tileLayerIndex(tilemap:Tilemap, name:String):Int { return 0; } /** Get the name of a layer of a tilemap. */ public static function tileLayerName(tilemap:Tilemap, layer:Int):String { return @:privateAccess String.fromUTF8(_tileLayerName(tilemap, layer)); } @:hlNative("null0hx", "tile_layer_name") static function _tileLayerName(tilemap:Tilemap, layer:Int):hl.Bytes { return null; } /** Get the kind of a layer of a tilemap. */ @:hlNative("null0hx", "tile_layer_type") public static function tileLayerType(tilemap:Tilemap, layer:Int):TileLayerKind { return 0; } /** Get the size of a layer of a tilemap, in tiles. */ @:hlNative("null0hx", "tile_layer_size") public static function tileLayerSize(tilemap:Tilemap, layer:Int):Dimensions { return null; } /** Get whether a layer of a tilemap is visible. Drawing a layer that Tiled marked hidden draws nothing. */ @:hlNative("null0hx", "tile_layer_visible") public static function tileLayerVisible(tilemap:Tilemap, layer:Int):Bool { return false; } /** Get a custom property of a layer of a tilemap, by name (PROP_NONE when there is no such property.) */ @:hlNative("null0hx", "tile_layer_prop") public static function tileLayerProp(tilemap:Tilemap, layer:Int, name:String):TilemapProp { return null; } /** Get the number of custom properties on a layer of a tilemap. */ @:hlNative("null0hx", "tile_layer_prop_count") public static function tileLayerPropCount(tilemap:Tilemap, layer:Int):Int { return 0; } /** Get a custom property of a layer of a tilemap, by index (PROP_NONE when out of range.) */ @:hlNative("null0hx", "tile_layer_prop_at") public static function tileLayerPropAt(tilemap:Tilemap, layer:Int, index:Int):TilemapProp { return null; } /** Draw a single layer of a tilemap on the screen. */ @:hlNative("null0hx", "tile_draw_layer") public static function tileDrawLayer(tilemap:Tilemap, layer:Int, posX:Int, posY:Int):Void { } /** Draw a single layer of a tilemap on the screen, tinted by a color. */ @:hlNative("null0hx", "tile_draw_layer_tint") public static function tileDrawLayerTint(tilemap:Tilemap, layer:Int, posX:Int, posY:Int, tint:Color):Void { } /** Draw a single layer of a tilemap on an image. */ @:hlNative("null0hx", "tile_draw_layer_on_image") public static function tileDrawLayerOnImage(dst:Image, tilemap:Tilemap, layer:Int, posX:Int, posY:Int):Void { } /** Render a single layer of a tilemap to a new image. */ @:hlNative("null0hx", "tile_layer_image") public static function tileLayerImage(tilemap:Tilemap, layer:Int):Image { return 0; } /** Get the gid of the tile at a column/row in a tilemap layer. */ @:hlNative("null0hx", "tile_get_tile") public static function tileGetTile(tilemap:Tilemap, layer:Int, column:Int, row:Int):Int { return 0; } /** Set the gid of the tile at a column/row in a tilemap layer. Swapping a gid is how a cart keeps changing state in the map itself. */ @:hlNative("null0hx", "tile_set_tile") public static function tileSetTile(tilemap:Tilemap, layer:Int, column:Int, row:Int, gid:Int):Void { } /** Draw a single tile from a tilemap on the screen. */ @:hlNative("null0hx", "tile_draw_tile") public static function tileDrawTile(tilemap:Tilemap, gid:Int, posX:Int, posY:Int):Void { } /** Get a copy of the image of a single tile in a tilemap. */ @:hlNative("null0hx", "tile_image") public static function tileImage(tilemap:Tilemap, gid:Int):Image { return 0; } /** Get a custom property of a tile of a tilemap, by name (PROP_NONE when there is no such property.) These come from the tileset, so every tile with this gid shares them. */ @:hlNative("null0hx", "tile_gid_prop") public static function tileGidProp(tilemap:Tilemap, gid:Int, name:String):TilemapProp { return null; } /** Get the number of custom properties on a tile of a tilemap. */ @:hlNative("null0hx", "tile_gid_prop_count") public static function tileGidPropCount(tilemap:Tilemap, gid:Int):Int { return 0; } /** Get a custom property of a tile of a tilemap, by index (PROP_NONE when out of range.) */ @:hlNative("null0hx", "tile_gid_prop_at") public static function tileGidPropAt(tilemap:Tilemap, gid:Int, index:Int):TilemapProp { return null; } /** Get the number of objects on an object-layer of a tilemap. */ @:hlNative("null0hx", "tile_object_count") public static function tileObjectCount(tilemap:Tilemap, layer:Int):Int { return 0; } /** Get an object from an object-layer of a tilemap. */ @:hlNative("null0hx", "tile_object") public static function tileObject(tilemap:Tilemap, layer:Int, index:Int):TilemapObject { return null; } /** Get the index of an object on an object-layer of a tilemap, by name (-1 when there is no such object.) */ @:hlNative("null0hx", "tile_object_index") public static function tileObjectIndex(tilemap:Tilemap, layer:Int, name:String):Int { return 0; } /** Get a custom property of an object of a tilemap, by name (PROP_NONE when there is no such property.) */ @:hlNative("null0hx", "tile_object_prop") public static function tileObjectProp(tilemap:Tilemap, layer:Int, index:Int, name:String):TilemapProp { return null; } /** Get the number of custom properties on an object of a tilemap. */ @:hlNative("null0hx", "tile_object_prop_count") public static function tileObjectPropCount(tilemap:Tilemap, layer:Int, index:Int):Int { return 0; } /** Get a custom property of an object of a tilemap, by index (PROP_NONE when out of range.) */ @:hlNative("null0hx", "tile_object_prop_at") public static function tileObjectPropAt(tilemap:Tilemap, layer:Int, index:Int, propIndex:Int):TilemapProp { return null; } // TYPES // UTILITIES /** Get system-time (ms) since unix epoch. */ @:hlNative("null0hx", "current_time") public static function currentTime():hl.I64 { return 0; } /** Get the change in time (seconds) since the last update run. */ @:hlNative("null0hx", "delta_time") public static function deltaTime():Single { return 0; } /** Get a random integer between 2 numbers. */ @:hlNative("null0hx", "random_int") public static function randomInt(min:Int, max:Int):Int { return 0; } /** Get the random-seed. */ @:hlNative("null0hx", "random_seed_get") public static function randomSeedGet():hl.I64 { return 0; } /** Set the random-seed. */ @:hlNative("null0hx", "random_seed_set") public static function randomSeedSet(seed:hl.I64):Void { } } /** Sfx parameters. */ @:struct class SfxParams { public var randSeed:Int; public var waveType:Int; public var attackTime:Single; public var sustainTime:Single; public var sustainPunch:Single; public var decayTime:Single; public var startFrequency:Single; public var minFrequency:Single; public var slide:Single; public var deltaSlide:Single; public var vibratoDepth:Single; public var vibratoSpeed:Single; public var changeAmount:Single; public var changeSpeed:Single; public var squareDuty:Single; public var dutySweep:Single; public var repeatSpeed:Single; public var phaserOffset:Single; public var phaserSweep:Single; public var lpfCutoff:Single; public var lpfCutoffSweep:Single; public var lpfResonance:Single; public var hpfCutoff:Single; public var hpfCutoffSweep:Single; public function new(randSeed:Int = 0, waveType:Int = 0, attackTime:Single = 0, sustainTime:Single = 0, sustainPunch:Single = 0, decayTime:Single = 0, startFrequency:Single = 0, minFrequency:Single = 0, slide:Single = 0, deltaSlide:Single = 0, vibratoDepth:Single = 0, vibratoSpeed:Single = 0, changeAmount:Single = 0, changeSpeed:Single = 0, squareDuty:Single = 0, dutySweep:Single = 0, repeatSpeed:Single = 0, phaserOffset:Single = 0, phaserSweep:Single = 0, lpfCutoff:Single = 0, lpfCutoffSweep:Single = 0, lpfResonance:Single = 0, hpfCutoff:Single = 0, hpfCutoffSweep:Single = 0) { this.randSeed = randSeed; this.waveType = waveType; this.attackTime = attackTime; this.sustainTime = sustainTime; this.sustainPunch = sustainPunch; this.decayTime = decayTime; this.startFrequency = startFrequency; this.minFrequency = minFrequency; this.slide = slide; this.deltaSlide = deltaSlide; this.vibratoDepth = vibratoDepth; this.vibratoSpeed = vibratoSpeed; this.changeAmount = changeAmount; this.changeSpeed = changeSpeed; this.squareDuty = squareDuty; this.dutySweep = dutySweep; this.repeatSpeed = repeatSpeed; this.phaserOffset = phaserOffset; this.phaserSweep = phaserSweep; this.lpfCutoff = lpfCutoff; this.lpfCutoffSweep = lpfCutoffSweep; this.lpfResonance = lpfResonance; this.hpfCutoff = hpfCutoff; this.hpfCutoffSweep = hpfCutoffSweep; } } /** The 2D size of something (width/height.) */ @:struct class Dimensions { public var width:Int; public var height:Int; public function new(width:Int = 0, height:Int = 0) { this.width = width; this.height = height; } } /** The 2D position of something (x/y.) */ @:struct class Vector { public var x:Int; public var y:Int; public function new(x:Int = 0, y:Int = 0) { this.x = x; this.y = y; } } /** The 2D position + size of something (x/y/w/h.) */ @:struct class Rectangle { public var x:Int; public var y:Int; public var width:Int; public var height:Int; public function new(x:Int = 0, y:Int = 0, width:Int = 0, height:Int = 0) { this.x = x; this.y = y; this.width = width; this.height = height; } } /** An RGBA color. */ @:struct class Color { public var r:hl.UI8; public var g:hl.UI8; public var b:hl.UI8; public var a:hl.UI8; public function new(r:hl.UI8 = 0, g:hl.UI8 = 0, b:hl.UI8 = 0, a:hl.UI8 = 255) { this.r = r; this.g = g; this.b = b; this.a = a; } } /** A custom property on a tilemap, layer, object, or tile. Only the member named by `type` is meaningful - a PROP_BOOL is 0/1 in `integer`, and a PROP_COLOR is RGBA bytes in `integer`. */ @:struct class TilemapProp { public var name:hl.Bytes; public var type:TilePropType; public var integer:Int; public var number:Single; public var text:hl.Bytes; public function new(name:hl.Bytes = null, type:TilePropType = 0, integer:Int = 0, number:Single = 0, text:hl.Bytes = null) { this.name = name; this.type = type; this.integer = integer; this.number = number; this.text = text; } } /** An object from an object-layer of a tilemap. This is the map's initial state - carts own whatever they spawn from it. */ @:struct class TilemapObject { public var id:Int; public var name:hl.Bytes; public var type:hl.Bytes; public var gid:Int; public var x:Single; public var y:Single; public var width:Single; public var height:Single; public var rotation:Single; public var visible:Int; public function new(id:Int = 0, name:hl.Bytes = null, type:hl.Bytes = null, gid:Int = 0, x:Single = 0, y:Single = 0, width:Single = 0, height:Single = 0, rotation:Single = 0, visible:Int = 0) { this.id = id; this.name = name; this.type = type; this.gid = gid; this.x = x; this.y = y; this.width = width; this.height = height; this.rotation = rotation; this.visible = visible; } } /** Potential image-filtering techniques for scale/etc. */ enum abstract ImageFilter(Int) from Int to Int { var FILTER_NEARESTNEIGHBOR = 0; var FILTER_BILINEAR = 1; var FILTER_SMOOTH = 2; } /** Represents a Sfx preset type. */ enum abstract SfxPresetType(Int) from Int to Int { var SFX_COIN = 0; var SFX_LASER = 1; var SFX_EXPLOSION = 2; var SFX_POWERUP = 3; var SFX_HURT = 4; var SFX_JUMP = 5; var SFX_SELECT = 6; var SFX_SYNTH = 7; } /** Represents a keyboard key. */ enum abstract Key(Int) from Int to Int { var KEY_INVALID = 0; var KEY_SPACE = 32; var KEY_APOSTROPHE = 39; var KEY_COMMA = 44; var KEY_MINUS = 45; var KEY_PERIOD = 46; var KEY_SLASH = 47; var KEY_0 = 48; var KEY_1 = 49; var KEY_2 = 50; var KEY_3 = 51; var KEY_4 = 52; var KEY_5 = 53; var KEY_6 = 54; var KEY_7 = 55; var KEY_8 = 56; var KEY_9 = 57; var KEY_SEMICOLON = 59; var KEY_EQUAL = 61; var KEY_A = 65; var KEY_B = 66; var KEY_C = 67; var KEY_D = 68; var KEY_E = 69; var KEY_F = 70; var KEY_G = 71; var KEY_H = 72; var KEY_I = 73; var KEY_J = 74; var KEY_K = 75; var KEY_L = 76; var KEY_M = 77; var KEY_N = 78; var KEY_O = 79; var KEY_P = 80; var KEY_Q = 81; var KEY_R = 82; var KEY_S = 83; var KEY_T = 84; var KEY_U = 85; var KEY_V = 86; var KEY_W = 87; var KEY_X = 88; var KEY_Y = 89; var KEY_Z = 90; var KEY_LEFT_BRACKET = 91; var KEY_BACKSLASH = 92; var KEY_RIGHT_BRACKET = 93; var KEY_GRAVE_ACCENT = 96; var KEY_WORLD_1 = 161; var KEY_WORLD_2 = 162; var KEY_ESCAPE = 256; var KEY_ENTER = 257; var KEY_TAB = 258; var KEY_BACKSPACE = 259; var KEY_INSERT = 260; var KEY_DELETE = 261; var KEY_RIGHT = 262; var KEY_LEFT = 263; var KEY_DOWN = 264; var KEY_UP = 265; var KEY_PAGE_UP = 266; var KEY_PAGE_DOWN = 267; var KEY_HOME = 268; var KEY_END = 269; var KEY_CAPS_LOCK = 280; var KEY_SCROLL_LOCK = 281; var KEY_NUM_LOCK = 282; var KEY_PRINT_SCREEN = 283; var KEY_PAUSE = 284; var KEY_F1 = 290; var KEY_F2 = 291; var KEY_F3 = 292; var KEY_F4 = 293; var KEY_F5 = 294; var KEY_F6 = 295; var KEY_F7 = 296; var KEY_F8 = 297; var KEY_F9 = 298; var KEY_F10 = 299; var KEY_F11 = 300; var KEY_F12 = 301; var KEY_F13 = 302; var KEY_F14 = 303; var KEY_F15 = 304; var KEY_F16 = 305; var KEY_F17 = 306; var KEY_F18 = 307; var KEY_F19 = 308; var KEY_F20 = 309; var KEY_F21 = 310; var KEY_F22 = 311; var KEY_F23 = 312; var KEY_F24 = 313; var KEY_F25 = 314; var KEY_KP_0 = 320; var KEY_KP_1 = 321; var KEY_KP_2 = 322; var KEY_KP_3 = 323; var KEY_KP_4 = 324; var KEY_KP_5 = 325; var KEY_KP_6 = 326; var KEY_KP_7 = 327; var KEY_KP_8 = 328; var KEY_KP_9 = 329; var KEY_KP_DECIMAL = 330; var KEY_KP_DIVIDE = 331; var KEY_KP_MULTIPLY = 332; var KEY_KP_SUBTRACT = 333; var KEY_KP_ADD = 334; var KEY_KP_ENTER = 335; var KEY_KP_EQUAL = 336; var KEY_LEFT_SHIFT = 340; var KEY_LEFT_CONTROL = 341; var KEY_LEFT_ALT = 342; var KEY_LEFT_SUPER = 343; var KEY_RIGHT_SHIFT = 344; var KEY_RIGHT_CONTROL = 345; var KEY_RIGHT_ALT = 346; var KEY_RIGHT_SUPER = 347; var KEY_MENU = 348; } /** Represents a gamepad button. */ enum abstract GamepadButton(Int) from Int to Int { var GAMEPAD_BUTTON_UNKNOWN = 0; var GAMEPAD_BUTTON_UP = 1; var GAMEPAD_BUTTON_RIGHT = 2; var GAMEPAD_BUTTON_DOWN = 3; var GAMEPAD_BUTTON_LEFT = 4; var GAMEPAD_BUTTON_Y = 5; var GAMEPAD_BUTTON_B = 6; var GAMEPAD_BUTTON_A = 7; var GAMEPAD_BUTTON_X = 8; var GAMEPAD_BUTTON_LEFT_SHOULDER = 9; var GAMEPAD_BUTTON_LEFT_TRIGGER = 10; var GAMEPAD_BUTTON_RIGHT_SHOULDER = 11; var GAMEPAD_BUTTON_RIGHT_TRIGGER = 12; var GAMEPAD_BUTTON_SELECT = 13; var GAMEPAD_BUTTON_MENU = 14; var GAMEPAD_BUTTON_START = 15; var GAMEPAD_BUTTON_LEFT_THUMB = 16; var GAMEPAD_BUTTON_RIGHT_THUMB = 17; } /** Represents a mouse button. */ enum abstract MouseButton(Int) from Int to Int { var MOUSE_BUTTON_UNKNOWN = 0; var MOUSE_BUTTON_LEFT = 1; var MOUSE_BUTTON_RIGHT = 2; var MOUSE_BUTTON_MIDDLE = 3; } /** The kind of a layer in a tilemap. */ enum abstract TileLayerKind(Int) from Int to Int { var LAYER_NONE = 0; var LAYER_TILE = 1; var LAYER_OBJECT = 2; var LAYER_IMAGE = 3; var LAYER_GROUP = 4; } /** The type of a tilemap property's value. Tiled's "file" properties arrive as PROP_STRING. */ enum abstract TilePropType(Int) from Int to Int { var PROP_NONE = 0; var PROP_INT = 1; var PROP_BOOL = 2; var PROP_FLOAT = 3; var PROP_STRING = 4; var PROP_COLOR = 5; } /** An image. 0 is "the screen". */ enum abstract Image(Int) from Int to Int {} /** A font. 0 is "the default font". */ enum abstract Font(Int) from Int to Int {} /** A sound. */ enum abstract Sound(Int) from Int to Int {} /** A tilemap (a Tiled map, exported as JSON). 0 is an invalid tilemap. */ enum abstract Tilemap(Int) from Int to Int {}