Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
pecheny
@pecheny
@Skudoku Haxe is multitarget language so common types should be available on the all platforms. So it depends on platform(s) you are targeting. For example if you are targeting js – there is no byte type here, only Number. It can't be helped in haxe. For targets with byte type like cpp, cs and java you can look for Int8 in the appropriate package i.e. cs.Int8 for c#.
Ties Baltissen
@Skudoku
Ahh gotcha, so for anything that I will be using byte for I should look for target specific usages that might need to handle that datatype
pecheny
@pecheny
If you don't mind memory usage you can use just Int. It would be like 32 bit but available to read/write with Bytes.
I may be wrong but i think so.
Ties Baltissen
@Skudoku
Hmm alrighty, another question. I have found some info on generics and interfaces and such, but I have a specific case which I am not sure about how to deal with that.
public interface SomethingPipe<T> where T : Something how does one go about making this in Haxe.
Peter Achberger
@Antriel
interface SomethingPipe<T:Something>
Ties Baltissen
@Skudoku
Ah thanks!
Couldnt come up with the term that is type parameter
serjek
@serjek
hey guys did anyone already implement externs for react-native-iap or something alike to handle in app purchases in haxe react? I looked through haxe-react group but found only externs for some outdated libs that were last updated 6-7 years ago. so I wonder, perhaps you have something but forgot to share it?
Juraj Kirchheim
@back2dos
these days dts2hx does a pretty fine job ;)
serjek
@serjek
ah well, saved this for last resort
Jonas Sonn Jørgensen
@JonasSonn
Hi! I'm quite new to haxe, I can't figure out how to set an enum as a method parameter type. My enum: 'SomeEnum<A,B,C>' I thought I could do: 'function methodName(i: SomeEnum)' then I tried: 'function methodName(i:SomeEnum<A,B,C>)'. In https://haxe.org/manual/types-enum-using.html they write 'getColor():Color' where the enum Color is a return type.
postite
@postite
is that what you try to do ? https://try.haxe.org/#356D1e26
Jonas Sonn Jørgensen
@JonasSonn
Almost! This is more exact https://try.haxe.org/#70D60211
postite
@postite
ok . so what is your problem now ?
Jonas Sonn Jørgensen
@JonasSonn
I get the error message: Not enough type parameters for MyEnum
postite
@postite
what are X, Y and Z ?
Rudy Ges
@kLabz
Try with static function met<X, Y, Z>(m:MyEnum<X, Y, Z>) { ... } (and fix met(A) which is not a valid value for your enum)
I'm also interested in your proper use case, as the example isn't making much sense (or doesn't provide any type safety at least)
Jonas Sonn Jørgensen
@JonasSonn
Thanks for the snip, it works. About the use case: I have a member variable that in the constructor is set to be some type. Later a method is invoked that run a switch casing on the type of enum, e.g.(X,Y or Z) and returning an enumvalue of some type. Next we call a method with this enumvalue as a parameter. But you're right, the type safety is getting weaker and I think I will constrain it using abtract types as they do here https://code.haxe.org/category/other/passing-different-types-to-a-function-parameter.html (near the end of the page).
Ties Baltissen
@Skudoku
So I have this Haxe project, a few folders with lots of classes and all. What do I need to do to compile the whole project to another language? Instead of having to call each individual file to do so?
Jonas Sonn Jørgensen
@JonasSonn
If I understand your question correctly I believe you just have to target your main module with: haxe --main Main --interp, you can add many more arguments(see https://haxe.org/manual/compiler-usage.html). It might be easier if you use hxml files https://haxe.org/manual/compiler-usage-hxml.html else take a look at the Hello World example https://haxe.org/manual/introduction-hello-world.html
Ties Baltissen
@Skudoku
Ah alright, I did folow that hello world example, I just need to setup a hxml file, since I have quite some files and need to figure out what my main module is
Jonas Sonn Jørgensen
@JonasSonn
Does anyone know if you can supply arguments to --run in a hxml file? I tried many variations of guesses but I just can't get it working. Example: --run RunTests -arg argval. Errormsg: Could not process argument RunTests -arg argval
Invalid character:
Works fine if I run it as a cmd<command>
Rudy Ges
@kLabz
Did you try --run RunTests argval?
haxe --help says:
--run <module> [args...] interpret a Haxe module with command line arguments
Jonas Sonn Jørgensen
@JonasSonn
Yeah I tried that, but thanks for the reply. Writing "--run RunTests" works fine but when I add arguments like : "--run RunTests argval" I get an error: Could not process argument RunTests argval Invalid character:
Jonas Sonn Jørgensen
@JonasSonn
It seems to complain about the character after the module name. If I put in --run RunTests!argval it will give the error: Invalid character: !
Jonas Sonn Jørgensen
@JonasSonn
Okay, I found out the syntax. For hxml you write your module and for each new line you give an argument.
--run RunTests
arg1
arg2
arg3
tjrhodes
@tjrhodes
Hi all, what's the best workflow now in haxe for smooth vectors across platforms? I had a look at Kha and it doesn't do antialiased vectors (yet). OpenFL is a possibility, but it's huge, if I wanted to share code say between a js svg canvas target and a hxcpp linux app I could render frames from what shoudl I be looking at?
Or even not cross platform, I'd be interested in a good way to draw smooth vectors in the hxcpp target full stop.
pecheny
@pecheny
I don’t think openfl is huge itself especially with -dce=full. I believe heaviest part is lime which contains a lot of static linked native libraries. If size of resulting application is the point I guess it is possible to rebuild lime without unnecessary libraries. Recent openfl version has moved towards separated js backend in replacement of lime while targeting html5. Don’t know it’s current state but it should be more compact than lime version.
tjrhodes
@tjrhodes
yes I suppose that wasn't fair, I've worked with it in the past and have been playing with it again today. I've run into some issues with it though in terms of smooth motion using the graphics api. even with StageQuality.BEST and a high fps it gives some jittery results that I think are to do with it rounding float x and y to ints by the looks of it.
I want to try this https://github.com/RobDangerous/nanovg with kha now just looking at how to do it
tjrhodes
@tjrhodes
I'm not against OpenFL per se though
Hugh Sanderson
@hughsando
Nme has hardware (triangulated) vectors graphics. It has AA on lines, but not solids - you can use multi-sampling AA to get some smoothing on solids, draw a line border or use alpha textures to cover most bases, or you can use software rendering (cacheAsBitmap) for good quality AA on everything. Depends on what exactly you are going for, and how interactive you want it.
pecheny
@pecheny
@tjrhodes If you are still talking about antialiasing, in openfl it handles like <window antialiasing="4"/> in project.xml .
tjrhodes
@tjrhodes
ok thanks hugh and pecheny, is nme still alive and well and distinct from the lime/openfl stack then?
pecheny
@pecheny
@tjrhodes
Yep, nme is still alive, you can see it in the official repo. I think the differences are:
Openfl:
– lime with all low-level features extracted to separate project;
– pure js backend for html target instead of lime;
– there are a lot of refactorings towards OOP-like style (which pretty often introduces some bugs);
– development is slowed down recently.
NME is staying focused on core functional and keeps toolchains more up to date. (For example, lime is still stuck with NDK r15, more recent NDKs replaced gcc with clang).
Hugh is the author of NME and hxcpp.
@hughsando sorry if I missed something important, I have some dependencies on rendering pipeline refactorings in openfl in my codebase so I hadn’t have tried NME quite for a while.
Hugh Sanderson
@hughsando
Yes, that is pretty accurate. Beside architectural differences in code organization, the main difference relevant here is the vector rendering. IIRC, openfl uses Cairo for vectors, and I'm not sure how these get to the screen whereas NME has a vector engine specifically designed for hardware acceleration.
Nme is alive and well but less visible due to a smaller community. The best place to ask questions is on the haxe discord.
tjrhodes
@tjrhodes
sweet thanks again, and thanks for all the hxcpp work too :)
pecheny
@pecheny
Openfl have been using triangulated output through GL for vectors as well several years at least. The cairo included too (depends on defines), don’t sure in purpose, maybe fallback renderer when GL in inaccessible.
tjrhodes
@tjrhodes

I can confirm that you can get smooth vectors on openFL and NME now :)

using pixel hinting and changing from Actuate to TweenXCore for the animation I got rid of the jitters and exporting to linux and html5 produces identical smooth output with no jitters.

I was thinking there may have been some new stuff in the haxe world for drawing but I guess that is what Kha + nanovg will be (couldn't get that working yet though)
pecheny
@pecheny
I think we already have excessive segmentation in haxe world. Another engine is heaps but it has no vector drawing api. Modern renderers usually more GPU-oriented.
Hugh Sanderson
@hughsando
I think 2D engines are right on the border between what you could do yourself and what you should do yourself. Writing your own is not crazy, but expecting others to use it is.
tjrhodes
@tjrhodes
ha, I guess so, but something like the canvas API, svg in css, the graphics API in flash/nme/openfl is something I think most people would want to find prebaked
Axel Huizinga
@axelhuizinga
how is the recommended syntax to use this php code with haxe:
array_walk(glob('/etc/*'), 'unlink');