Huge math problem.
#1

Hey, long time no see.

Since math isn't my strong side I really hope you guys can help me.

So I got a plugin which gets my screen resolution and cursor position and they do work fine for just outputing what they are created for. My problem is that I'm trying to detect if I have my cursor over a textdraw and since textdraw's are based on the 640x480 canvas how would I calculate the correct position for my cursor?

Let's make a simple example:
Textdraw Position: X: 90.0, Y: 120.0 (based on 640x480)
My cursor position at the same place: X: 300.0, Y: 55.0 (based on my resolution)
(Note: This is not any correct numbers that I used, just an example)

So how would I calculate to get my cursor position to be the same as the textdraw?

I really hope you get what I'm talking about haha.
Reply
#2

scale_x = resolution_x/640
scale_y = resolution_y/480

coord_x(90) = 90*scale_x
coord_y(120) = 120*scale_y
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)