Hi there ๐
Iโve created Ceramic Engine, an open source cross-platform 2D framework written in Haxe.
You can also check out my Twitter, Instagram or Soundcloud!
Turn haxe classes into scriptable/interpretable/hot-reloadable code using hscript
License: MIT License
Iโve created Ceramic Engine, an open source cross-platform 2D framework written in Haxe.
You can also check out my Twitter, Instagram or Soundcloud!
jvm target not work.
Let's say we have two module TypeA
and TypeB
on two files TypeA.hx
and TypeB.hx
in a package named mypack
.
Referencing TypeA
from within TypeB.hx
should work without any additional import. Currently, we need to add import mypack.TypeA;
in TypeB.hx
to make it work in interpretable env.
add a static function in WatchedClass.hx after build hxml
@interpret public static function hello():Void{
trace("static function11");
}
when call
WatchedClass.hello();//error.
@interpret public static function hello():Void{
trace("static function11");
}
/** This is an interpretable method. It is compiled as native haxe code with the app,
but if the method is updated while the app is running, its new content will be live-reloaded
and the code will be executed with `interpret`. */
@interpret public function printSomething() {
// Just testing calling a native (non-interpreted) method
// and get its return value
var className = getClassNameFromNative();
// Then printing something (note that string interpolation works :))
trace('$className');
hello();//work.
WatchedClass.hello();//error.
trace(NativeClass.randomName());//error
} //printSomething
Hello there,
being satisfied with my test on hashlink platform with that excellent lib, I gave it a try over our production project. (which is a game).
I manage to make soemthing apparently working. At first, I didn't catch the #if interpretABLE token and used #interpret , and on haxe 4 version I had to come up with some hacks to make the __interpretWatch static actually being called. (var watch = __interpretWatch; does the trick).
https://try.haxe.org/#fc965
So now I have the file changes detected, and getting some wierd result/behaviour. And I hope you can help me finding whats is happening here .
Here the code I'm "interpreting" on my game entity :
override function postUpdate() {
super.postUpdate();
behave();
}
@interpret function behave() {
trace("Behave");
}
Let say, the game run and prints "Behave" every frame correctly.
If I'm changing that text to something like "Behave from interpreter" like so :
@interpret function behave() {
trace("Behave from interpreter");
}
I'll get in game output (which is a trace redirection) :
my.entity.Boss(lineNumber): Behave
interpret/macros/InterpretableMacro.hx:322: File changed at path myEntityFilePath.hx
hscript:9: Behave from interpreter
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
my.entity.Boss(lineNumber): Behave
...
everytime I make a change, I'm getting the desired print change, but not the frames after that, that will be the native text ..
Any idea on what is happening here?
(I do have other question after that one, which might be related, so let see if solving this one resolves the other first :) )
Interpret macro is failing to load Std type when using HL target.
That should probably not be too hard to fix, but needs to be tested.
`env.addModule("unityengine.Camera", DynamicModule.fromStatic(unityengine.Camera));`
hello,I'm try this with unityengine. and got this error.
error CS0122: 'Camera.ProjectionMatrixMode' is inaccessible due to its protection level
and cs code
` internal extern Camera.ProjectionMatrixMode projectionMatrixMode { [MethodImpl(MethodImplOptions.InternalCall)] get; }
`
When using DynamicModule.fromStatic()
on a module that contains a private class, the error Class<class.goes.Here> has no field private.class.Here
.
A real trace:
C:\HaxeToolkit\haxe\std/haxe/macro/MacroStringTools.hx:70: characters 84-89 : Class<flixel.input.mouse.FlxMouseEventManager> has no field ObjectMouseData
source/fnf/psyche/api/EnvPopulator.hx:247: characters 60-125 : ... Called from macro here
The accompanying code is:
env.addModule("flixel.input.mouse.FlxMouseEventManager", DynamicModule.fromStatic(flixel.input.mouse.FlxMouseEventManager));
You can find the private class here: https://github.com/HaxeFlixel/flixel/blob/27960e3b66c8ebad0052973831960761971168fd/flixel/input/mouse/FlxMouseEventManager.hx#L720
Unsure if this is a limitation or just a general bug, not too well-versed with macros. For now, I can fix this by just omitting modules containing private classes, but this is a band-aid fix.
Currently, when reloading a class, every method marked with @interpret
will switch to its interpretable version.
I would be better if, as long as a method hasn't changed, it sticked with the native implementation, which may be better for both performances and consistency of the code that we don't change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.