@@ -1069,8 +1069,8 @@ static int l_DrawString(lua_State* L)
10691069 static const char * alignMap[6 ] = { " LEFT" , " CENTER" , " RIGHT" , " CENTER_X" , " RIGHT_X" , NULL };
10701070 static const char * fontMap[4 ] = { " FIXED" , " VAR" , " VAR BOLD" , NULL };
10711071 const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1072- const float left = ( float ) lua_tonumber (L, 1 ) * dpiScale;
1073- const float top = ( float ) lua_tonumber (L, 2 ) * dpiScale;
1072+ const float left = lua_tonumber (L, 1 ) * dpiScale;
1073+ const float top = lua_tonumber (L, 2 ) * dpiScale;
10741074 const int scaledHeight = (int )std::lround ((double )lua_tointeger (L, 4 ) * (double )dpiScale);
10751075 ui->renderer ->DrawString (
10761076 left,
@@ -1095,8 +1095,8 @@ static int l_DrawStringWidth(lua_State* L)
10951095 ui->LAssert (L, lua_isstring (L, 3 ), " DrawStringWidth() argument 3: expected string, got %s" , luaL_typename (L, 3 ));
10961096 static const char * fontMap[4 ] = { " FIXED" , " VAR" , " VAR BOLD" , NULL };
10971097 const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1098- const double logicalHeight = lua_tonumber (L, 1 );
1099- const int scaledHeight = (int )std::lround (logicalHeight * dpiScale);
1098+ const lua_Number logicalHeight = lua_tonumber (L, 1 );
1099+ int scaledHeight = (int )std::lround (logicalHeight * dpiScale);
11001100 double const physicalWidth = (double )ui->renderer ->DrawStringWidth (
11011101 scaledHeight,
11021102 luaL_checkoption (L, 2 , " FIXED" , fontMap),
@@ -1118,9 +1118,9 @@ static int l_DrawStringCursorIndex(lua_State* L)
11181118 ui->LAssert (L, lua_isnumber (L, 4 ), " DrawStringCursorIndex() argument 4: expected number, got %s" , luaL_typename (L, 4 ));
11191119 ui->LAssert (L, lua_isnumber (L, 5 ), " DrawStringCursorIndex() argument 5: expected number, got %s" , luaL_typename (L, 5 ));
11201120 static const char * fontMap[4 ] = { " FIXED" , " VAR" , " VAR BOLD" , NULL };
1121- const double logicalHeight = lua_tonumber (L, 1 );
1122- const double logicalCursorX = lua_tonumber (L, 4 );
1123- const double logicalCursorY = lua_tonumber (L, 5 );
1121+ const lua_Number logicalHeight = lua_tonumber (L, 1 );
1122+ const lua_Number logicalCursorX = lua_tonumber (L, 4 );
1123+ const lua_Number logicalCursorY = lua_tonumber (L, 5 );
11241124 const int scaledHeight = (int )std::lround (logicalHeight * dpiScale);
11251125 const int scaledCursorX = (int )std::lround (logicalCursorX * dpiScale);
11261126 const int scaledCursorY = (int )std::lround (logicalCursorY * dpiScale);
@@ -1431,8 +1431,8 @@ static int l_GetCursorPos(lua_State* L)
14311431{
14321432 ui_main_c* ui = GetUIPtr (L);
14331433 const float dpiScale = ui->renderer ->VirtualScreenScaleFactor ();
1434- lua_pushinteger (L, (lua_Integer)std::lround (( double ) ui->renderer ->VirtualMap (ui->cursorX ) / ( double ) dpiScale));
1435- lua_pushinteger (L, (lua_Integer)std::lround (( double ) ui->renderer ->VirtualMap (ui->cursorY ) / ( double ) dpiScale));
1434+ lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorX ) / dpiScale));
1435+ lua_pushinteger (L, (lua_Integer)std::lround (ui->renderer ->VirtualMap (ui->cursorY ) / dpiScale));
14361436 return 2 ;
14371437}
14381438
@@ -1444,8 +1444,8 @@ static int l_SetCursorPos(lua_State* L)
14441444 ui->LAssert (L, n >= 2 , " Usage: SetCursorPos(x, y)" );
14451445 ui->LAssert (L, lua_isnumber (L, 1 ), " SetCursorPos() argument 1: expected number, got %s" , luaL_typename (L, 1 ));
14461446 ui->LAssert (L, lua_isnumber (L, 2 ), " SetCursorPos() argument 2: expected number, got %s" , luaL_typename (L, 2 ));
1447- const int scaledX = (int )std::lround (( double ) lua_tointeger ( L, 1 ) * ( double ) dpiScale);
1448- const int scaledY = (int )std::lround (( double ) lua_tointeger ( L, 2 ) * ( double ) dpiScale);
1447+ const int scaledX = (int )std::lround (lua_tonumber ( L, 1 ) * dpiScale);
1448+ const int scaledY = (int )std::lround (lua_tonumber ( L, 2 ) * dpiScale);
14491449 int x = ui->renderer ->VirtualUnmap (scaledX);
14501450 int y = ui->renderer ->VirtualUnmap (scaledY);
14511451 ui->sys ->video ->SetRelativeCursor (x, y);
0 commit comments