FlxCursor

41 views
Skip to first unread message

LuFe_Mas

unread,
Jan 6, 2016, 6:33:18 PM1/6/16
to HaxeFlixel
Hi guys, 

I really dont get how to use it. I saw the Demo. Is exactly what i want. Because i do not want the mouse arrow on my game, just keyboard.

But the demo uses FlxUIState. Actually, its not the big problem. The problem is because this way, i need a xml file. Is very simple to do.

But my game have a level select menu where the level are being unlocked only after finishing the previous one. Also on the title screen, there is a New Game button that just appears if you have a saved data already.

What I mean, is that the buttons graphics ou visible, etc, change by the code, uses logic.So I cant do that on the XML file.

There is a way to do that keyboard select effect withou the FlxUIState, or i way to put logic on xml file, like change the graphics and events.

LuFe_Mas

unread,
Jan 8, 2016, 7:05:02 PM1/8/16
to HaxeFlixel
I get it!

Using the Demo source code, if we want to change do something with the button_0:

 var buttonCaster:FlxUIButton = cast this._ui.getAsset("butt_0");
 buttonCaster
.label.text = "Changing the label!";


I didn't knew this cast operator, it's amazing.

Ashiq A.

unread,
Jan 10, 2016, 11:47:12 AM1/10/16
to haxef...@googlegroups.com
You're using an unsafe cast. According to the Haxe manual, this should be avoided: http://haxe.org/manual/expression-cast-unsafe.html

You should use a safe cast instead: http://haxe.org/manual/expression-cast-safe.html

var buttonCaster:FlxUIButton = cast (this._ui.getAsset("butt_0"), FlxUIButton)

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at https://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/b82def4d-6956-4557-8b7c-82a73543213e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Gama11

unread,
Jan 10, 2016, 12:47:32 PM1/10/16
to HaxeFlixel
That's nonsense, there's no reason to use a safe cast if you know the object is a FlxUIButton. To quote the section on safe casts of the manual:

Safe casts have a runtime overhead. [...] The intended usage is to try the safe cast and catch the String exception.

So you should really only use safe casts if you're unsure about the underlying type and intend to try-catch it. 

On Sunday, January 10, 2016 at 5:47:12 PM UTC+1, Ashiq A. wrote:
You're using an unsafe cast. According to the Haxe manual, this should be avoided: http://haxe.org/manual/expression-cast-unsafe.html

You should use a safe cast instead: http://haxe.org/manual/expression-cast-safe.html

var buttonCaster:FlxUIButton = cast (this._ui.getAsset("butt_0"), FlxUIButton)
On Fri, Jan 8, 2016 at 7:05 PM, LuFe_Mas <maschi...@gmail.com> wrote:
I get it!

Using the Demo source code, if we want to change do something with the button_0:

 var buttonCaster:FlxUIButton = cast this._ui.getAsset("butt_0");
 buttonCaster
.label.text = "Changing the label!";


I didn't knew this cast operator, it's amazing.

Em quarta-feira, 6 de janeiro de 2016 21:33:18 UTC-2, LuFe_Mas escreveu:
Hi guys, 

I really dont get how to use it. I saw the Demo. Is exactly what i want. Because i do not want the mouse arrow on my game, just keyboard.

But the demo uses FlxUIState. Actually, its not the big problem. The problem is because this way, i need a xml file. Is very simple to do.

But my game have a level select menu where the level are being unlocked only after finishing the previous one. Also on the title screen, there is a New Game button that just appears if you have a saved data already.

What I mean, is that the buttons graphics ou visible, etc, change by the code, uses logic.So I cant do that on the XML file.

There is a way to do that keyboard select effect withou the FlxUIState, or i way to put logic on xml file, like change the graphics and events.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+unsubscribe@googlegroups.com.

Ashiq A.

unread,
Jan 11, 2016, 1:07:37 AM1/11/16
to haxef...@googlegroups.com
Interesting, so that's the difference. I thought safe casts were more in line of Haxe's goal of type-safety wherever possible.

To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

Jeru Sanders

unread,
Jan 12, 2016, 2:55:42 PM1/12/16
to HaxeFlixel
Haxe, OpenFL, and HaxeFlixel all have different goals and aren't developed jointly. Haxe's goal is a unified cross compiling language, OpenFL's is Flash emulation, and HaxeFlixel's/Flixel's was always to allow for very rapid game development.

So naturally people here will suggest you do what's simplest unless it creates an obvious problem, which is important for independent games because time isn't exactly a thing we have in spades. Although you may get a different suggestion from the haxelang group.
Reply all
Reply to author
Forward
0 new messages