Jump to content

nelsoncs

Developers
  • Posts

    35
  • Joined

  • Last visited

Everything posted by nelsoncs

  1. Juan, Thanks for the reference to your solution to obtain the camera from the editor/map in C++. this kind of pushed me in the right direction addressing my current problem. I have a design where new entities will be created after the map has been loaded, so I wanted to be able to use the World::ForEachEntity....() functions from within a given, non-Leadwerks::Object class. This turned out to be somewhat difficult to figure out but I think I have a solution. The code below is what I used as an experiment to get the entity class names printed on my console widget. 1. SomeClass.h ... (prototype) static void entityClass ( Leadwerks::Entity * entity, Leadwerks::Object* extra ); // this is the declaration for a callback function, it has to be static 2. SomeClass.cpp ... (using the callback function, maybe in the constructor, notice that the 'this' pointer for the classinstance is cast to a leadwerks object pointer and passed in as a parameter) world->ForEachEntityInAABBDo( aabb, &entityClass, (Leadwerks::Object *) this ); 3. SomeClass.cpp ... void SomeClass::entityClass(Leadwerks::Entity * entity, Leadwerks::Object* extra) { std::string str ( entity->GetClassName() ); cout << "Attack::entityClass: " << str << '\n'; ((SomeClass *) extra)->getConsole()->addText( &str ); } // Note: "ForEachEntityInAABBDo" seems to require that the // callback function be static. This creates a really big problem // if trying to get data back into a C++ class because a static function // has no idea what class instance you are interested in. So, this solution // casts the current class instance pointer (this) to a Leadwerks Object // and then casts back to the cognate Class *. Seems to work but // the assumption is that there is never a problem with pointer // Implementations at runtime. I was going take the time to confirm that the pointer thunks were ok using Valgrind, but I get so many reported memory leaks from within the engine, thus obsfucating my inspection, that I may wait till something breaks. So, now that I can access basic data for entites created in the Leadwerks editor at anytime, it is on towards making use of their Lua scripts from C++.......
  2. can someone point me to a tutorial or reference showing how to use lua scripted objects from c++? thanks
  3. Super, thanks Aggror. Looks like I need to read up on compression.
  4. I am trying to use Context::DrawImage(). When I create a .png image with a transparent alpha channel (screen shot #1) it has a transparent background. When I load this using DrawImage or when I view the auto-created texture in Leadwerks Ide, the background is solid black. Where have I gone wrong or how do I obtain a transparent .tex alpha channel? thanks
×
×
  • Create New...