About Store Forum Documentation Contact



Post Reply 
Wrapping EE::Game::World.setObjType()
Author Message
Kevin Offline
Member

Post: #1
Wrapping EE::Game::World.setObjType()
Hi,
As you might now I am currently creating a wrapper for the Esenthel Engine. But I have problems in wrapping the method setObjType of the EE::Game::WorldManager.
The problem is that EE::Game::Obj is an abstract class, so it can't be instantiated (it's needed that the class is non abstract for the ObjMemx container I think). Here is the code:

Code:
EsenthelNet::WorldManager^ SetObjType(System::Collections::Generic::List<EsenthelNet::Obj^>^ container, int objType) {
    //Get unmanaged container for objects
    EE::Game::ObjMemx<EE::Game::Obj> cont;
    Game::World.setObjType(cont, objType);

    //Create the managed container
    container = gcnew System::Collections::Generic::List<EsenthelNet::Obj^>();

    //Add the unmanaged objects to the managed container
    int elms = cont.elms();                                                                                    
    for(int i = 0; i < elms; i++) {        
        container->Add(gcnew EsenthelNet::Obj(&cont[i]));                                                                    
    }

    return this;
}

Perhaps the solution is simple, but I can't figure it out at the moment, so I wanted to ask you.
In the method the unmanaged EE::Game::Obj is filled into a managed .Net List of managed EsenthelNet::Obj's.
As you might have notived, I haven't wrapped the EE containers. It's because imho the .Net List is much more comfortable to use, than five different types of containers. But maybe I'll change this in future...

Any help is greatly appreciated!

best regards,
Kevin
(This post was last modified: 07-08-2010 07:51 PM by Kevin.)
07-08-2010 07:50 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Wrapping EE::Game::World.setObjType()
Hello,

The world manager requires Game::ObjMemx container usage for game objects storage.
07-08-2010 10:42 PM
Find all posts by this user Quote this message in a reply
Kevin Offline
Member

Post: #3
RE: Wrapping EE::Game::World.setObjType()
Yeah, I know, but the problem is that I can't use a Game::ObjMemx<Game::Obj> container! I want to pass this container to the setObjType method.
But if I try to do it I get:
error C2259: 'EE::Game::Obj' : cannot instantiate abstract class [...]\installation\esenthelengine\Misc\Misc.h 128 Esenthel.Net
07-09-2010 04:15 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Wrapping EE::Game::World.setObjType()
in the codes you create empty game obj container
{
EE::Game::ObjMemx<EE::Game::Obj> cont;
..

however you shouldnt create new one, but pass existing container as a _reference_

just like in EE headers:

WorldManager& setObjType (ObjMemx<Obj > &obj_memx, Int obj_type);


well I don't have any idea how c# works, so I don't fully understand your codes, and c# syntax

but in EE it works that you define container of class derived from Game::Obj

Game::ObjMemx<Game::Chr> chrs;

you pass that container into setObjType

and 'chrs' is automatically casted into Game::ObjMemx<Game::Obj> &
07-09-2010 05:02 PM
Find all posts by this user Quote this message in a reply
Post Reply