ColorSwatch help!



  • can anyone help me get a handle on using this ui widget, I cant find any examples and I am having no luck getting anything. I try adapting simple examples and it seems that not only does it not work, but it seems to break anything else, such as a BG sprite or the mouse cursor...

    heres a example I tried

    package;
    
    import flixel.FlxG;
    import flixel.FlxSprite;
    import flixel.FlxState;
    import flixel.addons.ui.FlxUIColorSwatchSelecter;
    import flixel.addons.ui.FlxUISprite;
    import flixel.addons.ui.FlxUIState;
    import flixel.text.FlxText;
    import flixel.ui.FlxButton;
    import flixel.math.FlxMath;
    
    class PlayState extends FlxUIState
    {
    	private var _pick:FlxUIColorSwatchSelecter;
    	private var _colors:Array<Int> = [ 0xFFFFFF, 0x00000 ];
    
    	override public function create():Void
    	{
    		super.create();
    		var back = new FlxUISprite(0, 0, "assets/gfx/ui/title_back.png");
    		add(back);
    		_pick = new FlxUIColorSwatchSelecter(20,20, _colors);
    		add(_pick);
    		add(new FlxText(0, 0, 0, "Hello World!"));
    
    
    	}
    
    	override public function update(elapsed:Float):Void
    	{
    		super.update(elapsed);
    	}
    }
    

    and if the issue is the function arguments than I have also tried different things with that and still no luck. A simple example please??



  • Still stuck, is this a bug? I don't see why my new example wont work, and it seems to make the mouse and hello world text disappear, but only if new colorswatch is called...

    package;
    
    import flixel.FlxG;
    import flixel.FlxSprite;
    import flixel.FlxState;
    import flixel.addons.ui.FlxUIColorSwatch;
    import flixel.addons.ui.FlxUISprite;
    import flixel.addons.ui.FlxUIState;
    import flixel.text.FlxText;
    import flixel.ui.FlxButton;
    import flixel.math.FlxMath;
    
    class PlayState extends FlxUIState
    {
    	public var picker:FlxUIColorSwatch;
    
    	override public function create():Void
    	{
    		super.create();
    		add(back);
    		picker = new FlxUIColorSwatch(20,20,0xFFFFFF);
    		add(picker);
    		add(new FlxText(0, 0, 0, "Hello World!"));
    
    
    	}
    
    	override public function update(elapsed:Float):Void
    	{
    		super.update(elapsed);
    	}
    }
    ```

Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.