hi,

I embeded Neko into some of my basic game framework. So I can write a code
like this and it works.

var x = 0;
var dir = 1;

$exports.cb_quickLoad = function() {
    var load = $loader.loadprim("loadImg", 1);
    load("img\\bg\\golf_s.jpg");
    load("img\\spr\\tank1.png");
}

$exports.cb_update = function() {
    var draw = $loader.loadprim("drawImg", 5);
    draw(800, 600, 0, 0, 0);
    draw(105, 95,  x, 500, 1);
    x = 3 * dir + x;
    if ( x < 0 ) dir = 1;
    if ( x > 700 ) dir = -1;
}

it loads two pictures and draws them on screen with one fo them moving.

But I have no idea how to write Haxe now to compile to the same thing?

I suspect I have to somehow register (static?) functions that should get
into $exports (because they are callbacks for engine) and I found
neko.vm.Module.setExport() and neko.vm.Loader.loadPrimitive() .. but I am
not sure if I have to use these directly or is this just for some low level
access and is normaly done somehow else.

Or do I have to write a Haxe class / lib that uses this low level stuff to
then present a nice Haxe interfce to the functionality.

Best regards,
Janko
-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to