mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
Add Register function and documentation for GameScriptColor, since it will be used in GameScriptMeshInfo.
This commit is contained in:
parent
ffa8791c03
commit
12b28a38c6
2 changed files with 54 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
#include "framework.h"
|
||||
|
||||
namespace sol {
|
||||
class state;
|
||||
template <typename T> struct as_table_t;
|
||||
}
|
||||
|
||||
class GameScriptColor {
|
||||
public:
|
||||
byte r;
|
||||
|
@ -20,4 +25,6 @@ public:
|
|||
void SetB(byte v);
|
||||
byte GetA();
|
||||
void SetA(byte v);
|
||||
|
||||
void Register(sol::state* state);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue