Questions tagged [haxe]

I'm re-learning Haxe and HaxeFlixel as I go, but I've hit a stumbling block when it comes to generics.
I have a generic super class with (among other things) a method that both takes and returns a generic argument T. In a particular subclass of that super class, I would like to override that method...

Suppose we have an object with hitbox having an arbitrary complex shape and an object with circle/polygon as a hitbox. How to detect the collisions of these two objects (not the boundary rectangles, but the actual pixels)? Both objects are opaque Sprites.

I saw some code (written for Flash) that looks like this:
var _array:Array = untyped __new__(Array, 10);
And I find it creates an Array and with a length of 10.
However, when I try something like:
var _array:Array = untyped __new__(Array, 1, 2);
It creates an Array which has two elements.
I'm confus...

I am learning how to stamp an image onto my canvas using Haxe and I have read that texSubImage2D should be the function I need to do the job.
I have read some documentation found here and thought I could implement what I was after by completing the following params:
void gl.texSubImage2D(target, lev...

I have just started to create Haxe externs (strictly typed class definitions)
based on the yuidoc output from the ember source.
Now I need help to understand how to implement the kind of mixing architecture special to Ember.
For example the Ember.Object extends the Ember.CoreObject - however I wasn'...

I'm trying to make a simple lighting engine that allows me to mix colours in Haxe - I tagged flash because the API is almost identical.
I'm currently rendering coloured circles into a BitmapData and then rendering that over the top of my game, but I'm having a lot of difficulty rendering the interse...

I'm using Nape Physics with the dev version of HaxeFlixel. I have a few FlxNameSprites moving around in my game. Nape's own handling of collision resolution is excellent, but how do I make my own code react to the collisions happening too?
I.e if player 1 and player 2 collide, Nape resolves the coll...

I have a boring mouse motion lag problem in HaxeFlixel. When FPS goes lower, mouse motion becomes more slower. I want to use system cursor in HaxeFlixel application. I tried these codes:
FlxG.mouse.setSimpleNativeCursorData('custom', BitmapData);
FlxG.mouse.registerNativeCursor('custom', MouseCursor...

How do I make it so that when a bullet from the bullet group collides with an enemy from the enemy group, only the two hitting eachother will get affected?
I tried doing (In playstate):
if (FlxG.collide(bullet, enemy)){
bullet.kill();
enemy.kill();
}
But the only thing this succeeded in doing is kil...

This is my current project.hxml:
-cp Source
-main Login
-php Export/Server
-v
What this does is take one of the classes (Login.hx) and use it as the main class for the whole PHP server.
This isn't very useful for PHP, though, as PHP does not really support the notion of a 'main' class, instead you'd...

I wanted to use macro to check if a function is returning a particular generic type, say Array, so it is fine if the function is returning Array, Array, or even generic Array.
So I tried to Context.unify it with Array. It is fine for Array or Array but it fails when the type parameter is 'generic' b...

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...

When I set up primitive Int type to the Int64 it works fine. I even can catch a constructor method in supplementary class ___Int64 that accepts two Int values -- high and low. It seems that this casting is static and even such code works perfectly:
var short:Int = 1111;
var long:Int64 = 2222;
long =...

I try to use custom annotation in hexMachina.
In one module, I register my metadata:
this._annotationProvider.registerMetaData('Url', this.urlProviderModel.getUrl)
And in a Command, executed in a Macro :
@Url('applicationConfig')
public var applicationConfigUrl:String;
The Macro is executed in co...

I'm running through Haxe Introduction and I wanted to get my source folder organized. So far I just have some inheritance examples to put in one folder.
My problem is I'm getting a type not found error that wont allow me to run my code. What am I doing wrong?
I have a folder structured like this:...

I have a problem with working with the automatic logging using @Debug metadata.
I'm receiving following error:
TypeError: Cannot read property 'debug' of null - Which after some digging into generated code indicates that the logger is null.
This is my setup:
class SomeView implements ISomeView imple...

I'd like to have a module which can be developed in isolated envorinment but still remains a module which can be plugged into anoter project.
The idea: Currently I have state machine driven modular project where every module is defined by DSL so the main project has its context and command mappings...

I'm trying to display scores from a leaderboard within the week.
Currently I query certain daily scores with the following:
public static function displayDay(day:String)
{
queryLeaderboard('SELECT * FROM gamedata WHERE ts LIKE '%-' + day + '%' ORDER by scoreDifference DESC LIMIT 10');
}
Which will d...

I've a main Haxe script in a file called Main.hx. And in this same script I can import any existent package, including other Haxe scripts in the same directory that are considered package, but Haxe scripts (which should be considered package) that are declared in nested directories doesn't work with...

I am writing haxe code which I want to compile to an arbitrary target as a module and then use the results from another module compiled for this same target. I don’t want to handle this the “Haxe way” (which is to fully inline all libraries at compiletime). Instead I want to be able to write d...

I have a kha app that runs perfecly on an iPad2 (1024/768px).
When I run the same project on a later iPad Mini with 2048/1516. My coordinates are all half the size, which kinda makes sense.
So when I double all the sizes of my objects and GFX it will work on the iPad mini, but will be too big for iP...

I tried haxe on MacOS, and setup the toolchain correctly, etc., but when i tried to compile a file, i got an error, so i tried again with an example in the tutorial (here: https://haxe.org/documentation/introduction/language-introduction.html),
and got the same error, which is:
Type not found : Hell...

I am considering Haxe for a new project because I would like the application to be multi-platform. However, I searched for and did not find the libraries I would need. Is there a relatively easy way to display and annotate MS Word and PDF files in Haxe? Would I need to transcompile to C++ and then r...

Is there a simple way to prevent $bind generation when passing around class member functions?
I have an object that takes in a function which will be called in an arbitrary interval. The object always binds itself as the 'this' binding before calling the function (this is done in the native side), t...

My build.hxml file looks like this:
-main Main
-cp src
-js bin/index.js
I use js.Browser in Main class. When I try to build it with F8, FlashDevelop gives me 'You cannot access the js package while targeting cross'. And I actually see that it tries to run:
Running process: bla-bla-bla -target 'js'
....

I installed the latest Haxe version (3.4.2) but then learned that the project I need it for requires an older version (3.1.3). Unfortunately, the installer has no uninstall option. Therefore, I manually deleted all Haxe files that the Finder search listed (including system files and hidden files).
W...

I am very new to haxe openfl, I used to develop game with flash and starling , I am confused about the conversion from flash to openfl haxe.
public class StarlingPool
{
public var items:Array;
private var counter:int;
public function StarlingPool(type:Class, len:int)
{
items = new Array();
counter...

I'm working on an online game that will communicate with the backend using gRPC protocol. There are gRPC client libraries for iOS, Android and JavaScript.
The plan is to implement the game logic and rendering using Haxe, but networking using native code with gRPC. What's the recommended approach for...

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...

I'm new to Haxe and I think I've messed something up.
If I open up a new OpenFL project in Flashdevelop and immediately compile it with windows(c++) as my target, the initial compilation takes about 31 minutes. Most of that time is spent processing the 'src/resources.cpp' file.
Subsequent compilatio...

I've built my own Yaml Parser using a couple of more advanced stuff like abstracts in haxe in order to better understand how everything works, and I've hit yet another wall.
The important part is an abstract, abstract YamlMap (StringMap), which acts as a container for my data. A 'node' can either b...

I have a very simple test put together to include SQLite3 in my Haxe build (I know it has SQLite built in, but this issue doesn't just apply here). It looks like so:
@:include('sqlite3.h')
@:buildXml('')
extern class SQLite3 {
@:native('sqlite3_open') public static function sqlite3_open(path: String...

How is it possible to access static variable of a class by knowing its name at runtime?
I store instances of classes (that I know for sure have static field 'id') in Array of Parent interfaces. I can easily get 'id' at compile time with macro, but have trouble doing so at runtime.
import Macro;
inte...

I've got this compiletime errors when I make some class implement an interface with properties that have been fromerly defined in some native sub class, like openfl.display.Sprite. It occurs when I'm targeting flash, not js.
Field get_someValue needed by SomeInterface is missing
Field set_someValue...

I'm trying to draw an object masked with a circle, but the mask applied is more like a circle's bounding rectangle
I tried using circle drawn with drawCircle method:
private function squareToRound(ability:MovieClip):MovieClip
{
var container:MovieClip = new MovieClip();
var newAbility:MovieClip = ab...