Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
43
Task/Window-creation/XPL0/window-creation.xpl0
Normal file
43
Task/Window-creation/XPL0/window-creation.xpl0
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
\12345678901234567890123456789012345
|
||||
\Window creation............... X .
|
||||
|
||||
def X0=20, Y0=10; \upper-left corner of window's position (chars)
|
||||
int Mouse, Button, C;
|
||||
|
||||
func GetButton; \Return soft button number at mouse pointer
|
||||
int X, Y;
|
||||
[Mouse:= GetMouse;
|
||||
X:= Mouse(0)/8 - X0; \convert pixels to char cells
|
||||
Y:= Mouse(1)/16 - Y0;
|
||||
if X>=32 & X<=34 & Y=0 then return 0; \exit [X]
|
||||
return -1; \mouse not on any soft button
|
||||
];
|
||||
|
||||
[SetVid($12); \640x480 graphics
|
||||
TrapC(true); \disable Ctrl+C
|
||||
Attrib($70); \black on gray
|
||||
SetWind(0+X0, 0+Y0, 35+X0, 8+Y0, 0, \fill\true);
|
||||
Cursor(33+X0, 0+Y0); Text(6, "X");
|
||||
|
||||
Attrib($1F); \bright white on blue, for title
|
||||
Cursor(0+X0, 0+Y0); Text(6, " Window creation ");
|
||||
|
||||
ShowMouse(true);
|
||||
loop [MoveMouse; \make pointer track mouse movements
|
||||
Mouse:= GetMouse;
|
||||
if Mouse(2) then \a left or right mouse button is down
|
||||
[Button:= GetButton; \get soft button at mouse pointer
|
||||
while Mouse(2) do \wait for mouse button's release
|
||||
[MoveMouse;
|
||||
Mouse:= GetMouse;
|
||||
];
|
||||
if Button = GetButton then \if down Button = release button
|
||||
if Button = 0 then quit;
|
||||
];
|
||||
if KeyHit then
|
||||
[C:= ChIn(1); \get character from non-echoed keyboard
|
||||
if C = \Esc\$1B then quit;
|
||||
];
|
||||
];
|
||||
SetVid(3); \restore normal text mode immediately
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue