Code Snippets Haxe

Short texts Haxe 🧑‍💻 Code snippets Haxe ✍️ Reading lists Haxe 👀

Szhsin ReactMenu externs.hx

// # install with Yarn: // yarn add @szhsin/react-menu // Drop this ReactMenu.hx file into your your haxe project src folder @:jsRequire(‘@szhsin/react-menu’) extern class ReactMenu { static function useMenuState(?options:ReactMenuStateOptions):{ @:optional var state:ReactMenuState; dynamic function toggleMenu(?open:Bool):Void; dynamic function endTransition():Void; }; static final MenuButton:Dynamic; static final Menu:Dynamic; static final ControlledMenu:Dynamic; static final SubMenu:Dynamic; static final MenuItem:Dynamic; static […]

Broken Fixel test of cornerContour

package; import cornerContour.io.Float32Array; // contour code import cornerContour.Sketcher; import cornerContour.SketcherGrad; import cornerContour.Pen2D; import cornerContour.Pen2DGrad; import cornerContour.StyleSketch; import cornerContour.StyleEndLine; // SVG path parser import justPath.*; import justPath.transform.ScaleContext; import justPath.transform.ScaleTranslateContext; import justPath.transform.TranslationContext; import flixel.FlxSprite; import flixel.FlxState; import openfl.Vector; import flixel.FlxStrip; import flixel.util.FlxColor; // @credit: starry-abyss for setting up class PlayState extends FlxState { var pen2D: Pen2DGrad; var […]

SPP deal service

package ru.smartpref.modules.game; import ru.smartpref.core.service.ISyncService; import ru.smartpref.core.object.Card; import ru.smartpref.core.object.Player; class DealService implements ISyncService { public function new() {} public function newDeal(isOblique:Bool):Array { return isOblique ? obliqueDeal() :{ var cardsShuffle = shuffle(Card.CARDS); [ cardsShuffle.slice(0,10), cardsShuffle.slice(10,20), cardsShuffle.slice(20,30), cardsShuffle.slice(30) ]; }; } function obliqueDeal() { final cards:Array = shuffle(Card.CARDS); final suits:Array = shuffle(Suit.ALL); final OBLIQUE_SUIT_LENGTH = 5; var usedCards:Array […]