08-08-2023, 12:07 AM
(08-07-2023, 07:55 PM)justsomeguy Wrote: A method that I've used, which is relatively simple to implement, is use screen masking.Clever!
You draw your menu or whatever on the first screen like normal.
Then you create an image the same size as your target screen. This will be the hidden overlay.
Code: (Select All)hiddenScreen = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
On the second screen (the hidden screen) you mask off the areas that you want the mouse to be sensitive to, and you assign specific colors to those areas.
And when you want check your mouse.Code: (Select All)myButton_1 = 1 ' Assign Numbers to masked off areas (colors)
myButton_2 = 2
_DEST hiddenScreen
LINE(10, 10) - (30 ,20), myButton_1, BF
LINE(50, 10) - (80 ,20), myButton_2, BF
_DEST 0
Code: (Select All)DO WHILE _MOUSEINPUT ' Check the mouse status
mx = _MOUSEX
my = _MOUSEY
LOOP
_SOURCE hiddenScreen
buttonTouched = POINT(mx ,my)
_SOURCE 0
I find this easier than making a large number of conditionals for my mouse position.
(Forgive me, I haven't tested this code, but it conveys the general idea.)
Sort of like an HTML Image map. (Map element). That's a good easy way to separate things too. If mouse is over hidden part will POINT() return 0 or ?
Really smart!