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 DBPro Corner / Font size and mouseclick() question

Author
Message
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 5th Jul 2008 17:44
Now unfortunately I didn't excel in math... but I am curious to know if there is a way to calculate the X and Y positions of the mouse based on the size of text font? The point of this would of course be an easier method for calculating the click space for the MOUSECLICK() command.

I know that the code would have to include how much mouseX and mouseY would have to increase or decrease in pixel distance with the size of the font but- my blond hair- has left be bewildered.

Anyone know of or can think of a way to do so?

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
onkypokey
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location:
Posted: 14th Jul 2008 20:31
I'm not sure if I really catch your drift, but you'd like to let the mouse increase and decrease based on larger pixels?

A good practice would be this routine, if the pixels in your font are 5x5 pixels in size:



In this way, you'll get a 'quantized' x / y coordinate for your mouse position.
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 17th Jul 2008 08:48
Actually what I mean would include the text size, width, height and would be relative to the screen size (display mode) and mouseX, mouseY. Off the top of my head it would be something like:

SET DISPLAY MODE 1280,1024,32
MX=MOUSEX
MY=MOUSEY
CENTER TEXT 640,512,"woot!
--------------------------------------

Now I need to incorperate the size of the text, it's width and height and make them relative to the screen size as too- calculate how great or small the box around the text can be- to create a button. So we would need to include:

--------------------------------------
TS=Text Size
TW=Text Width
TH=Text Height
SW=Screen Width
SH=Screen Height
--------------------------------------

Now I need to come up with the math to make all of this come together. I need to create a formula that can be varying due to the screen size and font text size. I have no Idea how to do this but I imagine it would look something like this

---------------------------------------
SET DISPLAY MODE 1280,1024,32
MX=MOUSEX
MY=MOUSEY
TS=Text Size
TW=Text Width
TH=Text Height
SW=Screen Width
SH=Screen Height

CENTER TEXT 640,512,"woot!
---------------------------------------

What would the formula be?
I hope you understand me-

Daryn

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.

Login to post a reply

Server time is: 2024-11-25 22:03:39
Your offset time is: 2024-11-25 22:03:39