About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Map class and Game::ObjMemx
Author Message
Rofar Offline
Member

Post: #1
Map class and Game::ObjMemx
1. Is there an example using Map class in any of the tutorials? I didn't see one.

2. Is it possible to store different classes (all with same base class) in the Game::ObjMemx containers? Something similar to MembAbstract? I have an object type that can be different sub types and each sub type takes on different behavior. I didn't want to create different object types for them because the basic behavior is the same.
01-26-2010 04:11 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Map class and Game::ObjMemx
1. I can add it to the next EE release.

2. No,
please note that MembAbstract allows to store only one type of class at a time, in the membabstract tutorial when changing its class of stored elements, all previous elements were deleted.

If you have two similar classess,
instead of making their methods work differently by setting them as virtual,
you can just put if's, and switches inside the methods and use only 1 class.

Code:
struct OneClass
{
int type;
void method()
{
  if(type==0)
{
   code for type 0
}else
if(type==1)
{
  code for type 1
}
}
}

However you can also create a Base class for two classess

Code:
struct Base : Game::Obj
{
  shared methods
}

and then create 2 actual classess basing on the "Base"

Code:
struct Class1 : Base
{
}

struct Class2 : Base
{
}
01-26-2010 04:34 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #3
RE: Map class and Game::ObjMemx
Thanks. I wouldn't spend much time putting together a tutorial using Map, I just wanted to check before I used it. I understand the use of MembAbstract now. For my situation I have considered it best to create a class for each object type (based on a common base class).
01-27-2010 12:12 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Map class and Game::ObjMemx
It will be ready in 1-2 days, I just need to finish some shader updates first.
01-28-2010 11:32 PM
Find all posts by this user Quote this message in a reply
Post Reply