mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
[lua] Add width and height properties to app
This commit is contained in:
parent
30b858d89e
commit
7ee866643b
@ -37,6 +37,7 @@
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/tool_loop_impl.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/replace_string.h"
|
||||
@ -700,6 +701,28 @@ int App_get_defaultPalette(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int App_get_width(lua_State* L)
|
||||
{
|
||||
#if ENABLE_UI
|
||||
App* app = App::instance();
|
||||
lua_pushinteger(L, app->mainWindow()->bounds().w);
|
||||
return 1;
|
||||
#endif
|
||||
lua_pushinteger(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int App_get_height(lua_State* L)
|
||||
{
|
||||
#if ENABLE_UI
|
||||
App* app = App::instance();
|
||||
lua_pushinteger(L, app->mainWindow()->bounds().h);
|
||||
return 1;
|
||||
#endif
|
||||
lua_pushinteger(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int App_set_sprite(lua_State* L)
|
||||
{
|
||||
auto sprite = may_get_docobj<Sprite>(L, 2);
|
||||
@ -814,6 +837,8 @@ const Property App_properties[] = {
|
||||
{ "range", App_get_range, nullptr },
|
||||
{ "isUIAvailable", App_get_isUIAvailable, nullptr },
|
||||
{ "defaultPalette", App_get_defaultPalette, App_set_defaultPalette },
|
||||
{ "width", App_get_width, nullptr },
|
||||
{ "height", App_get_height, nullptr },
|
||||
{ "events", App_get_events, nullptr },
|
||||
{ "theme", App_get_theme, nullptr },
|
||||
{ "uiScale", App_get_uiScale, nullptr },
|
||||
|
Loading…
x
Reference in New Issue
Block a user