Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
79
Task/Mouse-position/ERRE/mouse-position.erre
Normal file
79
Task/Mouse-position/ERRE/mouse-position.erre
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
!
|
||||
! MOUSE WITH 'MOUSE.LIB' LIBRARY
|
||||
!
|
||||
|
||||
PROGRAM MOUSE
|
||||
|
||||
!$KEY
|
||||
|
||||
!$INCLUDE="PC.LIB"
|
||||
|
||||
!$INCLUDE="MOUSE.LIB"
|
||||
|
||||
PROCEDURE GETMONITORTYPE(->MONITOR$)
|
||||
!$RCODE="DEF SEG=0"
|
||||
STATUS=PEEK($463)
|
||||
!$RCODE="DEF SEG"
|
||||
MONITOR$=""
|
||||
IF STATUS=$B4 THEN
|
||||
!$RCODE="STATUS=(INP(&H3BA) AND &H80)"
|
||||
FOR DELAYLOOP=1 TO 30000 DO
|
||||
!$RCODE="XX=((INP(&H3BA) AND &H80)<>STATUS)"
|
||||
IF XX THEN MONITOR$="HERC" END IF
|
||||
END FOR
|
||||
IF MONITOR$="" THEN MONITOR$="MONO" END IF
|
||||
ELSE
|
||||
REGAX%=$1A00
|
||||
EXECUTEASM($10)
|
||||
IF (REGAX% AND $FF)=$1A THEN
|
||||
MONITOR$="VGA"
|
||||
ELSE
|
||||
REGAX%=$1200 REGBX%=$10
|
||||
EXECUTEASM($10)
|
||||
IF (REGBX% AND $FF)=$10 THEN
|
||||
MONITOR$="CGA"
|
||||
ELSE
|
||||
MONITOR$="EGA"
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
END PROCEDURE
|
||||
|
||||
BEGIN
|
||||
INITASM
|
||||
GETMONITORTYPE(->MONITOR$)
|
||||
COLOR(7,0)
|
||||
CLS
|
||||
LOCATE(1,50) PRINT("MONITOR TYPE ";MONITOR$)
|
||||
MOUSE_RESETANDSTATUS(->STATUS,BUTTONS)
|
||||
IF STATUS<>-1 THEN
|
||||
BEEP
|
||||
CLS
|
||||
PRINT("MOUSE DRIVER NOT INSTALLED OR MOUSE NOT FOUND")
|
||||
REPEAT
|
||||
GET(IN$)
|
||||
UNTIL IN$<>""
|
||||
ELSE
|
||||
MOUSE_SETEXTCURSOR
|
||||
MOUSE_SETCURSORLIMITS(8,199,0,639)
|
||||
MOUSE_SETSENSITIVITY(30,30,50)
|
||||
MOUSE_SHOWCURSOR
|
||||
REPEAT
|
||||
OLDX=X OLDY=Y
|
||||
MOUSE_GETCURSORPOSITION(->X,Y,LEFT%,RIGHT%,BOTH%,MIDDLE%)
|
||||
GET(IN$)
|
||||
COLOR(15,0)
|
||||
LOCATE(1,2)
|
||||
PRINT("X =";INT(X/8)+1;" Y =";INT(Y/8)+1;" ";)
|
||||
IF LEFT% THEN LOCATE(1,37) COLOR(10,0) PRINT("LEFT";) END IF
|
||||
IF RIGHT% THEN LOCATE(1,37) COLOR(12,0) PRINT("RIGHT";) END IF
|
||||
IF MIDDLE% THEN LOCATE(1,37) COLOR(14,0) PRINT("MIDDLE";) END IF
|
||||
IF NOT RIGHT% AND NOT LEFT% AND NOT MIDDLE% THEN
|
||||
LOCATE(1,37) PRINT(" ";)
|
||||
END IF
|
||||
IF NOT (X=OLDX AND Y=OLDY) THEN MOUSE_SHOWCURSOR END IF
|
||||
UNTIL IN$=CHR$(27)
|
||||
END IF
|
||||
MOUSE_HIDECURSOR
|
||||
CLS
|
||||
END PROGRAM
|
||||
7
Task/Mouse-position/EchoLisp/mouse-position.echolisp
Normal file
7
Task/Mouse-position/EchoLisp/mouse-position.echolisp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(lib 'plot)
|
||||
(plot-x-minmax 10) ; set logical dimensions of plotting area
|
||||
(plot-y-minmax 100)
|
||||
→ (("x" 0 10) ("y" 0 100))
|
||||
;; press ESC to see the canvas
|
||||
;; the mouse position is displayed as , for example, [ x: 5.6 y : 88.7]
|
||||
;; 0 <= x <= 10, 0 <= y <= 100
|
||||
7
Task/Mouse-position/Elm/mouse-position.elm
Normal file
7
Task/Mouse-position/Elm/mouse-position.elm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import Graphics.Element exposing (Element, show)
|
||||
import Mouse
|
||||
|
||||
|
||||
main : Signal Element
|
||||
main =
|
||||
Signal.map show Mouse.position
|
||||
2
Task/Mouse-position/Lingo/mouse-position.lingo
Normal file
2
Task/Mouse-position/Lingo/mouse-position.lingo
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
put _mouse.mouseLoc
|
||||
-- point(310, 199)
|
||||
62
Task/Mouse-position/Ring/mouse-position.ring
Normal file
62
Task/Mouse-position/Ring/mouse-position.ring
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
Load "guilib.ring"
|
||||
|
||||
lPress = false
|
||||
nX = 0
|
||||
nY = 0
|
||||
|
||||
new qApp {
|
||||
|
||||
win1 = new qWidget()
|
||||
{
|
||||
|
||||
setWindowTitle("Move this label!")
|
||||
setGeometry(100,100,400,400)
|
||||
setstylesheet("background-color:white;")
|
||||
|
||||
Label1 = new qLabel(Win1){
|
||||
setGeometry(100,100,200,50)
|
||||
setText("Welcome")
|
||||
setstylesheet("font-size: 30pt")
|
||||
myfilter = new qallevents(label1)
|
||||
myfilter.setEnterevent("pEnter()")
|
||||
myfilter.setLeaveevent("pLeave()")
|
||||
myfilter.setMouseButtonPressEvent("pPress()")
|
||||
myfilter.setMouseButtonReleaseEvent("pRelease()") myfilter.setMouseMoveEvent("pMove()")
|
||||
installeventfilter(myfilter)
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
|
||||
exec()
|
||||
}
|
||||
|
||||
Func pEnter
|
||||
Label1.setStyleSheet("background-color: purple; color:white;font-size: 30pt;")
|
||||
|
||||
Func pLeave
|
||||
Label1.setStyleSheet("background-color: white; color:black;font-size: 30pt;")
|
||||
|
||||
Func pPress
|
||||
lPress = True
|
||||
nX = myfilter.getglobalx()
|
||||
ny = myfilter.getglobaly()
|
||||
|
||||
Func pRelease
|
||||
lPress = False
|
||||
pEnter()
|
||||
|
||||
Func pMove
|
||||
nX2 = myfilter.getglobalx()
|
||||
ny2 = myfilter.getglobaly()
|
||||
ndiffx = nX2 - nX
|
||||
ndiffy = nY2 - nY
|
||||
if lPress
|
||||
Label1 {
|
||||
move(x()+ndiffx,y()+ndiffy)
|
||||
setStyleSheet("background-color: Green;
|
||||
color:white;font-size: 30pt;")
|
||||
nX = nX2
|
||||
ny = nY2
|
||||
}
|
||||
ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue