Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / DrawLine and percentage system

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 9th Nov 2020 16:23
Is there any way to draw a border using the DrawLine or the DrawBox commands under the percentage system?
It seems that drawing on point (100.0, 100.0) is problematic due to rounding issues.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 10th Nov 2020 23:07
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.



Hope that helps, and please forgive me in the case this wasn't the answer you was after.
????????
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 14th Nov 2020 14:43
Thank you Lupo4mica37 for your tips
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 14th Nov 2020 22:25
You are welcome george++. I just hope I did not disrespect your intelligence. When someone presents a problem, I just seek to solve it in the easiest most simple way (to me). In the case there is a better solution, I hope to learn from the other always, as long as there is concrete example to learn from. I am less than a programmer, so I am always greatful to learn from masters as yourself in whatever knowledge and experience you can help others and the community. Take care.
????????

Login to post a reply

Server time is: 2024-11-21 13:01:55
Your offset time is: 2024-11-21 13:01:55