@@ -722,8 +722,8 @@ static int l_RenderInit(lua_State* L)
722722static int l_GetScreenSize (lua_State* L)
723723{
724724 ui_main_c* ui = GetUIPtr (L);
725- lua_pushinteger (L, ui->renderer ->VirtualScreenWidth ());
726- lua_pushinteger (L, ui->renderer ->VirtualScreenHeight ());
725+ lua_pushinteger (L, ui->renderer ->VirtualMap (ui-> renderer -> VirtualScreenWidth () ));
726+ lua_pushinteger (L, ui->renderer ->VirtualMap (ui-> renderer -> VirtualScreenHeight () ));
727727 return 2 ;
728728}
729729
@@ -793,7 +793,7 @@ static int l_SetViewport(lua_State* L)
793793 ui->LAssert (L, ui->renderer != NULL , " Renderer is not initialised" );
794794 ui->LAssert (L, ui->renderEnable , " SetViewport() called outside of OnFrame" );
795795 int n = lua_gettop (L);
796- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
796+ const float dpiScale = ui->renderer ->APICoordScale ();
797797 if (n) {
798798 ui->LAssert (L, n >= 4 , " Usage: SetViewport([x, y, width, height])" );
799799 for (int i = 1 ; i <= 4 ; i++) {
@@ -935,7 +935,7 @@ static int l_DrawImage(lua_State* L)
935935 }
936936
937937 if (af & AF_XY ) {
938- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
938+ const float dpiScale = ui->renderer ->APICoordScale ();
939939 for (int i = k; i < k + 4 ; i++) {
940940 int isNum;
941941 lua_Number val = lua_tonumberx (L, i, &isNum);
@@ -1054,7 +1054,7 @@ static int l_DrawImageQuad(lua_State* L)
10541054 }
10551055
10561056 if (af & AF_XY ) {
1057- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1057+ const float dpiScale = ui->renderer ->APICoordScale ();
10581058 for (int i = k; i < k + 8 ; i++) {
10591059 int isNum;
10601060 lua_Number val = lua_tonumberx (L, i, &isNum);
@@ -1144,7 +1144,7 @@ static int l_DrawString(lua_State* L)
11441144 ui->LAssert (L, lua_isstring (L, 6 ), " DrawString() argument 6: expected string, got %s" , luaL_typename (L, 6 ));
11451145 static const char * alignMap[6 ] = { " LEFT" , " CENTER" , " RIGHT" , " CENTER_X" , " RIGHT_X" , NULL };
11461146 static const char * fontMap[8 ] = { " FIXED" , " VAR" , " VAR BOLD" , " FONTIN SC" , " FONTIN SC ITALIC" , " FONTIN" , " FONTIN ITALIC" , NULL };
1147- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1147+ const float dpiScale = ui->renderer ->APICoordScale ();
11481148 const float left = lua_tonumber (L, 1 ) * dpiScale;
11491149 const float top = lua_tonumber (L, 2 ) * dpiScale;
11501150 const lua_Number logicalHeight = lua_tonumber (L, 4 );
@@ -1186,7 +1186,7 @@ static int l_DrawStringWidth(lua_State* L)
11861186 ui->LAssert (L, lua_isstring (L, 2 ), " DrawStringWidth() argument 2: expected string, got %s" , luaL_typename (L, 2 ));
11871187 ui->LAssert (L, lua_isstring (L, 3 ), " DrawStringWidth() argument 3: expected string, got %s" , luaL_typename (L, 3 ));
11881188 static const char * fontMap[8 ] = { " FIXED" , " VAR" , " VAR BOLD" , " FONTIN SC" , " FONTIN SC ITALIC" , " FONTIN" , " FONTIN ITALIC" , NULL };
1189- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1189+ const float dpiScale = ui->renderer ->APICoordScale ();
11901190 const lua_Number logicalHeight = lua_tonumber (L, 1 );
11911191 int scaledHeight = static_cast <int >(std::lround (logicalHeight * dpiScale));
11921192 if (scaledHeight <= 1 ) {
@@ -1208,7 +1208,7 @@ static int l_DrawStringCursorIndex(lua_State* L)
12081208 ui_main_c* ui = GetUIPtr (L);
12091209 ui->LAssert (L, ui->renderer != NULL , " Renderer is not initialised" );
12101210 int n = lua_gettop (L);
1211- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1211+ const float dpiScale = ui->renderer ->APICoordScale ();
12121212 ui->LAssert (L, n >= 5 , " Usage: DrawStringCursorIndex(height, font, text, cursorX, cursorY)" );
12131213 ui->LAssert (L, lua_isnumber (L, 1 ), " DrawStringCursorIndex() argument 1: expected number, got %s" , luaL_typename (L, 1 ));
12141214 ui->LAssert (L, lua_isstring (L, 2 ), " DrawStringCursorIndex() argument 2: expected string, got %s" , luaL_typename (L, 2 ));
@@ -1534,17 +1534,16 @@ static int l_SetWindowTitle(lua_State* L)
15341534static int l_GetCursorPos (lua_State* L)
15351535{
15361536 ui_main_c* ui = GetUIPtr (L);
1537- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1538- lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorX ) / dpiScale));
1539- lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorY ) / dpiScale));
1537+ lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorX )));
1538+ lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorY )));
15401539 return 2 ;
15411540}
15421541
15431542static int l_SetCursorPos (lua_State* L)
15441543{
15451544 ui_main_c* ui = GetUIPtr (L);
15461545 int n = lua_gettop (L);
1547- const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1546+ const float dpiScale = ui->renderer ->APICoordScale ();
15481547 ui->LAssert (L, n >= 2 , " Usage: SetCursorPos(x, y)" );
15491548 ui->LAssert (L, lua_isnumber (L, 1 ), " SetCursorPos() argument 1: expected number, got %s" , luaL_typename (L, 1 ));
15501549 ui->LAssert (L, lua_isnumber (L, 2 ), " SetCursorPos() argument 2: expected number, got %s" , luaL_typename (L, 2 ));
0 commit comments