SQClassDef<NewTestObj>("NewTestObj"). // If a special constructor+destructor are not needed, the auto-generated versions can be used.
// Example methods for custom constructors:
globalFuncVarArgs(constructNewTestObj,"constructor","*"). // Using a global constructor: useful in cases where a custom constructor/destructor are required and the original class is not to be modified.
// staticFuncVarArgs(NewTestObj::construct,"constructor"). // Using a static member constructor.
globalFunc(globalFunc,"globalFunc"). // Any global function can be registered in a class namespace (no 'this' pointer will be passed to the function, though the Squirrel class instance can be passed if desired (allowing access to the Cpp 'this' pointer)).
globalFunc(globalClass,GlobalClass::func,"globalClassFunc").
func(NewTestObj::newtestR1,"newtestR1").
var(&NewTestObj::val,"val").
var(&NewTestObj::s1,"s1").
var(&NewTestObj::s2,"s2").
constant(&NewTestObj::c1,"c1").
constant(&NewTestObj::c2,"c2").
funcVarArgs(NewTestObj::multiArgs,"multiArgs");
// No other code is required to setup/bind the class to script.
Added class inheritance support to SqPlus (Squirrel)
http://www.squirrel-lang.org/forums/233/ShowPost.aspx
Cpp classes can inherit from each other and Squirrel defined classes, and Squirrel defined classes can inherit from Cpp classes. See testSqPlus2.cpp for examples. The slight-increase in complexity for inheritance support can be compiled out by changing a compile time flag (when inheritance is not needed).
Additionally, while constructors and destructors are automatically created and called, it is also possible to use custom constructors+destructors defined globally to allow custom constructor arguments to be used (without modifying the original class/struct).
Latest version: http://www.brightland.com/sq/SQUIRREL2_0_5_sqplus.zip
[Edited by - John Schultz on September 25, 2005 7:08:34 PM]
Wow, thats great news! I was just looking at SqPlus for a project I'm in the design phase of. I saw your previous post about not having support for inheritence, and thought to myself "dang, if only he'd stick that in" ;)
Guess that made up my mind, will definately be using this! Thanks for the good work!
Guess that made up my mind, will definately be using this! Thanks for the good work!
Quote:Original post by Rhalin
Wow, thats great news! I was just looking at SqPlus for a project I'm in the design phase of. I saw your previous post about not having support for inheritence, and thought to myself "dang, if only he'd stick that in" ;)
Guess that made up my mind, will definately be using this! Thanks for the good work!
You're welcome. I just checked out Alberto's new Eclipse-based debugger for Squirrel: impressive. It's also a syntax-highlighted development environment for Squirrel.
I have integrated the changes from Squirrel 2.0.4_w2 to 2.0.5 (stable) for SqPlus:
http://www.brightland.com/sq/SQUIRREL2_0_5_sqplus.zip
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement