mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +01:00 
			
		
		
		
	Update the Color4 type to use the new dynamic dispatching system for metamethods.
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
				
			|||||||
#include "Base/Color4.hpp"
 | 
					#include "Base/Color4.hpp"
 | 
				
			||||||
#include "Base/Color3.hpp"
 | 
					#include "Base/Color3.hpp"
 | 
				
			||||||
#include "Base/Shared.hpp"
 | 
					#include "Base/Shared.hpp"
 | 
				
			||||||
 | 
					#include "Base/DynArg.hpp"
 | 
				
			||||||
#include "Library/Numeric/Random.hpp"
 | 
					#include "Library/Numeric/Random.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
@@ -779,13 +780,13 @@ void Register_Color4(HSQUIRRELVM vm)
 | 
				
			|||||||
        // Core Meta-methods
 | 
					        // Core Meta-methods
 | 
				
			||||||
        .Func(_SC("_tostring"), &Color4::ToString)
 | 
					        .Func(_SC("_tostring"), &Color4::ToString)
 | 
				
			||||||
        .SquirrelFunc(_SC("_typename"), &Color4::Typename)
 | 
					        .SquirrelFunc(_SC("_typename"), &Color4::Typename)
 | 
				
			||||||
        .Func(_SC("_cmp"), &Color4::Cmp)
 | 
					        .SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        // Meta-methods
 | 
					        // Meta-methods
 | 
				
			||||||
        .Func< Color4 (Color4::*)(const Color4 &) const >(_SC("_add"), &Color4::operator +)
 | 
					        .SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        .Func< Color4 (Color4::*)(const Color4 &) const >(_SC("_sub"), &Color4::operator -)
 | 
					        .SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        .Func< Color4 (Color4::*)(const Color4 &) const >(_SC("_mul"), &Color4::operator *)
 | 
					        .SquirrelFunc(_SC("_mul"), &SqDynArgFwd< SqDynArgMulFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        .Func< Color4 (Color4::*)(const Color4 &) const >(_SC("_div"), &Color4::operator /)
 | 
					        .SquirrelFunc(_SC("_div"), &SqDynArgFwd< SqDynArgDivFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        .Func< Color4 (Color4::*)(const Color4 &) const >(_SC("_modulo"), &Color4::operator %)
 | 
					        .SquirrelFunc(_SC("_modulo"), &SqDynArgFwd< SqDynArgModFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
 | 
				
			||||||
        .Func< Color4 (Color4::*)(void) const >(_SC("_unm"), &Color4::operator -)
 | 
					        .Func< Color4 (Color4::*)(void) const >(_SC("_unm"), &Color4::operator -)
 | 
				
			||||||
        // Properties
 | 
					        // Properties
 | 
				
			||||||
        .Prop(_SC("RGB"), &Color4::GetRGB, &Color4::SetRGB)
 | 
					        .Prop(_SC("RGB"), &Color4::GetRGB, &Color4::SetRGB)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -369,6 +369,30 @@ struct Color4
 | 
				
			|||||||
    */
 | 
					    */
 | 
				
			||||||
    Int32 Cmp(const Color4 & c) const;
 | 
					    Int32 Cmp(const Color4 & c) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Used by the script engine to compare an instance of this type with a scalar value.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Int32 Cmp(Int32 s) const
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Cmp(Color4(static_cast< Value >(s)));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Used by the script engine to compare an instance of this type with a scalar value.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Int32 Cmp(Float32 s) const
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Cmp(Color4(static_cast< Value >(s)));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Used by the script engine to compare an instance of this type with a scalar value.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Int32 Cmp(std::nullptr_t) const
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Cmp(Color4(static_cast< Value >(0)));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* --------------------------------------------------------------------------------------------
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
     * Used by the script engine to convert an instance of this type to a string.
 | 
					     * Used by the script engine to convert an instance of this type to a string.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user