topical media & game development

talk show tell print

lib-game-delta3d-sdk-examples-testGameActorComponents-componentgameactor.cpp / cpp



  include <componentgameactor.h>
  
  include <dtDAL/enginepropertytypes.h>
  include <dtDAL/exceptionenum.h>
  include <dtGame/basemessages.h>
  include <dtGame/messagetype.h>
  include <textlabelcomponent.h>
  
  ComponentGameActor::ComponentGameActor(dtGame::GameActorProxy &proxy)
  : dtActors::GameMeshActor(proxy)
  {
  }
  
  void ComponentGameActor::Interaction()
  {
     TextLabelComponent* tcomp;
     GetComponent(tcomp);
     tcomp->SetFlashing(!tcomp->IsFlashing());
  }
  
  // -----------------------------------
  
  
Builds the actor properties
void ComponentGameActorProxy::BuildPropertyMap() { dtActors::GameMeshActorProxy::BuildPropertyMap(); ComponentGameActor* actor = static_cast<ComponentGameActor*>(GetActor()); static const std::string GROUPNAME = "ComponentGameActor"; AddProperty(new dtDAL::IntActorProperty("Some Property", "Some Property", dtDAL::MakeFunctor(*actor, &ComponentGameActor::SetSomeProperty), dtDAL::MakeFunctorRet(*actor, &ComponentGameActor::GetSomeProperty), "", GROUPNAME)); }
Instantiates the actor
void ComponentGameActorProxy::CreateActor() { ComponentGameActor* actor = new ComponentGameActor(*this); // add component to the actor. When done now, the component's properties // are accessible in STAGE. actor->AddComponent(new TextLabelComponent()); SetActor(*actor); }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.