mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 08:47:58 +03:00
Improve GameScriptSkyLayer.
Make its constructor take a GameScriptColor, and give it a SetColor function, exposing it to Lua as the color member. Add documentation.
This commit is contained in:
parent
af5b32c929
commit
10111e2df2
2 changed files with 46 additions and 15 deletions
|
@ -1,23 +1,54 @@
|
|||
#include "framework.h"
|
||||
#include "GameScriptSkyLayer.h"
|
||||
/***
|
||||
Description class for moving clouds, as seen in TR4's City of the Dead.
|
||||
|
||||
@classmod SkyLayer
|
||||
@pragma nostrip
|
||||
*/
|
||||
|
||||
void GameScriptSkyLayer::Register(sol::state* lua)
|
||||
{
|
||||
lua->new_usertype<GameScriptSkyLayer>("SkyLayer",
|
||||
sol::constructors<GameScriptSkyLayer(byte, byte, byte, short)>(),
|
||||
"r", &GameScriptSkyLayer::R,
|
||||
"g", &GameScriptSkyLayer::G,
|
||||
"b", &GameScriptSkyLayer::B,
|
||||
sol::constructors<GameScriptSkyLayer(GameScriptColor const &, short)>(),
|
||||
/// (@{Color}) RGB sky color
|
||||
//@mem color
|
||||
"color", sol::property(&GameScriptSkyLayer::SetColor),
|
||||
|
||||
/*** (int) cloud speed.
|
||||
|
||||
Values can be between [-32768, 32767], with positive numbers resulting in a sky that scrolls from
|
||||
west to east, and negative numbers resulting in one that travels east to west.
|
||||
|
||||
Please note that speeds outside of the range of about [-1000, 1000] will cause the
|
||||
sky to scroll so fast that it will no longer appear as a coherent stream of clouds.
|
||||
Less is more. City of The Dead, for example, uses a speed value of 16.
|
||||
|
||||
@mem speed*/
|
||||
"speed", &GameScriptSkyLayer::CloudSpeed
|
||||
);
|
||||
}
|
||||
|
||||
GameScriptSkyLayer::GameScriptSkyLayer(byte r, byte g, byte b, short speed)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
B = b;
|
||||
CloudSpeed = speed;
|
||||
Enabled = true;
|
||||
}
|
||||
/***
|
||||
@tparam Color color RGB color
|
||||
@tparam int speed cloud speed
|
||||
@return A SkyLayer object.
|
||||
@function SkyLayer.new
|
||||
*/
|
||||
GameScriptSkyLayer::GameScriptSkyLayer(GameScriptColor const& col, short speed)
|
||||
{
|
||||
R = col.GetR();
|
||||
G = col.GetG();
|
||||
B = col.GetB();
|
||||
CloudSpeed = speed;
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
void GameScriptSkyLayer::SetColor(GameScriptColor const & col)
|
||||
{
|
||||
R = col.GetR();
|
||||
G = col.GetG();
|
||||
B = col.GetB();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue