summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/GUI/GUI.bind.cpp
blob: a4ee7727bc64ef89b46ff139fa158999e40db493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Runtime/Lua/LuaHelper.h"
#include "Runtime/Debug/Log.h"
#include "Runtime/Common/DataBuffer.h"
#include "Runtime/FileSystem/FileJobs.h"
#include "Runtime/GUI/Font.h"
#include "Runtime/GUI/UITextMesh.h"

using namespace std;
using namespace LuaBind;

int luaopen_GameLab_Engine_GUI(lua_State* L)
{
    log_info_tag("Scripting", "luaopen_GameLab_Engine_GUI()");

    LUA_BIND_STATE(L);

    state.PushGlobalNamespace();
    state.PushNamespace("GameLab");
    state.PushNamespace("Engine");
    state.PushNamespace("GUI");

    state.RegisterNativeClass<Font>();

    LUA_BIND_REGISTER_ENUM(state, "EEncoding",
        { "ASCII", Encoding_ASCII },
        { "UTF8",  Encoding_UTF8  },
        { "UTF16", Encoding_UTF16 }
    );

    LUA_BIND_REGISTER_ENUM(state, "ETextAnchor",
        { "UpperLeft",    TextAnchor_UpperLeft    },
        { "UpperCenter",  TextAnchor_UpperCenter  },
        { "UpperRight",   TextAnchor_UpperRight   },
        { "MiddleLeft",   TextAnchor_MiddleLeft   },
        { "MiddleCenter", TextAnchor_MiddleCenter },
        { "MiddleRight",  TextAnchor_MiddleRight  },
        { "LowerLeft",    TextAnchor_LowerLeft    },
        { "LowerCenter",  TextAnchor_LowerCenter  },
        { "LowerRight",   TextAnchor_LowerRight   }
    );

    LUA_BIND_REGISTER_ENUM(state, "ETextAlignment",
        { "Left",   TextAlignment_Left   },
        { "Center", TextAlignment_Center },
        { "Right",  TextAlignment_Right  }
    );

    return 1;
}