Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

christmas cookies

Sign in to follow this  


looks like those mods felt like they could change my journal appearances again ;) Abuse of power, I say!

Totally just kidding... I like this Christmasy theme!

Been working on scene management tools. I'm currently struggling with how far I want to abstract things. I'm also trying to think of the best way to handle entity creation and configuration. Here's the basic entity creator that I've come up with:

shared_ptr CreateEntity(string Name, entity_type Type, string Parameters) {
switch(type) {
case ENTITY_GEOMETRY: return shared_ptr(new AXMeshInstance(Name, Parameters));
case ENTITY_LIGHT: return shared_ptr(new AXLight(Name, Parameters));
/* ... more ... */

EntityMap[Name] = out;

Parameters is a string of configuration variables. For a mesh, you could pass "name=ball;shader=effect01". It gets a little messier with a light with so many options. I don't really think I like this way (I haven't spent anytime implementing it either because of this). Though it's appealing because I wouldn't really need to serialize configurations.

So, I guess the function could just return a default object. The annoying thing about this is that it returns an AXEntity object, so you'd have to cast it to your requested type to configure it (using dynamic_cast of course).

The only way around it is doing something like this, but I typically don't like this style for some reason. perhaps it's because I have to declare the variable beforehand.

void CreateEntity(string Name, entity_type Type, shared_ptr &EntityOut);

Hmm.. gonna think of how I want all this to look a little bit more.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!