The only difference I see is the method declarations are "unsigned char Green()" instead of "ChannelType Green()". ChannelType is a typedef for unsigned char, but the compiler may be too picky.
Last shot: replace "wxColour::ChannelType" with "unsigned char" in calls to the NoParamGetterInt template.
EDIT: Another possibility (not fully compatible) is using
BindMethod(v, _SC("GetBlue"), NoParamGetterInt<int, wxColour, &wxColour::GetBlue>, _SC("wxColour::GetBlue"));
The only difference I see is the method declarations are "unsigned char Green()" instead of "ChannelType Green()". ChannelType is a typedef for unsigned char, but the compiler may be too picky.
Last shot: replace "wxColour::ChannelType" with "unsigned char" in calls to the NoParamGetterInt template.
EDIT: Another possibility (not fully compatible) is using
BindMethod(v, _SC("GetBlue"), NoParamGetterInt<int, wxColour, &wxColour::GetBlue>, _SC("wxColour::GetBlue"));
None of these 2 worked:
Z:\wxWidgets\CodeBlocks\src\sdk\scripting\bindings\sc_wxtypes.cpp:1079:19: error: no matches converting function 'NoParamGetterInt' to type 'SQFUNCTION' {aka 'int (*)(struct SQVM*)'}
1079 | BindMethod(v, _SC("Blue"), NoParamGetterInt<unsigned char, wxColour, &wxColour::Blue>, _SC("wxColour::Blue"));
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from Z:\wxWidgets\CodeBlocks\src\sdk\scripting\bindings\sc_wxtypes.cpp:17:
include/scripting/bindings/sc_utils.h:992:11: note: candidate is: 'template<class ReturnType, class ClassType, ReturnType (ClassType::* func)() const> SQInteger ScriptBindings::NoParamGetterInt(HSQUIRRELVM)'
992 | SQInteger NoParamGetterInt(HSQUIRRELVM v)
| ^~~~~~~~~~~~~~~~
and
Z:\wxWidgets\CodeBlocks\src\sdk\scripting\bindings\sc_wxtypes.cpp:1079:19: error: no matches converting function 'NoParamGetterInt' to type 'SQFUNCTION' {aka 'int (*)(struct SQVM*)'}
1079 | BindMethod(v, _SC("Blue"), NoParamGetterInt<int, wxColour, &wxColour::Blue>, _SC("wxColour::Blue"));
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from Z:\wxWidgets\CodeBlocks\src\sdk\scripting\bindings\sc_wxtypes.cpp:17:
include/scripting/bindings/sc_utils.h:992:11: note: candidate is: 'template<class ReturnType, class ClassType, ReturnType (ClassType::* func)() const> SQInteger ScriptBindings::NoParamGetterInt(HSQUIRRELVM)'
992 | SQInteger NoParamGetterInt(HSQUIRRELVM v)
| ^~~~~~~~~~~~~~~~
Regards
Xav'
Thanks for testing. The second should use GetBlue instead of Blue, they are different accessors.
EDIT:
The solution recommended by Gemini is the same but using "unsigned int"
BindMethod(v, _SC("GetAlpha"), NoParamGetterInt<unsigned int, wxColour, &wxColour::GetAlpha>, _SC("wxColour::GetAlpha"));
Hi
EDIT:
The solution recommended by Gemini is the same but using "unsigned int"
BindMethod(v, _SC("GetAlpha"), NoParamGetterInt<unsigned int, wxColour, &wxColour::GetAlpha>, _SC("wxColour::GetAlpha"));
Well : I've also submitted the problem to an AI (Claude via the Codex extension of VSCode) :-[ : it gave me a more complex solution (tested with rev 13793 and it worked) :
He told me to add 4 new functions (near other wrappers wxColour, for example, after wxColour_To_String) :
SQInteger wxColour_Blue(HSQUIRRELVM v)
{
ExtractParams1<const wxColour*> extractor(v);
if (!extractor.Process("wxColour_Blue"))
return extractor.ErrorMessage();
sq_pushinteger(v, extractor.p0->Blue());
return 1;
}
SQInteger wxColour_Green(HSQUIRRELVM v)
{
ExtractParams1<const wxColour*> extractor(v);
if (!extractor.Process("wxColour_Green"))
return extractor.ErrorMessage();
sq_pushinteger(v, extractor.p0->Green());
return 1;
}
SQInteger wxColour_Red(HSQUIRRELVM v)
{
ExtractParams1<const wxColour*> extractor(v);
if (!extractor.Process("wxColour_Red"))
return extractor.ErrorMessage();
sq_pushinteger(v, extractor.p0->Red());
return 1;
}
SQInteger wxColour_Alpha(HSQUIRRELVM v)
{
ExtractParams1<const wxColour*> extractor(v);
if (!extractor.Process("wxColour_Alpha"))
return extractor.ErrorMessage();
sq_pushinteger(v, extractor.p0->Alpha());
return 1;
}
And then, replacing the 4 "BindMethod" witch were causing the build error:
BindMethod(v, _SC("Blue"), wxColour_Blue, _SC("wxColour::Blue"));
BindMethod(v, _SC("Green"), wxColour_Green, _SC("wxColour::Green"));
BindMethod(v, _SC("Red"), wxColour_Red, _SC("wxColour::Red"));
BindMethod(v, _SC("Alpha"), wxColour_Alpha, _SC("wxColour::Alpha"));
Regards
Xav'