Add Register function and documentation for GameScriptColor, since it will be used in GameScriptMeshInfo.

This commit is contained in:
hispidence 2021-07-20 17:48:39 +01:00
parent ffa8791c03
commit 12b28a38c6
2 changed files with 54 additions and 0 deletions

View file

@ -1,13 +1,60 @@
#include "framework.h"
#include "GameScriptColor.h"
/***
An RGBA or RGB color. Components are set in bytes, with 0 being
the minimum amount of that component, and 255 being the maximum.
@classmod Color
@pragma nostrip
*/
void GameScriptColor::Register(sol::state* state)
{
state->new_usertype<GameScriptColor>("Color",
sol::constructors<GameScriptColor(int, int, int)>(),
/// (int) red component
//@mem R
"R", sol::property(&GameScriptColor::GetR, &GameScriptColor::SetR),
/// (int) green component
//@mem G
"G", sol::property(&GameScriptColor::GetG, &GameScriptColor::SetG),
/// (int) blue component
//@mem B
"B", sol::property(&GameScriptColor::GetB, &GameScriptColor::SetB),
/// (int) alpha component (255 is opaque, 0 is invisible)
//@mem A
"A", sol::property(&GameScriptColor::GetA, &GameScriptColor::SetA)
);
}
/***
@int R red component
@int G green component
@int B blue component
@return A Color object.
@function Color.new
*/
GameScriptColor::GameScriptColor(byte r, byte g, byte b)
{
SetR(r);
SetG(g);
SetB(b);
SetA(255);
}
/***
@int R red component
@int G green component
@int B blue component
@int A alpha component (255 is opaque, 0 is invisible)
@return A Color object.
@function Color.new
*/
GameScriptColor::GameScriptColor(byte r, byte g, byte b, byte a)
{
SetR(r);