1 #include "core/lua-int.hpp"
2 #include "core/render.hpp"
6 struct render_object_text
: public render_object
8 render_object_text(int32_t _x
, int32_t _y
, const std::string
& _text
, premultiplied_color _fg
,
9 premultiplied_color _bg
, bool _hdbl
= false, bool _vdbl
= false) throw()
10 : x(_x
), y(_y
), text(_text
), fg(_fg
), bg(_bg
), hdbl(_hdbl
), vdbl(_vdbl
) {}
11 ~render_object_text() throw() {}
12 void operator()(struct screen
& scr
) throw()
16 render_text(scr
, x
, y
, text
, fg
, bg
, hdbl
, vdbl
);
21 premultiplied_color fg
;
22 premultiplied_color bg
;
28 int internal_gui_text(lua_State
* LS
, const std::string
& fname
, bool hdbl
, bool vdbl
)
32 int64_t fgc
= 0xFFFFFFU
;
34 int32_t _x
= get_numeric_argument
<int32_t>(LS
, 1, fname
.c_str());
35 int32_t _y
= get_numeric_argument
<int32_t>(LS
, 2, fname
.c_str());
36 get_numeric_argument
<int64_t>(LS
, 4, fgc
, fname
.c_str());
37 get_numeric_argument
<int64_t>(LS
, 5, bgc
, fname
.c_str());
38 std::string text
= get_string_argument(LS
, 3, fname
.c_str());
39 premultiplied_color
fg(fgc
);
40 premultiplied_color
bg(bgc
);
41 lua_render_ctx
->queue
->add(*new render_object_text(_x
, _y
, text
, fg
, bg
, hdbl
, vdbl
));
45 function_ptr_luafun
gui_text("gui.text", [](lua_State
* LS
, const std::string
& fname
) -> int {
46 internal_gui_text(LS
, fname
, false, false);
49 function_ptr_luafun
gui_textH("gui.textH", [](lua_State
* LS
, const std::string
& fname
) -> int {
50 internal_gui_text(LS
, fname
, true, false);
53 function_ptr_luafun
gui_textV("gui.textV", [](lua_State
* LS
, const std::string
& fname
) -> int {
54 internal_gui_text(LS
, fname
, false, true);
57 function_ptr_luafun
gui_textHV("gui.textHV", [](lua_State
* LS
, const std::string
& fname
) -> int {
58 internal_gui_text(LS
, fname
, true, true);