View difference between Paste ID: MsKHUccS and Zr4LawfB
SHOW: | | - or go back to the newest paste.
1
-- Musicator MAIN
2
-- Created with <3 by FoxWorn3365
3
4
-- Initial values
5
notes = {}
6
clickAssociation = {}
7
page = "home"
8
termx, termy = term.getSize()
9
notes["do_min"] = "261.64"
10
notes["re"] = "293.68"
11
notes["mi"] = "329.64"
12
notes["fa"] = "349.24"
13
notes["sol"] = "392.00"
14
notes["la"] = "440.00"
15
notes["si"] = "493.92"
16
notes["do_max"] = "523.28"
17
18
-- Functions
19
function reset()
20
  term.setBackgroundColor(colors.white)
21
  term.setTextColor(colors.black)
22
  term.clear()
23
  term.setCursorPos(1, 1)
24
end
25
26
function drawHead(text) 
27
  term.setTextColor(colors.white)
28
  paintutils.drawLine(1, 1, termx, 1, colors.lightBlue)
29
  local position = (termx - #text)/2
30
  term.setCursorPos(position, 1)
31
  print(text)
32
  normalize()
33
end
34
35
function notesMenu() 
36
  term.setTextColor(colors.white)
37
  local isColored = false
38
  local used = 8
39
  paintutils.drawLine(1, 2, termx, 2, colors.lightGray)
40
  for index, value in ipairs(notes) do
41
    if isColored == false then
42
      term.setBackgroundColor(colors.lightGray)
43
      isColored = true
44
    else
45-
    -- notesMenu()
45+
      term.setBackgroundColor(colors.gray)
46
      isColored = false
47
    end
48
    term.setCursorPos(used, " "..index.." ")
49
    local endused = used + (#index + 2)
50
    for i=used, used+(#index + 2) do
51
      clickAssociation[i] = index
52
    end
53
    used = endused
54
  end
55
  normalize()
56
end
57
58
function normalize() 
59
  term.setBackgroundColor(colors.white)
60
  term.setTextColor(colors.black)
61
end
62
63
function
64
while true do
65
  if page == "home" then
66
    reset()
67
    drawHead("Musicator v1.0 - Make your Music!")
68
    notesMenu()
69
    os.pullEvent("mouse_click")
70
  end
71
end