Color of a screen pixel: Difference between revisions
Content deleted Content added
Puppydrum64 (talk | contribs) |
Added solution for Action! |
||
Line 22:
The color is returned in AL.
=={{header|Action!}}==
<lang Action!>PROC Main()
BYTE POINTER ptr
BYTE
w=[160],h=[160],x=[0],y=[0],c,k,update=[1],
CH=$02FC ;Internal hardware value for last key pressed
CARD size=[6400],i
Graphics(15) ;Graphics 160x160 with 4 colors with text window
ptr=PeekC(88)
; Fill screen with random colors
FOR i=1 TO size
DO
ptr^=Rand(0)
ptr==+1
OD
PrintE("Use arrow keys to change position and Esc to exit.")
DO
IF update THEN
c=Locate(x,y)
PrintF("x=%B y=%B c=%B%E",x,y,c)
FI
k=CH
CH=$FF
update=1
IF k=134 THEN
IF x=0 THEN x=w-1
ELSE x==-1 FI
ELSEIF k=135 THEN
IF x=w-1 THEN x=0
ELSE x==+1 FI
ELSEIF k=142 THEN
IF y=0 THEN y=h-1
ELSE y==-1 FI
ELSEIF k=143 THEN
IF y=h-1 THEN y=0
ELSE y==+1 FI
ELSEIF k=28 THEN
EXIT
ELSE
update=0
FI
OD
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Color_of_a_screen_pixel.png Screenshot from Atari 8-bit computer]
=={{header|AutoHotkey}}==
|