haxe

Would Haxe work for creating libraries?

微笑、不失礼 提交于 2019-12-17 16:45:17
问题 I was thinking of using Haxe for it's cross-language ability, but wasn't sure if it was the best for this task. I'm going to write a generic library that should be able to be used in the target languages and be documented(able to apply something like doxygen.). To put it another way, I'd like to write a generic library in Haxe, output c++ code(and java once it done) , and have it accessible to other programmers.(readable to more than just the C+ compiler) Is this the best choice for this task

EaselJS object inspector

别来无恙 提交于 2019-12-14 04:04:10
问题 I am converting an existing code base from using Flash to using CreateJS but I am in need of a way to stop the Stage update and inspect the EaselJS GUI elements for debugging. My list of requirements for the debugger is It must be possible to stop the propagation of CreateJS ticks to the non-debug parts of the GUI so that these parts do not change during inspection. In inspection mode, it must be possible to see the hierarchy tree of the non-debug parts of the GUI. In inspection mode, when an

Haxe abstracts - Can I implicitly cast an array when using @:from?

旧街凉风 提交于 2019-12-14 03:54:30
问题 I'm attempting to treat an array of one type as an array of another (abstract) type. It works fine when I use the underlying type of the abstract. But when I attempt implicit conversion using another type (defined using @:from keyword), I get a build failure. It works if I use an explicit cast , but I'm wondering - is there any way around this / something I'm missing? In the example below, I get the build failure Array<Int> should be Array<StringAbstract> class Test { static function main() {

How to filter a map using Lambda?

人走茶凉 提交于 2019-12-13 06:05:32
问题 I have a map variable: var bitmapDepths:Map<BitmapData, Int>; What I need is to remove all keys with value of 0, I tried this: bitmapDepths= Lambda.filter(Lambda.list(bitmapDepths.keys), function(v) { return (v > 0); }); So, I used Lambda.list to iterate on bitmapDepths.keys inside Lambda, but I get this error: Void -> Iterator<flash.display.BitmapData> should be Iterable<Unknown<0>> I tried Lambda.array to iterate on bitmapDepths.keys, I got the same error, so who can handle this? to remove

Haxe Map only retrieves `null`

狂风中的少年 提交于 2019-12-13 05:50:01
问题 I'm having trouble using Maps in Haxe. I'm trying to create a grid of Tile objects and add them to the Map using their index on the grid as a key. However, when I try to retrieve a Tile from the map using an index I always get a value of null . Could someone explain why this is happening? I've never used a map before and I don't understand what the issue is. I'm currently using a multidimensional array to get the same functionality, but maps seem more convenient. private function initTiles()

In Haxe hxml file, how to target main class not in the root package

大兔子大兔子 提交于 2019-12-13 02:58:46
问题 I'm trying to compile a project where the main entry point isn't in the root package (which virtually all examples use, e.g. -main Main ), but I keep getting this error message: Error: Invalid commandline class : rtp.qt.QTPrinter should be QTPrinter Here are the various syntaxes that should work: -cp src -main rtp.qt.QTPrinter Or: -cp src -main rtp/qt/QTPrinter.hx 回答1: It turns out, those syntaxes are both fine. I had just moved the QTPrinter.hx file from src/ to src/rtp/qt/ directory and I

Haxe Java windowing

大城市里の小女人 提交于 2019-12-13 00:41:27
问题 In the Haxe.java api at http://api.haxe.org/java/index.html, there does not appear to be any support for graphics, windowing, or user-interactive events. There used to be: http://old.haxe.org/doc/java/graphics2d (note the "old"), but we can't use these libraries anymore: import java.awt.Graphics; // Compile time error: Class not found : java.awt.Graphics. import java.awt.*; // this works, but so does import java.nonExistantPackage.*; Does Haxe still have java graphics support? If so, how can

Access external JavaScript libraries using Haxe

谁说胖子不能爱 提交于 2019-12-12 18:22:59
问题 I'm trying to figure out how to access external JavaScript libraries from Haxe. Should the source file for the extern class be in the same folder as the corresponding native JavaScript file, as well as the "main" Haxe source file, or can they be defined in separate source folders? Here's the documentation that I'm referring to: https://haxe.org/manual/target-javascript-external-libraries.html Also, is there any documentation for Haxe that explains how to access external libraries in all

Interfacing with Java Functions in Haxe

邮差的信 提交于 2019-12-12 13:48:10
问题 I am trying to call an external Java function from Haxe using "extern". Haxe Code : extern class Ext { public static function test():String; } class Sample { public static function main() { trace(Ext.test()); } } Java Code : public class Ext { public static String test() { return "Hello"; } } Both Sample.hx and Ext.java files are in the same folder. When I try to execute haxe -main Sample -java Sample , I get the following error. C:\Users\ila5\Desktop\CPP>haxe -main Sample -java Sample

Haxe: add @:build metadata to all classes in project

会有一股神秘感。 提交于 2019-12-12 08:58:52
问题 Is it possible to apply my type building macro to all classes in a project without modifying their code? I'm trying to implement a debugger based on Haxe macros: basically I inject calls to my function between every expression in every function of the class. Currently I have an interface IDebuggable and only code in classes that implement that interface can be stopped at breakpoints. 回答1: You can use haxe.macro.Compiler.addGlobalMetadata() for this. This can either be done from an