Hi guys, any comments would be helpful.
I have a screen carved up into different regions (279 of them). Visually a bit like Minesweeper. To determine which region the user has clicked in, I have always used groups of Ifs eg
If MouseX < 40 and MouseX > 20 then
If MouseY < 50 and MouseY > 30 then
Region = 1
Endif
If MouseY < 80 and MouseY > 60 then
Region = 2
Endif
Endif
If MouseX < 70 and MouseX > 50 then
If MouseY < 50 and MouseY > 30 then
Region = 3
Endif
If MouseY < 80 and MouseY > 60 then
Region = 4
Endif
Endif
...etc
Very laborious and ugly with 279 regions.
Is there a better way?
I could re-write it with Select / Case but that would be pretty much the same. (I also remember hearing somewhere that most compilers implement Cases as nested Ifs anyway.)
Cheers
Basil
I have a screen carved up into different regions (279 of them). Visually a bit like Minesweeper. To determine which region the user has clicked in, I have always used groups of Ifs eg
If MouseX < 40 and MouseX > 20 then
If MouseY < 50 and MouseY > 30 then
Region = 1
Endif
If MouseY < 80 and MouseY > 60 then
Region = 2
Endif
Endif
If MouseX < 70 and MouseX > 50 then
If MouseY < 50 and MouseY > 30 then
Region = 3
Endif
If MouseY < 80 and MouseY > 60 then
Region = 4
Endif
Endif
...etc
Very laborious and ugly with 279 regions.
Is there a better way?
I could re-write it with Select / Case but that would be pretty much the same. (I also remember hearing somewhere that most compilers implement Cases as nested Ifs anyway.)
Cheers
Basil