Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,70 @@
include ..\pGUI\pGUI.e
Ihandle dlg, canvas
cdCanvas cddbuffer, cdcanvas
function redraw_cb(Ihandle /*ih*/, integer /*posx*/, integer /*posy*/)
integer x,y,ox,oy
integer {width, height} = IupGetIntInt(canvas, "DRAWSIZE")
sequence grid = repeat(repeat(0,width),height)
integer xy = floor(width*height*0.8)
--atom t = time()+1
grid[floor(width/2)][floor(height/2)] = 1
cdCanvasActivate(cddbuffer)
cdCanvasClear(cddbuffer)
for i=1 to xy do
x = rand(width) y = rand(height)
ox = x oy = y
while x>=1 and x<=width
and y>=1 and y<=height do
if grid[y][x] then
grid[oy][ox] = 1
cdCanvasPixel(cddbuffer, ox, oy, #00FF00)
exit
end if
ox = x x += rand(3)-2
oy = y y += rand(3)-2
end while
-- -- if making the canvas bigger/resizeable,
-- -- put this in so that you can kill it.
-- if time()>=t then
-- ?{i,xy}
-- t = time()+1
-- end if
end for
cdCanvasFlush(cddbuffer)
return IUP_DEFAULT
end function
function map_cb(Ihandle ih)
cdcanvas = cdCreateCanvas(CD_IUP, ih)
cddbuffer = cdCreateCanvas(CD_DBUFFER, cdcanvas)
cdCanvasSetBackground(cddbuffer, CD_WHITE)
cdCanvasSetForeground(cddbuffer, CD_RED)
return IUP_DEFAULT
end function
function esc_close(Ihandle /*ih*/, atom c)
if c=K_ESC then return IUP_CLOSE end if
return IUP_CONTINUE
end function
procedure main()
IupOpen("..\\pGUI\\")
canvas = IupCanvas(NULL)
IupSetAttribute(canvas, "RASTERSIZE", "200x200") -- fixed size
IupSetCallback(canvas, "MAP_CB", Icallback("map_cb"))
dlg = IupDialog(canvas, "RESIZE=NO")
IupSetAttribute(dlg, "TITLE", "Brownian Tree")
IupSetCallback(dlg, "K_ANY", Icallback("esc_close"))
IupSetCallback(canvas, "ACTION", Icallback("redraw_cb"))
IupMap(dlg)
IupShowXY(dlg,IUP_CENTER,IUP_CENTER)
IupMainLoop()
IupClose()
end procedure
main()