Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use stdio as io
- const SIZE = 20
- # Saisie
- io.write("Saisie (ex : 3E 7F FC F8 F8 FC 7F 3E) : ")
- drawing = io.read().upperCase()
- # Valeur par défaut
- if drawing.length <> 23 {
- drawing = "3E 7F FC F8 F8 FC 7F 3E"
- }
- new_drawing = [ "" for i from 0 to 8 ]
- y = 0
- for i from 1 to drawing.length {
- chr = drawing[i]
- new_drawing[y].add(switch chr {
- when "0" { "0000" }
- when "1" { "0001" }
- when "2" { "0010" }
- when "3" { "0011" }
- when "4" { "0100" }
- when "5" { "0101" }
- when "6" { "0110" }
- when "7" { "0111" }
- when "8" { "1000" }
- when "9" { "1001" }
- when "A" { "1010" }
- when "B" { "1011" }
- when "C" { "1100" }
- when "D" { "1101" }
- when "E" { "1110" }
- when "F" { "1111" }
- })
- }
- # Simplifié volontairement
- # title, width, height
- win = new Window("Rendu graphique", SIZE * 8, SIZE * 8)
- # x, y, width, height
- can = new Canvas(0, 0, SIZE * 8, SIZE * 8)
- can.set_fill_color(0, 0, 0)
- for y from 0 to 7 {
- for x from 0 to 7 {
- if new_drawing[y][x] == "1" {
- can.fill_rect(x * SIZE, y * SIZE, SIZE, SIZE)
- }
- }
- }
- win.add(can)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement