haxe

Passing list of arbitrary function arguments in Haxe

喜夏-厌秋 提交于 2021-02-18 22:44:29
问题 In ActionScript I can use ... in a function declaration so it accepts arbitrary arguments: function foo(... args):void { trace(args.length); } I can then call the function passing an array: foo.apply(this, argsArray); I'd like to call the function with arguments of unknown type and count. Is this possible in Haxe? 回答1: According to the Haxe documentation, you can use a Rest argument: If the final argument of a macro is of type Array<Expr> the macro accepts an arbitrary number of extra

In Haxe, can you write a generic interface where a method type parameter is constrained by the class's type parameter?

♀尐吖头ヾ 提交于 2020-05-30 03:54:29
问题 I'm having trouble writing the generic interface below. In my class, I have a function that takes an array of < any type that extends a parent class > and traces its first element. Since I'm only reading elements from the array, I'm using it as if its a covariant compound type, and therefore I'm guaranteed to have the cast statement never fail. Now I want to abstract this out even more and write a interface that defines fn using another generic type T. I want fn to be able to accept any Array

In Haxe, can you write a generic interface where a method type parameter is constrained by the class's type parameter?

♀尐吖头ヾ 提交于 2020-05-30 03:53:12
问题 I'm having trouble writing the generic interface below. In my class, I have a function that takes an array of < any type that extends a parent class > and traces its first element. Since I'm only reading elements from the array, I'm using it as if its a covariant compound type, and therefore I'm guaranteed to have the cast statement never fail. Now I want to abstract this out even more and write a interface that defines fn using another generic type T. I want fn to be able to accept any Array

Haxe - Print command line arguments

别等时光非礼了梦想. 提交于 2020-04-07 03:43:49
问题 Using the Haxe programming language, is it possible to print the command line arguments that are passed to an application? I'm trying to re-write this Java program (which simply prints the command line arguments) in Haxe. public class JavaExample{ public static void main(String[] args){ for(int i = 0; i < args.length; i++){ System.out.println(args[i]); } } } 回答1: Since targets like JS(in browser) and Flash do not have concept of command line arguments. Haxe put such "system" target things in

How can I ensure a PHP class is found when compiling Haxe?

末鹿安然 提交于 2020-03-03 08:47:09
问题 I am compiling a UFront application which worked prior to Haxe 3.4. After upgrading it started generating this error when using remoting: PHP Fatal error: Class 'haxe__Unserializer_DefaultResolver' not found…site/ufront/www/lib/haxe/Unserializer.class.php on line 554 As a temporary fix I inserted this statement at the top of that file: require '_Unserializer/DefaultResolver.class.php'; Obviously that will disappear the next time I compile. How can I ensure that PHP finds the DefaultResolver

Flashdevelop + haxe — repeated “An I/O error has occured” errors

蓝咒 提交于 2020-01-15 03:32:04
问题 I'm getting small dialog boxes that pop up saying I/O Error occurred . What causes this, and how should I fix this? Edit: what happens is that after i run my flash game, FlashDevelop will try to connect to the Flash debugger, but apparently fail and give me the above error. I have both the debug standalone player and the ActiveX debug control for Firefox. 回答1: To activate interactive debugging with haxe/Flash/FlashDevelop you have to add the fdb switch and network-sandbox. To do that open

How do I convert these Haxe source files to Python?

匆匆过客 提交于 2020-01-06 23:49:47
问题 I am trying to port the Nape physics engine (written in Haxe) to a language not supported by Haxe (Xojo). Now I don't understand Haxe but I am comfortable in Python. I'm trying to convert the mass of .hx files to python source files so I can then translate them to Xojo. I have the Nape .hx source files (from haxelib) and have installed the haxe command line tool. I have tried multiple permutations to try to convert the .hx files to Python files but am having no success. I have tried the

“import and using may not appear after a type declaration” — the haxe using magic

♀尐吖头ヾ 提交于 2020-01-06 15:29:28
问题 I am trying to add an less-than-or-equal-to method (non-intrusively) to basic types such as Int, Float or existing/library types that I cannot change. (see my other question how to write a generic compare function in Haxe (haxe3)) I read that the "using" keyword is the way to do it. What I intend to do is this: class IntOrder { static public function le(x:Int,y:Int):Bool { return x <= y; } } class FloatOrder { static public function le(x:Float,y:Float):Bool { return x <= y; } } class

Haxe: How can I make the android menu bar stay hidden

陌路散爱 提交于 2020-01-06 05:08:43
问题 Im developing an app using haxe / openfl, with the flashdevelop ide. The default setup for a new project comes with the correctly configured android manifest so that the android menu bars dont show up. However when I touch anywhere on the device they pop up. How can I prevent this from happening. Okay, so I found the the template GameActivity.java file that the system was using to generate the apps code and modified it to include: @Override public void onWindowFocusChanged(boolean hasFocus) {