08-07-2023, 07:55 PM
A method that I've used, which is relatively simple to implement, is use screen masking.
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.
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.
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.)
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.
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.)
2D physics engine https://github.com/mechatronic3000/fzxNGN
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool