diff options
Diffstat (limited to 'source/libs/asura-lib-core/graphics/binding')
3 files changed, 175 insertions, 6 deletions
diff --git a/source/libs/asura-lib-core/graphics/binding/_image.cpp b/source/libs/asura-lib-core/graphics/binding/_image.cpp index 7c1034c..b455ad5 100644 --- a/source/libs/asura-lib-core/graphics/binding/_image.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_image.cpp @@ -10,10 +10,13 @@ namespace AsuraEngine LUAX_REGISTRY(Image) { LUAX_REGISTER_METHODS(state, + { "New", _New }, { "Load", _Load }, { "GetWidth", _GetWidth }, { "GetHeight", _GetHeight }, - { "GetSize", _GetSize } + { "GetSize", _GetSize }, + { "GetPixel", _GetPixel }, + { "Render", _Render } ); } @@ -22,33 +25,75 @@ namespace AsuraEngine } - // image:Load() + // 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; } - // image:GetWidth() + // width = image:GetWidth() LUAX_IMPL_METHOD(Image, _GetWidth) { LUAX_PREPARE(L, Image); + state.Push(self->GetWidth()); + return 1; } - // image:GetHeight() + // height = image:GetHeight() LUAX_IMPL_METHOD(Image, _GetHeight) { LUAX_PREPARE(L, Image); + state.Push(self->GetHeight()); + return 1; } - // image:GetSize() + // 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.CheckParam<uint>(2); + uint y = state.CheckParam<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/libs/asura-lib-core/graphics/binding/_image_decode_task.cpp b/source/libs/asura-lib-core/graphics/binding/_image_decode_task.cpp new file mode 100644 index 0000000..76b544b --- /dev/null +++ b/source/libs/asura-lib-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/libs/asura-lib-core/graphics/binding/_window.cpp b/source/libs/asura-lib-core/graphics/binding/_window.cpp new file mode 100644 index 0000000..fc74d6c --- /dev/null +++ b/source/libs/asura-lib-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; + } + + } +} |