Questions tagged [haxe]

1

votes
1

answer
258

Views

Extending a Generic Class and Overriding a Method in Haxe in IntelliJ

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

votes
2

answer
56

Views

Hittest for two object shapes

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

votes
1

answer
121

Views

What's the meaning of __new__ in Haxe for Flash?

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

votes
0

answer
6

Views

Rendering image using texSubImage2D in Haxe

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...
Display name
0

votes
1

answer
92

Views

How to map ember object hierarchy to Haxe

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'...
Axel Huizinga
1

votes
1

answer
321

Views

Filling the intersection of two circles with solid colour

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...
William Osborne
1

votes
1

answer
117

Views

FlxNapeSprite and collisions

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

votes
1

answer
145

Views

How to prevent mouse motion lag in HaxeFlixel?

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...
Enes F.
1

votes
2

answer
113

Views

How do I identify specific entity within a FlxGroup from FlxG.collide?

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...
Pop Car
1

votes
1

answer
118

Views

How to break up the “main class” structure for PHP export?

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

votes
1

answer
227

Views

Unify generic types in macro

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

votes
1

answer
135

Views

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

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...
Jeff Ward
1

votes
1

answer
49

Views

Using haxe.macro.TypeTools fails

I'm trying to debug a library which uses haxe.macro.TypeTools::findField. I've created a simple code for that: package; using haxe.macro.TypeTools; class Main { public function new() { var test = findField(Child, 'hello'); trace(test); } } class Base { private function hello() { } } class Chil...
Misiur
1

votes
1

answer
44

Views

Haxe generating super call with arguments

The context is type-building macro. My goal is to generate super(arg1, arg2, arg3) What I have: Array => [{ meta => null, name => foo, type => TPath({ name => StdTypes, pack => [], params => [], sub => Int }), opt => null, value => null },{ meta => null, name => bar, type => TPath({ name => StdTypes...
Misiur
1

votes
1

answer
154

Views

Casting Int to Int64 in Haxe

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 =...
meps
1

votes
2

answer
88

Views

Use custom annotation in hexMachina

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

votes
1

answer
111

Views

Creating an organized source folder in HaxeFlixel

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:...
Funlamb
1

votes
1

answer
47

Views

@Debug metadata crashes with TypeError

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

votes
2

answer
79

Views

How to use modules in modules

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

votes
1

answer
92

Views

LIKE and BETWEEN query SQL with Haxe

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

votes
1

answer
246

Views

How to import packages in nested directories (Haxe)?

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

votes
1

answer
244

Views

How do I get haxe to generate externs?

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

votes
1

answer
185

Views

Scaling a kha-app for retina on iPad

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

votes
1

answer
92

Views

OpenFL and Haxe invalid call when running test projects

I've installed Haxe and OpenFL. I created a sample project: openfl create PiratePig cd PiratePig when I run: openfl test flash I get the following error: /usr/lib/haxe/std/haxe/macro/Context.hx:209: characters 9-30 : Invalid call /home/tomto/haxelib/openfl/4,6,0/openfl/_internal/utils/ExtraParams.hx...
RobotEyes
1

votes
1

answer
63

Views

Haxe - How do you check the hour for a day/night cycle?

How would one go about checking just a 24 hour clock on Android to change an element at a certain time daily? I can't seem to make much of Date or DateTools.
Arek
1

votes
1

answer
49

Views

Can't build Haxe source file

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

votes
2

answer
79

Views

Annotating MS Word and PDF files in Haxe?

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...
D. Vyd
1

votes
1

answer
80

Views

Haxe Javascript: Prevent '$bind' generation?

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...
Harold B.
1

votes
1

answer
195

Views

HaxeDevelop with hxml doesn't target the platform

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' ....
forkandpie
1

votes
1

answer
265

Views

Deleting Haxe (3.4.2) from macOS (Sierra)

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

votes
2

answer
133

Views

Haxe Starling Object Pooling with Dynamic Object Type

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...
Galib Imtiaz
1

votes
1

answer
231

Views

Haxe and native interop

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

votes
1

answer
51

Views

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

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

votes
1

answer
181

Views

Compiling in Flashdevelop OpenFL takes 31 minutes

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...
Joakim Andersson
1

votes
1

answer
72

Views

ArrayAccess by string on an unknown or dynamic type

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

votes
2

answer
71

Views

OpenFL animation in preloader always stutters first time

Im using the built in NMEPReloader as my base class for my preloader in openfl. What Im doing is playing an animation frame by frame class AttractAnimation extends Sprite { var currentFrame:Int; var previousFrame:Int; var bitmapFrames:Array; var loadScreenTimer:Timer; public function new() { super(...
Derek Lawrence
1

votes
2

answer
164

Views

How to include libsqlite3 in my Haxe/hxcpp build?

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

votes
1

answer
79

Views

Accessing static variable from class name runtime

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

votes
2

answer
108

Views

Haxe: Native Interface properties implementable?

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

votes
1

answer
62

Views

Circle mask acts like rectangle

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

View additional questions