I see I was my assumptions were wrong at last function ... it probably
doesn't create some root object and add it all to it because I see that it
again returns that object.. but I don't know where because I don't see what
calls it..
I imagine it two ways now... for example that there is some root object...
then you define a field at it and allocate a function to that you have in c
to that field... something like this root
alloc_field(root,val_id("myCFunc"),alloc_function(myCFunc,0,"myCFunc"));
and then I could probably call that function in neko....
if there is no root but everything gets passed only by returns then I
imagine that neko must call some function in c
that will then for example create an object and attach functions to it
and return it and then neko can call it from
that return value...
but this would mean that this first function that makes object with
binded c functions must be accessible to neko
in first place for which DECLARE_PRIM(createSomeObject, 0) is used?
but if this is the case how can I then call this in neko (remember I
have embedded the nekoVM
I am not making a dll binding..)
But if this works then I don't know how to reference to that function
... If I was making a dll binding I would use >>
var p = $loader.loadprim("[EMAIL PROTECTED]",0);
p();
>> as the example says but how do I include this , I tried
var p = $loader.loadprim("test",0); and
var p = $loader.loadprim("@test",0);
and it didn't work... If anyone knows any better he is welcome to
correct me as this is all based on imagination :)
best regards,
Janko
On 11/3/07, janko metelko <[EMAIL PROTECTED]> wrote:
>
> Thanks for your replies...
>
> I was looking into xcross code for 3 hours and some things got clearer but
> I didn't got to understand anything that could work in my example... I will
> try to figure it out tomorrow ... for example ... I do this before my main
> function
>
> The way I see it ... (I might be wrong of course)
>
> This function creates l which is like some top level object and then it
> adds it a field with hashed id "primitives" value of that is >>
>
> value neko_installer_loader( char *argv[], int argc ) {
> value l = neko_default_loader(argv,argc);
> alloc_field(l,id_primitives,init_primitives());
> alloc_field(l,val_id("loadprim"),alloc_function(loadprim,2,"loadprim"));
>
> return l;
> }
>
> >> is another object which is created higher in this function and with
> that include all primitives listed in primitives.h get allocated as fields
> of this object
>
> static value init_primitives() {
>
> value primitives = alloc_object(NULL);
> # define PRIM(module,name,nargs) alloc_field(primitives,val_id(#module
> "@" #name "$" #nargs), alloc_function( name##__##nargs(), nargs, #module "@"
> #name ))
>
> # include "primitives.h"
> return primitives;
> }
>
> and this is called even higher this basically calls DECLARE_PRIM on all
> lines of primitives.h
>
> #define PRIM(module,name,nargs) DECLARE_PRIM(name,nargs)
>
> #include "primitives.h"
> #undef PRIM
>
> But that doesn't help me yet ... for example I don't know how I should
> create that "root object"
>
> I can't call neko_default_loader(..) as my I ahve not command line args or
> what those two params are..
>
>
> I don't see when neko_installer_loader is called from...
>
> I will keep on looking at it tomorrow... if there are any simpler smaller
> examples of dynamically creating "linking"
> functions or variables from c++ to nekovm I would be glad..
>
>
> Best regards,
> Janko
>
>
>
>
> On 11/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:
> >
> > Hi Janko,
> >
> > That's fine, I know what it's like to want to build your own engine.
> > NME uses SDL as a dll, so I think it should be okay, license wise.
> > Also, NME uses the SGL extension, so transforms such as scaling,
> > rotation and alphas are also doable. If Allegro is your thing, you
> > could also consider using my nGame library, which wraps 100% of the
> > Allegro library, though I've not built a framework around it, so you'd
> > have to use it as you would use the Allegro library in C, only within
> > haXe instead.
> >
> > I'm always tinkering with game engines, and at some point, I'd like to
> > make a decent 3D engine wrapper, only I don't fancy doing that for a
> > library you'd have to pay for. Plus, it's important to me that the
> > engine is cross-platform...
> >
> > Anyway, good luck in your work, and please feel free to post any
> > questions to the lists. We're always available to answer questions.
> >
> > Regards,
> > Lee
> >
> >
> >
> >
> >
> >
> >
> >
> > Quoting janko metelko <[EMAIL PROTECTED]>:
> >
> > > Hi
> > >
> > > Maybe it's just my inflexibility but I have somewhere in the back of
> > my head
> > > (from reading various chats on indiegamer) that SDL is more low level,
> > that
> > > it doesn't support HW-accelerated scaling and rotating (at least by
> > default)
> > > and that it's GPL (Which is not a problem if you use it as dll (I
> > think they
> > > talked something like that)) .. I know for some developers who make
> > > excellent games with SDL and some with Allegro, but I started with PTK
> > back
> > > then so I also already know it well.
> > >
> > > At least for now my goal is more to make an engine that does all
> > generalized
> > > stuff in c/c++ so nekovm scripts just define the game specific code in
> > > neko...
> > >
> > > best regards,
> > > Janko
> > >
> > > On 11/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >>
> > >> Hi Janko,
> > >>
> > >> Why not take a look at my NME library? It is fully usable, and there
> > >> is a chapter devoted to it in the upcoming Pro haXe and Neko book.
> > >> It's based on SDL, so should work on Windows, Linux and Mac, though
> > >> I've only created binaries for Windows at present.
> > >>
> > >> Lee
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> Quoting janko metelko < [EMAIL PROTECTED]>:
> > >>
> > >> > Hi Lee,
> > >> >
> > >> > Yes , I imagine I have to somehow register them to let neko know
> > what to
> > >> > call ..
> > >> >
> > >> > I will look at the xcross example and tell if I find something..
> > >> >
> > >> > I have no clue yet what I will do and if I will succeed making Haxe
> > +
> > >> PTK in
> > >> > some good way... right now I am just trying to find a way to make
> > some
> > >> game
> > >> > in a higher level language and with a stability (dx on win, opengl
> > on
> > >> mac)
> > >> > that a casual games need.
> > >> >
> > >> > I was looking for hundrets of solutions for 2 weeks and tried many
> > of
> > >> > them... I decided not to work in c++ any more a year ago
> > >> > because of how complicated compilers are to set up (at least to me-
> > I am
> > >> not
> > >> > too low level person)... I made games with haxe in the meantime but
> > now
> > >> I
> > >> > will try to make something that can be sold on portals and nothing
> > >> except c,
> > >> > c++ and blitzmax, TGB that I found supports DX -pc /OGL - mac (but
> > I
> > >> didn't
> > >> > like blitzmax, and torquescript also doesn't seem like an fullround
> > >> modern
> > >> > language) on some normal level .. So I eneded up back in c trying
> > to
> > >> make
> > >> > this but I can't be sure I will succeed. If I was good enought in
> > c++
> > >> then I
> > >> > wouldn't search for these higher level languages anyway. I right
> > now
> > >> don't
> > >> > plan to do a binding but to embed nekovm into a c++ program... but
> > I
> > >> don't
> > >> > have a clear picture what is the best path so that might change.
> > >> >
> > >> > Thanks for your reply,
> > >> > Janko
> > >> >
> > >> > This is probably possible, though you'll have to force the
> > >> >> registration of the functions in your C code to the Neko VM. Take
> > a
> > >> >> look at the xcross lib in haXeLib which includes the standard
> > >> >> libraries into a single exe. This should shed some light on the
> > topic.
> > >> >>
> > >> >> When you're successful wrapping PTK, are you going to submit it to
> > the
> > >> >> community? It would be interesting to have another decent 2d
> > library
> > >> >> available for Neko.
> > >> >>
> > >> >> Regards,
> > >> >> Lee
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >> Quoting janko metelko < [EMAIL PROTECTED]>:
> > >> >>
> > >> >> > Hi,
> > >> >> >
> > >> >> > I am trying to embedd nekovm with 2d game library (PTK) to make
> > a
> > >> neko
> > >> >> > scriptable game engine. It wors but I have one question..
> > >> >> >
> > >> >> > Is this possible to do (or even normal ussual)?
> > >> >> >
> > >> >> > the engine starts and opens the screen, then it loads the neko
> > .n
> > >> file
> > >> >> with
> > >> >> > script and calls loadResources function in neko.. that function
> > >> function
> > >> >> > calls back the functions for example loadImage(" img.png"); that
> > is
> > >> >> defined
> > >> >> > back in C and which loads the images in it's array or LList.
> > >> >> >
> > >> >> > (I saw how neko calls functions in native dlls via loadprimitive
> > but
> > >> >> that is
> > >> >> > probably a different thing)
> > >> >> >
> > >> >> > thanks best regards,
> > >> >> > Janko
> > >> >> >
> > >> >>
> > >> >>
> > >> >>
> > >> >> --
> > >> >> Neko : One VM to run them all
> > >> >> (http://nekovm.org)
> > >> >>
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Neko : One VM to run them all
> > >> (http://nekovm.org)
> > >>
> > >
> >
> >
> >
> > --
> > Neko : One VM to run them all
> > (http://nekovm.org)
> >
>
>
--
Neko : One VM to run them all
(http://nekovm.org)