Colour bars/Display: Difference between revisions
m
→{{header|Phix}}: simplified
m (Commodore BASIC: Converted program to lower case, which aids when copy-pasting into emulators.) |
m (→{{header|Phix}}: simplified) |
||
Line 1,338:
Ihandle dlg, canvas
cdCanvas
function redraw_cb(Ihandle /*ih*/, integer /*posx*/,
integer {width, height} = IupGetIntInt(canvas, "DRAWSIZE"),▼
cdCanvasActivate(cddbuffer)▼
▲ integer {width, height} = IupGetIntInt(canvas, "DRAWSIZE")
▲ integer x = 0, lc = length(colours)
for i=1 to lc do
integer w = floor((width-x)/(lc-i+1))
cdCanvasSetForeground(
cdCanvasBox(
x += w
end for
cdCanvasFlush(
return IUP_DEFAULT
end function
canvas = IupCanvas(Icallback("redraw_cb"),"RASTERSIZE=600x400") -- initial size
cdcanvas = cdCreateCanvas(CD_IUP, ih)▼
IupShow(dlg)
▲ IupOpen()
▲ dlg = IupDialog(canvas)
▲ IupMap(dlg)
▲ IupSetAttribute(canvas, "RASTERSIZE", NULL) -- release the minimum limitation
▲ IupMainLoop()
▲main()</lang>
=={{header|PHP}}==
|