Update lens flare and starfield Lua docs

This commit is contained in:
Sezz 2025-02-06 16:56:19 +11:00
parent 94ede801bc
commit 599a651b6f
8 changed files with 228 additions and 211 deletions

View file

@ -108,7 +108,7 @@
<div id="content">
<h1>Primitive Class <code>Flow.LensFlare</code></h1>
<p>Represents a global lens flare (not to be confused with lensflare object).</p>
<p>Represents a global lens flare (not to be confused with the lens flare object).</p>
<p>
</p>
@ -121,40 +121,40 @@
<td class="summary">Create a LensFlare object.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:GetEnabled">LensFlare:GetEnabled()</a></td>
<td class="summary">Get the lens flare's enabled status.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:GetSunSpriteID">LensFlare:GetSunSpriteID()</a></td>
<td class="summary">Get the sun's sprite ID.</td>
<td class="summary">Get this lens flare's sun sprite ID.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:GetPitch">LensFlare:GetPitch()</a></td>
<td class="summary">Get the lens flare's pitch angle in degrees.</td>
<td class="summary">Get this lens flare's pitch angle in degrees.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:GetYaw">LensFlare:GetYaw()</a></td>
<td class="summary">Get the lens flare's yaw angle in degrees.</td>
<td class="summary">Get this lens flare's yaw angle in degrees.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:SetColor">LensFlare:SetColor()</a></td>
<td class="name" ><a href="#LensFlare:GetColor">LensFlare:GetColor()</a></td>
<td class="summary">Get the lens flare's color.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:GetEnabled">LensFlare:GetEnabled()</a></td>
<td class="summary">Get this lens flare's enabled status.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:SetSunSpriteID">LensFlare:SetSunSpriteID(New)</a></td>
<td class="summary">Set the lens flare's sun sprite ID.</td>
<td class="summary">Set this lens flare's sun sprite ID.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:SetPitch">LensFlare:SetPitch(New)</a></td>
<td class="summary">Set the lens flare's pitch angle.</td>
<td class="summary">Set this lens flare's pitch angle.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:SetYaw">LensFlare:SetYaw(New)</a></td>
<td class="summary">Set the lens flare's yaw angle.</td>
<td class="summary">Set this lens flare's yaw angle.</td>
</tr>
<tr>
<td class="name" ><a href="#LensFlare:SetColor">LensFlare:SetColor(New)</a></td>
<td class="summary">Set the lens flare's color.</td>
<td class="summary">Set this lens flare's color.</td>
</tr>
</table>
@ -170,7 +170,7 @@
<strong>LensFlare(Pitch, Yaw, Color.)</strong>
</dt>
<dd>
Create a LensFlare object. ()
Create a LensFlare object.
@ -202,34 +202,13 @@
</dd>
<dt>
<a name = "LensFlare:GetEnabled"></a>
<strong>LensFlare:GetEnabled()</strong>
</dt>
<dd>
Get the lens flare's enabled status. ()
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Lens flare's enabled status.
</ol>
</dd>
<dt>
<a name = "LensFlare:GetSunSpriteID"></a>
<strong>LensFlare:GetSunSpriteID()</strong>
</dt>
<dd>
Get the sun's sprite ID. ()
Get this lens flare's sun sprite ID.
@ -250,7 +229,7 @@
<strong>LensFlare:GetPitch()</strong>
</dt>
<dd>
Get the lens flare's pitch angle in degrees. ()
Get this lens flare's pitch angle in degrees.
@ -271,7 +250,7 @@
<strong>LensFlare:GetYaw()</strong>
</dt>
<dd>
Get the lens flare's yaw angle in degrees. ()
Get this lens flare's yaw angle in degrees.
@ -288,11 +267,11 @@
</dd>
<dt>
<a name = "LensFlare:SetColor"></a>
<strong>LensFlare:SetColor()</strong>
<a name = "LensFlare:GetColor"></a>
<strong>LensFlare:GetColor()</strong>
</dt>
<dd>
Get the lens flare's color. ()
Get the lens flare's color.
@ -301,13 +280,34 @@
</dd>
<dt>
<a name = "LensFlare:GetEnabled"></a>
<strong>LensFlare:GetEnabled()</strong>
</dt>
<dd>
Get this lens flare's enabled status.
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Enabled status. <strong>true: enabled</strong>, <strong>false: disabled</strong>
</ol>
</dd>
<dt>
<a name = "LensFlare:SetSunSpriteID"></a>
<strong>LensFlare:SetSunSpriteID(New)</strong>
</dt>
<dd>
Set the lens flare's sun sprite ID. ()
Set this lens flare's sun sprite ID.
@ -315,7 +315,7 @@
<ul>
<li><span class="parameter">New</span>
<span class="types"><span class="type">int</span></span>
sprite ID.
sun sprite ID.
</li>
</ul>
@ -329,7 +329,7 @@
<strong>LensFlare:SetPitch(New)</strong>
</dt>
<dd>
Set the lens flare's pitch angle. (float)
Set this lens flare's pitch angle.
@ -351,7 +351,7 @@
<strong>LensFlare:SetYaw(New)</strong>
</dt>
<dd>
Set the lens flare's yaw angle. (float)
Set this lens flare's yaw angle.
@ -373,7 +373,7 @@
<strong>LensFlare:SetColor(New)</strong>
</dt>
<dd>
Set the lens flare's color. (Color)
Set this lens flare's color.

View file

@ -108,7 +108,7 @@
<div id="content">
<h1>Primitive Class <code>Flow.Starfield</code></h1>
<p>Represents a starfield.</p>
<p>Represents a starfield in the sky.</p>
<p>
</p>
@ -125,44 +125,44 @@
<td class="summary">Create a starfield object with stars and meteors.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetStarsEnabled">Starfield:GetStarsEnabled()</a></td>
<td class="summary">Get the starfield's enabled status of stars.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetMeteorsEnabled">Starfield:GetMeteorsEnabled()</a></td>
<td class="summary">Get the starfield's enabled status of meteors.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetStarCount">Starfield:GetStarCount()</a></td>
<td class="summary">Get the starfield's number of stars.</td>
<td class="summary">Get this starfield's number of stars.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetMeteorCount">Starfield:GetMeteorCount()</a></td>
<td class="summary">Get the starfield's number of meteors.</td>
<td class="summary">Get this starfield's number of meteors.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetMeteorSpawnDensity">Starfield:GetMeteorSpawnDensity()</a></td>
<td class="summary">Get the starfield's meteor spawn density.</td>
<td class="summary">Get this starfield's meteor spawn density.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetMeteorVelocity">Starfield:GetMeteorVelocity()</a></td>
<td class="summary">Get the starfield's meteor velocity.</td>
<td class="summary">Get this starfield's meteor velocity.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetStarsEnabled">Starfield:GetStarsEnabled()</a></td>
<td class="summary">Get this starfield's stars enabled status.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:GetMeteorsEnabled">Starfield:GetMeteorsEnabled()</a></td>
<td class="summary">Get this starfield's meteors enabled status.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:SetStarCount">Starfield:SetStarCount(New)</a></td>
<td class="summary">Set the starfield's number of stars (6000 max).</td>
<td class="summary">Set this starfield's number of stars.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:SetMeteorCount">Starfield:SetMeteorCount(New)</a></td>
<td class="summary">Set the starfield's number of meteors (100 max).</td>
<td class="summary">Set this starfield's number of meteors.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:SetMeteorSpawnDensity">Starfield:SetMeteorSpawnDensity(New)</a></td>
<td class="summary">Set the starfield's meteor spawn density.</td>
<td class="summary">Set this starfield's meteor spawn density.</td>
</tr>
<tr>
<td class="name" ><a href="#Starfield:SetMeteorVelocity">Starfield:SetMeteorVelocity(New)</a></td>
<td class="summary">Set the starfield's meteor velocity.</td>
<td class="summary">Set this starfield's meteor velocity.</td>
</tr>
</table>
@ -178,7 +178,7 @@
<strong>Starfield(starCount)</strong>
</dt>
<dd>
Create a starfield object with only stars. ()
Create a starfield object with only stars.
@ -206,7 +206,7 @@
<strong>Starfield(starCount, meteorCount)</strong>
</dt>
<dd>
Create a starfield object with stars and meteors. ()
Create a starfield object with stars and meteors.
@ -214,11 +214,11 @@
<ul>
<li><span class="parameter">starCount</span>
<span class="types"><span class="type">int</span></span>
Star count (6000 max).
Star count. <strong>Max: 6000</strong>
</li>
<li><span class="parameter">meteorCount</span>
<span class="types"><span class="type">int</span></span>
Meteor count (100 max).
Meteor count. <strong>Max: 100</strong>
</li>
</ul>
@ -232,55 +232,13 @@
</dd>
<dt>
<a name = "Starfield:GetStarsEnabled"></a>
<strong>Starfield:GetStarsEnabled()</strong>
</dt>
<dd>
Get the starfield's enabled status of stars. ()
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Stars enabled status.
</ol>
</dd>
<dt>
<a name = "Starfield:GetMeteorsEnabled"></a>
<strong>Starfield:GetMeteorsEnabled()</strong>
</dt>
<dd>
Get the starfield's enabled status of meteors. ()
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Meteors enabled status.
</ol>
</dd>
<dt>
<a name = "Starfield:GetStarCount"></a>
<strong>Starfield:GetStarCount()</strong>
</dt>
<dd>
Get the starfield's number of stars. ()
Get this starfield's number of stars.
@ -301,7 +259,7 @@
<strong>Starfield:GetMeteorCount()</strong>
</dt>
<dd>
Get the starfield's number of meteors. ()
Get this starfield's number of meteors.
@ -322,7 +280,7 @@
<strong>Starfield:GetMeteorSpawnDensity()</strong>
</dt>
<dd>
Get the starfield's meteor spawn density. ()
Get this starfield's meteor spawn density.
@ -343,7 +301,7 @@
<strong>Starfield:GetMeteorVelocity()</strong>
</dt>
<dd>
Get the starfield's meteor velocity. ()
Get this starfield's meteor velocity.
@ -358,13 +316,55 @@
</dd>
<dt>
<a name = "Starfield:GetStarsEnabled"></a>
<strong>Starfield:GetStarsEnabled()</strong>
</dt>
<dd>
Get this starfield's stars enabled status.
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Stars enabled status. <strong>true: enabled</strong>, <strong>false: disabled</strong>
</ol>
</dd>
<dt>
<a name = "Starfield:GetMeteorsEnabled"></a>
<strong>Starfield:GetMeteorsEnabled()</strong>
</dt>
<dd>
Get this starfield's meteors enabled status.
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Meteors enabled status. <strong>true: enabled</strong>, <strong>false: disabled</strong>
</ol>
</dd>
<dt>
<a name = "Starfield:SetStarCount"></a>
<strong>Starfield:SetStarCount(New)</strong>
</dt>
<dd>
Set the starfield's number of stars (6000 max). (int)
Set this starfield's number of stars.
@ -372,7 +372,7 @@
<ul>
<li><span class="parameter">New</span>
<span class="types"><span class="type">int</span></span>
count.
star count.
</li>
</ul>
@ -386,7 +386,7 @@
<strong>Starfield:SetMeteorCount(New)</strong>
</dt>
<dd>
Set the starfield's number of meteors (100 max). (int)
Set this starfield's number of meteors.
@ -394,7 +394,7 @@
<ul>
<li><span class="parameter">New</span>
<span class="types"><span class="type">int</span></span>
count.
meteor count.
</li>
</ul>
@ -408,7 +408,7 @@
<strong>Starfield:SetMeteorSpawnDensity(New)</strong>
</dt>
<dd>
Set the starfield's meteor spawn density. (int)
Set this starfield's meteor spawn density.
@ -416,7 +416,7 @@
<ul>
<li><span class="parameter">New</span>
<span class="types"><span class="type">int</span></span>
spawn density.
meteor spawn density.
</li>
</ul>
@ -430,15 +430,15 @@
<strong>Starfield:SetMeteorVelocity(New)</strong>
</dt>
<dd>
Set the starfield's meteor velocity. (float)
Set this starfield's meteor velocity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">New</span>
<span class="types"><span class="type">int</span></span>
velocity.
<span class="types"><span class="type">float</span></span>
meteor velocity.
</li>
</ul>

View file

@ -244,7 +244,7 @@ local door = GetMoveableByName("door_type4_14")
</tr>
<tr>
<td class="name" ><a href="3 primitive classes/Flow.LensFlare.html">Flow.LensFlare</a></td>
<td class="summary">Represents a global lens flare (not to be confused with lensflare object).</td>
<td class="summary">Represents a global lens flare (not to be confused with the lens flare object).</td>
</tr>
<tr>
<td class="name" ><a href="3 primitive classes/Flow.SkyLayer.html">Flow.SkyLayer</a></td>
@ -252,7 +252,7 @@ local door = GetMoveableByName("door_type4_14")
</tr>
<tr>
<td class="name" ><a href="3 primitive classes/Flow.Starfield.html">Flow.Starfield</a></td>
<td class="summary">Represents a starfield.</td>
<td class="summary">Represents a starfield in the sky.</td>
</tr>
<tr>
<td class="name" ><a href="3 primitive classes/Color.html">Color</a></td>

View file

@ -8,7 +8,7 @@
using namespace TEN::Scripting::Types;
/// Represents a global lens flare (not to be confused with lensflare object).
/// Represents a global lens flare (not to be confused with the lens flare object).
//
// @tenprimitive Flow.LensFlare
// @pragma nostrip
@ -18,16 +18,19 @@ namespace TEN::Scripting
void LensFlare::Register(sol::table& parent)
{
using ctors = sol::constructors<
LensFlare(float pitch, float yaw, const ScriptColor& color)>;
LensFlare(float, float, const ScriptColor&)>;
// Register type.
parent.new_usertype<LensFlare>(
"LensFlare", ctors(), sol::call_constructor, ctors(),
"GetEnabled", &LensFlare::GetEnabled,
"LensFlare",
ctors(), sol::call_constructor, ctors(),
"GetSunSpriteID", &LensFlare::GetSunSpriteID,
"GetPitch", &LensFlare::GetPitch,
"GetYaw", &LensFlare::GetYaw,
"GetColor", &LensFlare::GetColor,
"GetEnabled", &LensFlare::GetEnabledStatus,
"SetSunSpriteID", &LensFlare::SetSunSpriteID,
"SetPitch", &LensFlare::SetPitch,
"SetYaw", &LensFlare::SetYaw,
@ -35,7 +38,7 @@ namespace TEN::Scripting
}
/// Create a LensFlare object.
// @function LensFlare()
// @function LensFlare
// @tparam float Pitch angle in degrees.
// @tparam float Yaw angle in degrees.
// @tparam Color Color.
@ -47,32 +50,24 @@ namespace TEN::Scripting
_rotation = Rotation(pitch, yaw, 0.0f);
}
/// Get the lens flare's enabled status.
// @function LensFlare:GetEnabled()
// @treturn bool Lens flare's enabled status.
bool LensFlare::GetEnabled() const
{
return _isEnabled;
}
/// Get the sun's sprite ID.
// @function LensFlare:GetSunSpriteID()
/// Get this lens flare's sun sprite ID.
// @function LensFlare:GetSunSpriteID
// @treturn int Sprite ID.
int LensFlare::GetSunSpriteID() const
{
return _sunSpriteID;
}
/// Get the lens flare's pitch angle in degrees.
// @function LensFlare:GetPitch()
/// Get this lens flare's pitch angle in degrees.
// @function LensFlare:GetPitch
// @treturn float Pitch angle in degrees.
float LensFlare::GetPitch() const
{
return _rotation.x;
}
/// Get the lens flare's yaw angle in degrees.
// @function LensFlare:GetYaw()
/// Get this lens flare's yaw angle in degrees.
// @function LensFlare:GetYaw
// @treturn float Yaw angle in degrees.
float LensFlare::GetYaw() const
{
@ -80,15 +75,23 @@ namespace TEN::Scripting
}
/// Get the lens flare's color.
// @function LensFlare:SetColor()
// @function LensFlare:GetColor
ScriptColor LensFlare::GetColor() const
{
return _color;
}
/// Set the lens flare's sun sprite ID.
// @function LensFlare:SetSunSpriteID()
// @tparam int New sprite ID.
/// Get this lens flare's enabled status.
// @function LensFlare:GetEnabled
// @treturn bool Enabled status. __true: enabled__, __false: disabled__
bool LensFlare::GetEnabledStatus() const
{
return _isEnabled;
}
/// Set this lens flare's sun sprite ID.
// @function LensFlare:SetSunSpriteID
// @tparam int New sun sprite ID.
void LensFlare::SetSunSpriteID(int spriteID)
{
// Sprite ID out of range; return early.
@ -101,24 +104,24 @@ namespace TEN::Scripting
_sunSpriteID = spriteID;
}
/// Set the lens flare's pitch angle.
// @function LensFlare:SetPitch(float)
/// Set this lens flare's pitch angle.
// @function LensFlare:SetPitch
// @tparam float New pitch angle in degrees.
void LensFlare::SetPitch(float pitch)
{
_rotation.x = pitch;
}
/// Set the lens flare's yaw angle.
// @function LensFlare:SetYaw(float)
/// Set this lens flare's yaw angle.
// @function LensFlare:SetYaw
// @tparam float New yaw angle in degrees.
void LensFlare::SetYaw(float yaw)
{
_rotation.y = yaw;
}
/// Set the lens flare's color.
// @function LensFlare:SetColor(Color)
/// Set this lens flare's color.
// @function LensFlare:SetColor
// @tparam Color New color.
void LensFlare::SetColor(const ScriptColor& color)
{

View file

@ -15,8 +15,12 @@ namespace TEN::Scripting
{
class LensFlare
{
public:
static void Register(sol::table& parent);
private:
// Members
// Fields
int _sunSpriteID = SPRITE_TYPES::SPR_LENS_FLARE_3;
bool _isEnabled = false;
@ -24,20 +28,21 @@ namespace TEN::Scripting
ScriptColor _color = 0;
public:
static void Register(sol::table& table);
// Constructors
LensFlare() = default;
LensFlare(float pitch, float yaw, const ScriptColor& color);
// Getters
bool GetEnabled() const;
int GetSunSpriteID() const;
float GetPitch() const;
float GetYaw() const;
ScriptColor GetColor() const;
bool GetEnabledStatus() const;
// Setters
void SetSunSpriteID(int spriteID);
void SetPitch(float pitch);
void SetYaw(float yaw);

View file

@ -282,7 +282,7 @@ std::string Level::GetAmbientTrack() const
bool Level::GetLensFlareEnabled() const
{
return LensFlare.GetEnabled();
return LensFlare.GetEnabledStatus();
}
int Level::GetLensFlareSunSpriteID() const
@ -307,12 +307,12 @@ Color Level::GetLensFlareColor() const
bool Level::GetStarfieldStarsEnabled() const
{
return Starfield.GetStarsEnabled();
return Starfield.GetStarsEnabledStatus();
}
bool Level::GetStarfieldMeteorsEnabled() const
{
return Starfield.GetMeteorsEnabled();
return Starfield.GetMeteorsEnabledStatus();
}
int Level::GetStarfieldStarCount() const

View file

@ -6,7 +6,7 @@
using namespace TEN::Effects::Environment;
/// Represents a starfield.
/// Represents a starfield in the sky.
//
// @tenprimitive Flow.Starfield
// @pragma nostrip
@ -16,18 +16,21 @@ namespace TEN::Scripting
void Starfield::Register(sol::table& parent)
{
using ctors = sol::constructors<
Starfield(int starCount),
Starfield(int starCount, int meteorCount, int meteorSpawnDensity, float meteorVel)>;
Starfield(int),
Starfield(int, int, int, float)>;
// Register type.
parent.new_usertype<Starfield>(
"Starfield", ctors(), sol::call_constructor, ctors(),
"GetStarsEnabled", &Starfield::GetStarsEnabled,
"GetMeteorsEnabled", &Starfield::GetMeteorsEnabled,
"Starfield",
ctors(), sol::call_constructor, ctors(),
"GetStarCount", &Starfield::GetStarCount,
"GetMeteorCount", &Starfield::GetMeteorCount,
"GetMeteorSpawnDensity", &Starfield::GetMeteorSpawnDensity,
"GetMeteorVelocity", &Starfield::GetMeteorVelocity,
"GetStarsEnabled", &Starfield::GetStarsEnabledStatus,
"GetMeteorsEnabled", &Starfield::GetMeteorsEnabledStatus,
"SetStarCount", &Starfield::SetStarCount,
"SetMeteorCount", &Starfield::SetMeteorCount,
"SetMeteorSpawnDensity", &Starfield::SetMeteorSpawnDensity,
@ -35,7 +38,7 @@ namespace TEN::Scripting
}
/// Create a starfield object with only stars.
// @function Starfield()
// @function Starfield
// @tparam int starCount Star count.
// @treturn Starfield A new Starfield object.
Starfield::Starfield(int starCount)
@ -44,9 +47,9 @@ namespace TEN::Scripting
}
/// Create a starfield object with stars and meteors.
// @function Starfield()
// @tparam int starCount Star count (6000 max).
// @tparam int meteorCount Meteor count (100 max).
// @function Starfield
// @tparam int starCount Star count. __Max: 6000__
// @tparam int meteorCount Meteor count. __Max: 100__
// @treturn Starfield A new Starfield object.
Starfield::Starfield(int starCount, int meteorCount, int meteorSpawnDensity, float meteorVel)
{
@ -62,57 +65,57 @@ namespace TEN::Scripting
_meteorVelocity = meteorVel;
}
/// Get the starfield's enabled status of stars.
// @function Starfield:GetStarsEnabled()
// @treturn bool Stars enabled status.
bool Starfield::GetStarsEnabled() const
{
return (_starCount > 0);
}
/// Get the starfield's enabled status of meteors.
// @function Starfield:GetMeteorsEnabled()
// @treturn bool Meteors enabled status.
bool Starfield::GetMeteorsEnabled() const
{
return (_meteorCount > 0);
}
/// Get the starfield's number of stars.
// @function Starfield:GetStarCount()
/// Get this starfield's number of stars.
// @function Starfield:GetStarCount
// @treturn int Count.
int Starfield::GetStarCount() const
{
return _starCount;
}
/// Get the starfield's number of meteors.
// @function Starfield:GetMeteorCount()
/// Get this starfield's number of meteors.
// @function Starfield:GetMeteorCount
// @treturn int Count.
int Starfield::GetMeteorCount() const
{
return _meteorCount;
}
/// Get the starfield's meteor spawn density.
// @function Starfield:GetMeteorSpawnDensity()
/// Get this starfield's meteor spawn density.
// @function Starfield:GetMeteorSpawnDensity
// @treturn int Spawn density.
int Starfield::GetMeteorSpawnDensity() const
{
return _meteorSpawnDensity;
}
/// Get the starfield's meteor velocity.
// @function Starfield:GetMeteorVelocity()
/// Get this starfield's meteor velocity.
// @function Starfield:GetMeteorVelocity
// @treturn float Velocity.
float Starfield::GetMeteorVelocity() const
{
return _meteorVelocity;
}
/// Set the starfield's number of stars (6000 max).
// @function Starfield:SetStarCount(int)
// @tparam int New count.
/// Get this starfield's stars enabled status.
// @function Starfield:GetStarsEnabled
// @treturn bool Stars enabled status. __true: enabled__, __false: disabled__
bool Starfield::GetStarsEnabledStatus() const
{
return (_starCount > 0);
}
/// Get this starfield's meteors enabled status.
// @function Starfield:GetMeteorsEnabled
// @treturn bool Meteors enabled status. __true: enabled__, __false: disabled__
bool Starfield::GetMeteorsEnabledStatus() const
{
return (_meteorCount > 0);
}
/// Set this starfield's number of stars.
// @function Starfield:SetStarCount
// @tparam int New star count.
void Starfield::SetStarCount(int count)
{
if (count < 0 || count > STAR_COUNT_MAX)
@ -121,9 +124,9 @@ namespace TEN::Scripting
_starCount = std::clamp(count, 0, STAR_COUNT_MAX);
}
/// Set the starfield's number of meteors (100 max).
// @function Starfield:SetMeteorCount(int)
// @tparam int New count.
/// Set this starfield's number of meteors.
// @function Starfield:SetMeteorCount
// @tparam int New meteor count.
void Starfield::SetMeteorCount(int count)
{
if (count < 0 || count > METEOR_COUNT_MAX)
@ -132,17 +135,17 @@ namespace TEN::Scripting
_meteorCount = std::clamp(count, 0, METEOR_COUNT_MAX);
}
/// Set the starfield's meteor spawn density.
// @function Starfield:SetMeteorSpawnDensity(int)
// @tparam int New spawn density.
/// Set this starfield's meteor spawn density.
// @function Starfield:SetMeteorSpawnDensity
// @tparam int New meteor spawn density.
void Starfield::SetMeteorSpawnDensity(int spawnDensity)
{
_meteorSpawnDensity = spawnDensity;
}
/// Set the starfield's meteor velocity.
// @function Starfield:SetMeteorVelocity(float)
// @tparam int New velocity.
/// Set this starfield's meteor velocity.
// @function Starfield:SetMeteorVelocity
// @tparam float New meteor velocity.
void Starfield::SetMeteorVelocity(float vel)
{
_meteorVelocity = vel;

View file

@ -6,34 +6,40 @@ namespace TEN::Scripting
{
class Starfield
{
public:
static void Register(sol::table& parent);
private:
// Constants
static const auto STAR_COUNT_MAX = 6000;
static const auto METEOR_COUNT_MAX = 100;
// Members
// Fields
int _starCount = 0;
int _meteorCount = 0;
int _meteorSpawnDensity = 0;
float _meteorVelocity = 0;
public:
static void Register(sol::table& table);
// Constructors
Starfield() = default;
Starfield(int starCount);
Starfield(int starCount, int meteorCount, int meteorSpawnDensity, float meteorVel);
// Getters
bool GetStarsEnabled() const;
bool GetMeteorsEnabled() const;
int GetStarCount() const;
int GetMeteorCount() const;
int GetMeteorSpawnDensity() const;
float GetMeteorVelocity() const;
bool GetStarsEnabledStatus() const;
bool GetMeteorsEnabledStatus() const;
// Setters
void SetStarCount(int count);
void SetMeteorCount(int count);
void SetMeteorSpawnDensity(int spawnDensity);