Hi george++.
I reason you can rearrange the formula for percentage.
So, to get percentage of point 1 x and x being 500, and width being 1024 the equation is:
500/1024 = 0.48828125
Now, you got your percentage, you got to rearrange the formula
Let's say you got 0.33 and x is your unknown
x/1024 = 0.33 // multiply both sides by 1024
x/1024 * 1024 = 0.33 * 1024 // on the left of the equation, the 1024 cancel out to give 1
x = 0.33 * 1024
x = 338
Forgive me in the case you already new that and you was asking for something else. Obviously, with integer pixel values they will be to rounded up or down, whichever the case.
// Project: Test
// Created: 2020-11-10
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Test" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
r = 255
g = 0
b = 0
c = MakeColor(r,g,b)
x1 = 500
y1 = 200
x2 = 800
y2 = 500
x1f# = x1/1024.0
y1f# = y1/768.0
x2f# = x2/1024.0
y2f# = y2/768.0
x1a = x1f# * 1024
y1a = y1f# * 768
x2a = x2f# * 1024
y2a = y2f# * 768
do
Print("Top Left Point x of width = "+str(x1f#*100)+"% - coordinate x = "+str(x1a))
Print("Top Left Point y of width = "+str(y1f#*100)+"% - coordinate x = "+str(y1a))
Print("Bottom Right Point x of height = "+str(x2f#*100)+"% - coordinate x = "+str(x2a))
Print("Bottom Right Point y of height = "+str(y2f#*100)+"% - coordinate x = "+str(y2a))
DrawBox(x1a,y1a,x2a,y2a,c,c,c,c,0)
Print( ScreenFPS() )
Sync()
loop
Hope that helps, and please forgive me in the case this wasn't the answer you was after.
????????