blob: eb6a7796dbb524f2d9b67aba9354416b2ff71e6d (
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
|
#include "lua/luax.h"
#include "libjin/jin.h"
namespace jin
{
namespace lua
{
using namespace jin::input;
static int l_pos(lua_State* L)
{
static Mouse* mouse = Mouse::get();
int x, y;
mouse->getState(&x, &y);
luax_pushnumber(L, x);
luax_pushnumber(L, y);
return 2;
}
static const luaL_Reg f[] = {
{"position", l_pos},
{0, 0}
};
int luaopen_mouse(lua_State* L)
{
luax_newlib(L, f);
return 1;
}
}
}
|