summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/AllToLua.pkg1
-rw-r--r--src/Bindings/CMakeLists.txt1
-rw-r--r--src/Bindings/ManualBindings.cpp22
-rw-r--r--src/Color.h12
4 files changed, 30 insertions, 6 deletions
diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg
index 31c914bcd..a109913e2 100644
--- a/src/Bindings/AllToLua.pkg
+++ b/src/Bindings/AllToLua.pkg
@@ -46,6 +46,7 @@ $cfile "../StringUtils.h"
$cfile "../Defines.h"
$cfile "../ChatColor.h"
$cfile "../ClientHandle.h"
+$cfile "../Color.h"
$cfile "../EffectID.h"
$cfile "../Server.h"
$cfile "../World.h"
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index e50db12c3..da7c8bbe8 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -89,6 +89,7 @@ set(BINDING_DEPENDENCIES
../ChatColor.h
../ChunkDef.h
../ClientHandle.h
+ ../Color.h
../CompositeChat.h
../CraftingRecipes.h
../Cuboid.h
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 565c636e3..e81a8ef05 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -3297,6 +3297,24 @@ static int tolua_cChunkDesc_GetBlockTypeMeta(lua_State * a_LuaState)
+static int tolua_cColor_GetColor(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ cColor * self;
+ if (!L.CheckParamSelf("cColor") || !L.GetStackValue(1, self))
+ {
+ return 0;
+ }
+
+ L.Push(self->GetRed(), self->GetGreen(), self->GetBlue());
+ return 3;
+}
+
+
+
+
+
static int tolua_cCompositeChat_new(lua_State * a_LuaState)
{
/* Function signatures:
@@ -3727,6 +3745,10 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "SendPluginMessage", tolua_cClientHandle_SendPluginMessage);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S, "cColor");
+ tolua_function(tolua_S, "GetColor", tolua_cColor_GetColor);
+ tolua_endmodule(tolua_S);
+
tolua_beginmodule(tolua_S, "cCompositeChat");
tolua_function(tolua_S, "new", tolua_cCompositeChat_new);
tolua_function(tolua_S, "new_local", tolua_cCompositeChat_new_local);
diff --git a/src/Color.h b/src/Color.h
index 3680193ab..059729bcf 100644
--- a/src/Color.h
+++ b/src/Color.h
@@ -9,13 +9,12 @@
#pragma once
- // tolua_begin
-
+// tolua_begin
class cColor
{
public:
- enum : unsigned int
+ enum eColorLimits : unsigned int
{
COLOR_MIN = 0,
COLOR_MAX = 255,
@@ -28,6 +27,7 @@ public:
/** Returns whether the color is a valid color */
bool IsValid() const { return m_Color != COLOR_NONE; }
+
/** Changes the color */
void SetColor(unsigned char a_Red, unsigned char a_Green, unsigned char a_Blue);
@@ -35,10 +35,10 @@ public:
void SetRed(unsigned char a_Red);
/** Alters the green value of the color */
- void SetGreen(unsigned char a_Red);
+ void SetGreen(unsigned char a_Green);
/** Alters the blue value of the color */
- void SetBlue(unsigned char a_Red);
+ void SetBlue(unsigned char a_Blue);
/** Returns the red value of the color */
unsigned char GetRed() const;
@@ -55,4 +55,4 @@ public:
unsigned int m_Color;
-};
+}; // tolua_export