DrawText only accepts strings.
One example on how to.
#include <sstream>
void draw_float( Context* c, int x, int y, float val )
{
std::ostringstream s;
s << val;
c->DrawText( s.str(), x, y );
}
Yes. That's another way to achieve same effect.
However, a singleton gives you control over when the class is instantiated. A static class is less controllable and is instantiated before main is called.
The sequence in which classes is instantiated can sometimes be critical when the singleton depends on some other class or resource which is not available before main is called.
Thanks. This thread really made me worried after have spent time finally learning cpp<-->lua work together. It's okay to ADD BMax of course if it not breaks current Lua connection.
A Singleton is a class which will only have one and only one instance in your project. The Singleton can be accessed from anywhere.Here is how to make a Singleton class:
class MySingleton
{
private:
MySingleton() {} // Prevent users from making instances
public:
static MySingleton& instance() // returns the one and only instance
{
static MySingleton instance;
return instance;
}
void SayHello()
{
System:Print( "Hello");
}
};
Now you can use it anywhere in any project file like this
MySingleton::instance().SayHello();
Those tutorials are about general C++ programming aimed towards Leadwerks. I was planning of doing more of them but didn't because there was very few viewers. However if you are totally new to C++ its a good start as start assuming you know absolutely nothing. I talk quite slowly as English is not my native language.
Can self.component:CallOutput( "something" ) give a return value ?
Means that the in-function returns a value that is passed to the CallOutput return
Lua1.lua
--------------------------------------------------------------------------------
function Script:func()
local retval = self.component:CallOutput( "something" )
System:Print( retval ) -- prints "Hello" ?
end
Lua2.lua
---------------------------------------------------------------------------------
function Script:something()--in
return "Hello"
end
Where did the scripting documentation for FlowGraph go?
I can't remember how to add parameters with In/Out and was going to check that but the documentation is gone.
Okay. I can confirm that adding a 'dummy' empty script to the child solves the problem.
I really don't see why this has to be done, but accept it as a solution . But its a bit tricky when things behaves different in the editor and in run-time.
Thanks macklebee
Maybe a bug or behavior by design?
If you have a CGS object with a child object.
In the editor the child will rotate along with the parent object when the parent is rotated. That's Ok and expected behavior. However if you rotate the parent object by a script (simple Turn command) the child does not rotate, only the parent.
Tested same thing with two mesh objects (fbx) and in that case both rotates as expected when parent is rotated (both by script and in the editor)
Okay. I have now tested with high lighting quality. No change. The shadow becomes a bit more blurry but thats all.
Just for the sake of testing I turn ALL setting to their highest levels and same result, so I begin to think this either an Engine limitation or a bug