Wheel IDE

Online demo »

Screen, lines

Line example

This example shows how draw black and white lines.

Code

#project "Screen line example"

#include "lib/modules/standard.whl"
#include "lib/modules/device.whl"
#include "lib/modules/screen.whl"

#display "EV3"

proc main()
    ; Select the EV3 device in the simulator...
    selectDevice(DEVICE_EV3)

    ; Fill half the screen black...
    setFill(TRUE)
    setFillColor(BLACK)
    drawRect(0, 0, 89, 128)

    number y

    ; Daw white lines from the center of the screen to the left side...
    setFillColor(WHITE)
    for y = 0 to 128 step 8
        drawLine(0, y, 89, 64)
    end

    ; Daw black lines from the center of the screen to the right side...
    setFillColor(BLACK)
    for y = 0 to 128 step 8
        drawLine(177, y, 90, 64)
    end

    updateScreen()

    ; Wait...
    halt()
end

Screenshot

See also: Modules