Hi Nicolas,

I looked at the neko.net.Socket and various other modules. But isn't the
situation there reverse from what I need?

I am really sorry if I am wrong. The way I understand these are libraries...
The code wraps haxe functions around native functions that it loads with
neko.Lib.load() .

But I am not loading any native libraries. I embeded nekoVm into a c++ game
so c++ calls neko functions that I exported in neko code and those
neko functions call back into c++ functions that got loaded with custom
loadprim.

I didn't see any mention of "export" or "prim" in any of the classes except
those that define functions for doing it.

I imagine I have to code a class in Haxe that get's compiled to neko and
exports certain functions (callbacks from c++) and uses loadPrim to register
those functions that get called in c++.. to use it the class would probably
had to be extended and callback functions shoudl get oweridden with the code
that should execute at those callbacks. for example something like .. this
is just pseudocode and guessing..

Class NekoGame
{
   public function new( )
   {
       neko.setExport(cb_quickLoad);
       neko.setExport(cb_update);
   }

   static public function cb_quickLoad() { }  //this get's owerridden in
extending class

   static public function cb_update() { }  //this get's owerridden in
extending class

    private static var loadImg = neko.vm.Loader.loadPrimitive("loadImg", 1);
    private static var drawImg = neko.vm.Loader.loadPrimitive("drawImg", 5);

}

is this something on the right track or am I completely shooting into the
wrong direction?

Thanks for any help. I will write a tutorial about it once I make it... :)

Best regards,
Janko






On Wed, Oct 8, 2008 at 11:18 AM, Nicolas Cannasse <[EMAIL PROTECTED]
> wrote:

> janko metelko a écrit :
>
>> 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?
>>
>
> You can have a look at existing implementations, for instance
> neko.net.Socket or other haXe classes.
>
> Nicolsa
>
> --
> Neko : One VM to run them all
> (http://nekovm.org)
>
-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to