08-07-2023, 03:51 AM
(This post was last modified: 08-07-2023, 03:55 AM by mnrvovrfc.
Edit Reason: Fixed a typographical mistake.
)
Some code aids could help for that double-dimensional array like so:
then one of the sections to initialize could be written like this:
Taking this further, it could be changed so it could respond to right mouse button instead of the left, or a different mouse button. But most people have three-button devices (including pressing down on mouse wheel).
This example could also be modified so that specific buttons are drawn on the screen and the program responds differently to one or the other being touched with the left mouse button. Use the "mousesector" information to draw the bounding box of the button on display.
EDIT: Sorry, had to completely rewrite it, it was more confusing. I wanted to use "TOPLEFT", "TOPRIGHT", "BOTLEFT", "BOTRIGHT" but it would have required pairs of coordinates rather than just X or Y for one point of the bounding rectangle.
Code: (Select All)
CONST XTOPLEFT = 1, YTOPLEFT = 2, XBOTRIGHT = 3, YBOTRIGHT = 4, WHICHOPT = 5
then one of the sections to initialize could be written like this:
Code: (Select All)
mousesector(2, XTOPLEFT) = 321 'xi
mousesector(2, YTOPLEFT) = 1 'yi
mousesector(2, XBOTRIGHT) = 639 'xf
mousesector(2, YBOTRIGHT) = 480 'yf
mousesector(2, WHICHOPT) = 2 'option selected
Taking this further, it could be changed so it could respond to right mouse button instead of the left, or a different mouse button. But most people have three-button devices (including pressing down on mouse wheel).
This example could also be modified so that specific buttons are drawn on the screen and the program responds differently to one or the other being touched with the left mouse button. Use the "mousesector" information to draw the bounding box of the button on display.
EDIT: Sorry, had to completely rewrite it, it was more confusing. I wanted to use "TOPLEFT", "TOPRIGHT", "BOTLEFT", "BOTRIGHT" but it would have required pairs of coordinates rather than just X or Y for one point of the bounding rectangle.