summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/wnd/binding/_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/wnd/binding/_window.cpp')
-rw-r--r--source/modules/asura-core/wnd/binding/_window.cpp180
1 files changed, 0 insertions, 180 deletions
diff --git a/source/modules/asura-core/wnd/binding/_window.cpp b/source/modules/asura-core/wnd/binding/_window.cpp
deleted file mode 100644
index eb92de8..0000000
--- a/source/modules/asura-core/wnd/binding/_window.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-#include "../../graphics/image_data.h"
-
-#include "../window.h"
-
-using namespace std;
-using namespace AEGraphics;
-
-namespace AsuraEngine
-{
- namespace Wnd
- {
-
- LUAX_REGISTRY(Window)
- {
- LUAX_REGISTER_METHODS(state,
- { "Init", _Init },
- { "Exit", _Exit },
- { "Show", _Show },
- { "Hide", _Hide },
- { "SetSize", _SetSize },
- { "SetPosition", _SetPosition },
- { "SetTitle", _SetTitle },
- { "SetIcon", _SetIcon },
- { "SwapRenderBuffer", _SwapRenderBuffer },
- { "Clear", _Clear },
- { "Draw", _Draw }
- );
- }
-
- LUAX_POSTPROCESS(Window)
- {
- LUAX_REGISTER_ENUM(state, "EWindowFlag",
- { "FULLSCREEN", WINDOW_FULLSCREEN },
- { "OPENGL", WINDOW_OPENGL },
- { "SHOWN", WINDOW_SHOWN },
- { "HIDDEN", WINDOW_HIDDEN },
- { "BORDERLESS", WINDOW_BORDERLESS },
- { "RESIZABLE", WINDOW_RESIZABLE },
- { "MINIMIZED", WINDOW_MINIMIZED },
- { "MAXIMIZED", WINDOW_MAXIMIZED },
- { "INPUT_GRABBED", WINDOW_INPUT_GRABBED },
- { "INPUT_FOCUS", WINDOW_INPUT_FOCUS },
- { "MOUSE_FOCUS", WINDOW_MOUSE_FOCUS },
- { "ALLOW_HIGHDPI", WINDOW_ALLOW_HIGHDPI },
- { "MOUSE_CAPTURE", WINDOW_MOUSE_CAPTURE },
- { "ALWAYS_ON_TOP", WINDOW_ALWAYS_ON_TOP }
- );
-
- }
-
- // Window.Init(config_table)
- LUAX_IMPL_METHOD(Window, _Init)
- {
- LUAX_PREPARE(L, Window);
-
- WindowConfig config;
-
- if (!state.IsType(1, LUA_TTABLE))
- return state.ErrorType(1, "window config table");
-
- config.width = state.GetField(1, "width", 0);
- config.height = state.GetField(1, "height", 0);
- config.x = state.GetField(1, "x", 0);
- config.y = state.GetField(1, "y", 0);
- config.flag = state.GetField(1, "flag", WINDOW_OPENGL);
- config.title = state.GetField(1, "title", "");
- config.vsync = state.GetField(1, "vsync", true);
- config.show = state.GetField(1, "show", true);
-
- // try set window icon
- state.GetField(1, "icon");
- if (state.IsType(1, LUA_TUSERDATA))
- {
- ImageData* data = state.CheckUserdata<ImageData>(-1);
- if (data)
- {
- data->Lock();
- config.icon = data;
- Window::Get()->Init(config);
- data->Unlock();
- return 0;
- }
- }
- else
- state.Pop();
-
- Window::Get()->Init(config);
-
- return 0;
- }
-
- // Window.Exit()
- LUAX_IMPL_METHOD(Window, _Exit)
- {
- LUAX_PREPARE(L, Window);
- Window::Get()->Exit();
- return 0;
- }
-
- // Window.Show()
- LUAX_IMPL_METHOD(Window, _Show)
- {
- LUAX_PREPARE(L, Window);
- Window::Get()->Show();
- return 0;
- }
-
- // Window.Hide()
- LUAX_IMPL_METHOD(Window, _Hide)
- {
- LUAX_PREPARE(L, Window);
- Window::Get()->Hide();
- return 0;
- }
-
- // Window.SetSize(w, h)
- LUAX_IMPL_METHOD(Window, _SetSize)
- {
- LUAX_PREPARE(L, Window);
- uint w = state.CheckValue<uint>(1);
- uint h = state.CheckValue<uint>(2);
- Window::Get()->SetSize(w, h);
- return 0;
- }
-
- // Window.SetPosition(x, y)
- LUAX_IMPL_METHOD(Window, _SetPosition)
- {
- LUAX_PREPARE(L, Window);
- int x = state.CheckValue<int>(1);
- int y = state.CheckValue<int>(2);
- Window::Get()->SetPosition(x, y);
- return 0;
- }
-
- // Window.SetTitle(title)
- LUAX_IMPL_METHOD(Window, _SetTitle)
- {
- LUAX_PREPARE(L, Window);
- std::string title = state.CheckValue<string>(1);
- Window::Get()->SetTitle(title);
- return 0;
- }
-
- // Window.SetIcon(imageData)
- LUAX_IMPL_METHOD(Window, _SetIcon)
- {
- LUAX_PREPARE(L, Window);
- ImageData* imgData = state.CheckUserdata<ImageData>(1);
- imgData->Lock();
- Window::Get()->SetIcon(imgData);
- imgData->Unlock();
- return 0;
- }
-
- // Window.SwapRenderBuffer()
- LUAX_IMPL_METHOD(Window, _SwapRenderBuffer)
- {
- LUAX_PREPARE(L, Window);
- Window::Get()->SwapRenderBuffer();
- return 0;
- }
-
- // Window.Clear()
- LUAX_IMPL_METHOD(Window, _Clear)
- {
- LUAX_PREPARE(L, Window);
- Window::Get()->Clear();
- return 0;
- }
-
- // Window.Draw()
- LUAX_IMPL_METHOD(Window, _Draw)
- {
- LUAX_PREPARE(L, Window);
- return 0;
- }
-
- }
-} \ No newline at end of file