summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/binding
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-29 22:51:04 +0800
committerchai <chaifix@163.com>2019-03-29 22:51:04 +0800
commitc302f5ae5f9e30a28e487e8a764d9cc31546bbea (patch)
tree7f18bedeece950600336ea7ced7c52c468552c98 /source/modules/asura-core/graphics/binding
parent157530b8b6e11efc5573d5a0db8987a440197aa1 (diff)
*rename
Diffstat (limited to 'source/modules/asura-core/graphics/binding')
-rw-r--r--source/modules/asura-core/graphics/binding/_canvas.cpp46
-rw-r--r--source/modules/asura-core/graphics/binding/_color.cpp54
-rw-r--r--source/modules/asura-core/graphics/binding/_color32.cpp86
-rw-r--r--source/modules/asura-core/graphics/binding/_image.cpp99
-rw-r--r--source/modules/asura-core/graphics/binding/_image_data.cpp70
-rw-r--r--source/modules/asura-core/graphics/binding/_image_decode_task.cpp21
-rw-r--r--source/modules/asura-core/graphics/binding/_mesh2d.cpp21
-rw-r--r--source/modules/asura-core/graphics/binding/_shader.cpp126
-rw-r--r--source/modules/asura-core/graphics/binding/_sprite_batch.cpp21
-rw-r--r--source/modules/asura-core/graphics/binding/_window.cpp103
10 files changed, 647 insertions, 0 deletions
diff --git a/source/modules/asura-core/graphics/binding/_canvas.cpp b/source/modules/asura-core/graphics/binding/_canvas.cpp
new file mode 100644
index 0000000..7927995
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_canvas.cpp
@@ -0,0 +1,46 @@
+#include "../canvas.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Canvas)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "SetSize", _SetSize },
+ { "Bind", _Bind },
+ { "Unbind", _Unbind }
+ );
+ }
+
+ LUAX_POSTPROCESS(Canvas)
+ {
+
+ }
+
+ // canvas:SetSize()
+ LUAX_IMPL_METHOD(Canvas, _SetSize)
+ {
+ LUAX_PREPARE(L, Canvas);
+
+ }
+
+ // canvas:Bind()
+ LUAX_IMPL_METHOD(Canvas, _Bind)
+ {
+ LUAX_PREPARE(L, Canvas);
+
+ }
+
+ // canvas:Unbind()
+ LUAX_IMPL_METHOD(Canvas, _Unbind)
+ {
+ LUAX_PREPARE(L, Canvas);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_color.cpp b/source/modules/asura-core/graphics/binding/_color.cpp
new file mode 100644
index 0000000..11e80a1
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_color.cpp
@@ -0,0 +1,54 @@
+#include "../color.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Color)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "ToColor32", _ToColor32 },
+ { "SetColor", _SetColor },
+ { "GetColor", _GetColor },
+ { "Multiply", _Multiply }
+ );
+ }
+
+ LUAX_POSTPROCESS(Color)
+ {
+
+ }
+
+ // color:ToColor32()
+ LUAX_IMPL_METHOD(Color, _ToColor32)
+ {
+ LUAX_PREPARE(L, Color);
+
+ }
+
+ // color:SetColor()
+ LUAX_IMPL_METHOD(Color, _SetColor)
+ {
+ LUAX_PREPARE(L, Color);
+
+ }
+
+ // color:GetColor()
+ LUAX_IMPL_METHOD(Color, _GetColor)
+ {
+ LUAX_PREPARE(L, Color);
+
+ }
+
+ // color:Multiply()
+ LUAX_IMPL_METHOD(Color, _Multiply)
+ {
+ LUAX_PREPARE(L, Color);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_color32.cpp b/source/modules/asura-core/graphics/binding/_color32.cpp
new file mode 100644
index 0000000..7095866
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_color32.cpp
@@ -0,0 +1,86 @@
+#include "../color32.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Color32)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "ToColor", _ToColor },
+ { "GetRed", _GetRed },
+ { "GetGreen", _GetGreen },
+ { "GetBlue", _GetBlue },
+ { "GetAlpha", _GetAlpha },
+ { "Multiply", _Multiply },
+ { "Index", _Index },
+ { "NewIndex", _NewIndex }
+ );
+ }
+
+ LUAX_POSTPROCESS(Color32)
+ {
+
+ }
+
+ // color32:ToColor()
+ LUAX_IMPL_METHOD(Color32, _ToColor)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:GetRed()
+ LUAX_IMPL_METHOD(Color32, _GetRed)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:GetGreen()
+ LUAX_IMPL_METHOD(Color32, _GetGreen)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:GetBlue()
+ LUAX_IMPL_METHOD(Color32, _GetBlue)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:GetAlpha()
+ LUAX_IMPL_METHOD(Color32, _GetAlpha)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:Multiply()
+ LUAX_IMPL_METHOD(Color32, _Multiply)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:Index()
+ LUAX_IMPL_METHOD(Color32, _Index)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ // color32:NewIndex()
+ LUAX_IMPL_METHOD(Color32, _NewIndex)
+ {
+ LUAX_PREPARE(L, Color32);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_image.cpp b/source/modules/asura-core/graphics/binding/_image.cpp
new file mode 100644
index 0000000..cb008d3
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_image.cpp
@@ -0,0 +1,99 @@
+#include "../image.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Image)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "Load", _Load },
+ { "GetWidth", _GetWidth },
+ { "GetHeight", _GetHeight },
+ { "GetSize", _GetSize },
+ { "GetPixel", _GetPixel },
+ { "Render", _Render }
+ );
+ }
+
+ LUAX_POSTPROCESS(Image)
+ {
+
+ }
+
+ // image = Image.New()
+ LUAX_IMPL_METHOD(Image, _New)
+ {
+ LUAX_STATE(L);
+
+ Image* image = new Image();
+ image->PushLuaxUserdata(state);
+ return 0;
+ }
+
+ // successed = image:Load(image_data)
+ LUAX_IMPL_METHOD(Image, _Load)
+ {
+ LUAX_PREPARE(L, Image);
+
+ ImageData* imgdata = state.CheckUserdata<ImageData>(2);
+ bool loaded = self->Load(imgdata);
+ state.Push(loaded);
+ return 1;
+ }
+
+ // width = image:GetWidth()
+ LUAX_IMPL_METHOD(Image, _GetWidth)
+ {
+ LUAX_PREPARE(L, Image);
+
+ state.Push(self->GetWidth());
+ return 1;
+ }
+
+ // height = image:GetHeight()
+ LUAX_IMPL_METHOD(Image, _GetHeight)
+ {
+ LUAX_PREPARE(L, Image);
+
+ state.Push(self->GetHeight());
+ return 1;
+ }
+
+ // w, h = image:GetSize()
+ LUAX_IMPL_METHOD(Image, _GetSize)
+ {
+ LUAX_PREPARE(L, Image);
+
+ Math::Vector2u size = self->GetSize();
+ state.Push(size.x);
+ state.Push(size.y);
+ return 2;
+ }
+
+ // color32 = image:GetPixel(x, y)
+ LUAX_IMPL_METHOD(Image, _GetPixel)
+ {
+ LUAX_PREPARE(L, Image);
+
+ uint x = state.CheckValue<uint>(2);
+ uint y = state.CheckValue<uint>(3);
+ Color32* c32 = new Color32(self->GetPixel(x, y));
+ c32->PushLuaxUserdata(state);
+ return 1;
+ }
+
+ // image:Render()
+ LUAX_IMPL_METHOD(Image, _Render)
+ {
+ LUAX_PREPARE(L, Image);
+
+ return 0;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/binding/_image_data.cpp b/source/modules/asura-core/graphics/binding/_image_data.cpp
new file mode 100644
index 0000000..3ff38f9
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_image_data.cpp
@@ -0,0 +1,70 @@
+#include "../image_data.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(ImageData)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "GetPixel", _GetPixel },
+ { "GetSize", _GetSize },
+ { "GetWidth", _GetWidth },
+ { "GetHeight", _GetHeight },
+ { "GetPixelFormat", _GetPixelFormat }
+ );
+ }
+
+ LUAX_POSTPROCESS(ImageData)
+ {
+
+ }
+
+ // ImageData.New()
+ LUAX_IMPL_METHOD(ImageData, _New)
+ {
+ LUAX_STATE(L);
+
+ }
+
+ // imagedata:GetPixel()
+ LUAX_IMPL_METHOD(ImageData, _GetPixel)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ }
+
+ // imagedata:GetSize()
+ LUAX_IMPL_METHOD(ImageData, _GetSize)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ }
+
+ // imagedata:GetWidth()
+ LUAX_IMPL_METHOD(ImageData, _GetWidth)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ }
+
+ // imagedata:GetHeight()
+ LUAX_IMPL_METHOD(ImageData, _GetHeight)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ }
+
+ // imagedata:GetPixelFormat()
+ LUAX_IMPL_METHOD(ImageData, _GetPixelFormat)
+ {
+ LUAX_PREPARE(L, ImageData);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_image_decode_task.cpp b/source/modules/asura-core/graphics/binding/_image_decode_task.cpp
new file mode 100644
index 0000000..76b544b
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_image_decode_task.cpp
@@ -0,0 +1,21 @@
+#include "../image_decode_task.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(ImageDecodeTask)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(ImageDecodeTask)
+ {
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_mesh2d.cpp b/source/modules/asura-core/graphics/binding/_mesh2d.cpp
new file mode 100644
index 0000000..07e9f12
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_mesh2d.cpp
@@ -0,0 +1,21 @@
+#include "../mesh2d.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Mesh2D)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(Mesh2D)
+ {
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_shader.cpp b/source/modules/asura-core/graphics/binding/_shader.cpp
new file mode 100644
index 0000000..a06e54b
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_shader.cpp
@@ -0,0 +1,126 @@
+#include "../shader.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Shader)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "New", _New },
+ { "Use", _Use },
+ { "Unuse", _Unuse },
+ { "Load", _Load },
+ { "HasUniform", _HasUniform },
+ { "GetUniformLocation", _GetUniformLocation },
+ { "SetBuiltInUniforms", _SetBuiltInUniforms },
+ { "SetUniformFloat", _SetUniformFloat },
+ { "SetUniformTexture", _SetUniformTexture },
+ { "SetUniformVector2", _SetUniformVector2 },
+ { "SetUniformVector3", _SetUniformVector3 },
+ { "SetUniformVector4", _SetUniformVector4 },
+ { "SetUniformColor", _SetUniformColor }
+ );
+ }
+
+ LUAX_POSTPROCESS(Shader)
+ {
+
+ }
+
+ // Shader.New()
+ LUAX_IMPL_METHOD(Shader, _New)
+ {
+ LUAX_STATE(L);
+
+ }
+
+ // shader:Use()
+ LUAX_IMPL_METHOD(Shader, _Use)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:Unuse()
+ LUAX_IMPL_METHOD(Shader, _Unuse)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:Load()
+ LUAX_IMPL_METHOD(Shader, _Load)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:HasUniform()
+ LUAX_IMPL_METHOD(Shader, _HasUniform)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:GetUniformLocation()
+ LUAX_IMPL_METHOD(Shader, _GetUniformLocation)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetBuiltInUniforms()
+ LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformFloat()
+ LUAX_IMPL_METHOD(Shader, _SetUniformFloat)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformTexture()
+ LUAX_IMPL_METHOD(Shader, _SetUniformTexture)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformVector2()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector2)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformVector3()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector3)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformVector4()
+ LUAX_IMPL_METHOD(Shader, _SetUniformVector4)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ // shader:SetUniformColor()
+ LUAX_IMPL_METHOD(Shader, _SetUniformColor)
+ {
+ LUAX_PREPARE(L, Shader);
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_sprite_batch.cpp b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp
new file mode 100644
index 0000000..8556c02
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp
@@ -0,0 +1,21 @@
+#include "../sprite_batch.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(SpriteBatch)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(SpriteBatch)
+ {
+
+ }
+
+ }
+}
diff --git a/source/modules/asura-core/graphics/binding/_window.cpp b/source/modules/asura-core/graphics/binding/_window.cpp
new file mode 100644
index 0000000..fc74d6c
--- /dev/null
+++ b/source/modules/asura-core/graphics/binding/_window.cpp
@@ -0,0 +1,103 @@
+#include "../window.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ LUAX_REGISTRY(Window)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "Show", _Show },
+ { "Hide", _Hide },
+ { "SetResolution", _SetResolution },
+ { "SetFullScreen", _SetFullScreen },
+ { "SetTitle", _SetTitle },
+ { "SetWindowStyle", _SetWindowStyle },
+ { "Clear", _Clear },
+ { "Draw", _Draw },
+ { "SwapRenderBuffer", _SwapRenderBuffer }
+ );
+ }
+
+ LUAX_POSTPROCESS(Window)
+ {
+
+ }
+
+ // window:Show()
+ LUAX_IMPL_METHOD(Window, _Show)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:Hide()
+ LUAX_IMPL_METHOD(Window, _Hide)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:SetResolution()
+ LUAX_IMPL_METHOD(Window, _SetResolution)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:SetFullScreen()
+ LUAX_IMPL_METHOD(Window, _SetFullScreen)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:SetTitle()
+ LUAX_IMPL_METHOD(Window, _SetTitle)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:SetWindowStyle()
+ LUAX_IMPL_METHOD(Window, _SetWindowStyle)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:Clear()
+ LUAX_IMPL_METHOD(Window, _Clear)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:Draw()
+ LUAX_IMPL_METHOD(Window, _Draw)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ // window:SwapRenderBuffer()
+ LUAX_IMPL_METHOD(Window, _SwapRenderBuffer)
+ {
+ LUAX_PREPARE(L, Window);
+
+ return 0;
+ }
+
+ }
+}