_TITLE "multiple entities on the screen NOT overlapping" 'this is a little example of the 1st different concepts to manage
'multiple entities on the screen (or in the program but
' not visible like a timer or a counter)
'
'IMHO when we go to think as objects or entities to use in our programs we have two option...
'1. centered managing of mouse and keyboard and other input ways ,
' so we can think about it like a pyramid that has like apex the I/O routine to be directed to the right entity at bottom,
' or like a collection of areas to be activated by a flag (in Windows there are the messages among objects)
'2. a plane or circular managing of I/O in which the objects/entities have the own different action that is activated by the specific
' position of the mouse and by the specific comboKey
'
'the substantial difference between them is that in the first the apex
'manages I/O and triggers entity's action, in the second there is a main
'loop in which each entity tests if position of mouse
'and combokey activate its action/s.
'
textBase$ = "This is a try to show different" ' 30 chars
' graphic output/interface--------------------------------
LINE (1, 1)-(799, 599), Green
, B
MakeScreen textBase$
_PRINTSTRING (100, 520), " Press from 1 to 10 for activate the button or left click on it" ' End graphic interface-----------------------------------
'main
'the events of the main are managed here
K$ = "Null"
ActivateButtons zz
TakeInput
' here it analyzes input taken
' keyboard input event
EventButton Index
' mouse input event
IF Buttons
(Index
).x
<= mX
AND Buttons
(Index
).x
+ Buttons
(Index
).W
>= mX
THEN IF Buttons
(Index
).y
<= mY
AND Buttons
(Index
).y
+ Buttons
(Index
).H
>= mY
THEN EventButton Index
mB = 0 ' we need to read new status of mousebuttons
DrawButton Buttons
(Index
).x
, Buttons
(Index
).y
, RTRIM$(Buttons
(Index
).T
), Green
, Black
DrawButton Buttons
(Index
).x
, Buttons
(Index
).y
, RTRIM$(Buttons
(Index
).T
), Red
, Blu
InitButtons X, Y, txt
DrawButton X, Y, txt, Bcolor, Fcolor
LINE (X
, Y
)-(X
+ (Widht
* LEN(txt
)) + 10, Y
+ Height
+ 10), Bcolor
, BF
LINE (X
, Y
)-(X
+ (Widht
* LEN(txt
)) + 10, Y
+ Height
+ 10), White
, B
Buttons(z).x = X
Buttons(z).y = Y
Buttons(z).T = T
Buttons(z).H = Height
Buttons
(z
).W
= Widht
* LEN(Buttons
(z
).T
)
' it controls the keyboard and mouse if it is not done
K$ = "Null"
__MouseClear