Jump to content

GorzenDev

Members
  • Posts

    141
  • Joined

  • Last visited

Community Answers

  1. GorzenDev's post in Anyone give me example of using Actor in CPP was marked as the answer   
    The BaseActor class i use to derive actors from.
    Use it just like you would use a entity script.

    Attach actor to a entity.
    baseActor = new BaseActor(); entity->SetActor(baseActor);
    BaseActor.h
    #include "Leadwerks.h" using namespace Leadwerks; const enum class ActorType : char { Base, Player, NPC}; class BaseActor : public Actor { //Built-in extendable functions // //virtual void EndAnimation(const int sequence); virtual void Sleep(); //virtual void Wake(); virtual void Attach(); //virtual void Detach(); //virtual void Collision(Entity* entity, const Vec3& position, const Vec3& normal, float speed); virtual void UpdateWorld(); virtual void UpdatePhysics(); //virtual void UpdateMatrix(); virtual void PostRender(Context* context); //virtual void Draw(); //virtual void DrawEach(Camera* camera); //virtual void ReceiveSignal(const std::string& inputname, Entity* sender); public: ActorType actorType = ActorType::Base; BaseActor(); virtual ~BaseActor(); };
    BaseActor.cpp
    #include "BaseActor.h" BaseActor::BaseActor() { } BaseActor::~BaseActor() { } void BaseActor::Attach() { // //System::Print("BaseActor Attached."); } void BaseActor::Sleep() { // //System::Print("BaseActor Sleep."); } void BaseActor::UpdateWorld() { //System::Print("BaseActor UpdateWorld."); } void BaseActor::UpdatePhysics() { //System::Print("BaseActor UpdatePhysics."); } void BaseActor::PostRender(Context* context) { // }  
  2. GorzenDev's post in function which returns animation ID was marked as the answer   
    Definition Entity.h
    virtual int FindAnimationSequence(const std::string& sequence);//lua
     
    Entity::FindAnimationSequence("sequencename")
  3. GorzenDev's post in How to detect text has changed in a TextBox ? was marked as the answer   
    I'm not at my pc right now but from the top of my head I would say.
    Open textfield.lua, scroll all the way down and add a widget event call to the keychar or keydown/up method.
    You will find examples of calling an event inside any widget script.
    I will add a proper example when I get home.
  4. GorzenDev's post in setClearColor Camera? was marked as the answer   
    make sure your entity is actually a camera.
    tolua.cast(self.entity,"Camera") as gamecreator said color in code always use normalized values 0-1
    if thats a problem you can always do sometihng like
    self.entity:SetClearColor(12 / 255, 183 / 255, 242 / 255, 1.0) self.entity:SetClearColor(255 / 255, 0.0, 0.0, 1.0)  
  5. GorzenDev's post in How to create my own Project Template ? was marked as the answer   
    I have never tried this before but after seeing your question i thought id give it a try.
    It is actually quite easy, look in the Templates folder in your leadwerks installation folder.
    Create a new folder inside Templates and put some files there they will be copied into your new project when you create one.
    The content from the Templates/Common folder will be copied to all projects you create.

    I tried this and it works.

     
×
×
  • Create New...