There's going to be a teach mode and a learn mode. I considered making them separate apps, but this seems more manageable before someone cares about hacking on the code.
So far I'm mostly just setting up the screen for teach mode. I'm assuming the edit boxes for each word need not support more than one line. Also not bothering to handle line-wrapping.
I should make 'new word' a real button. But it's possible I'll never need another.
OYKTFGBR3B5I6QZRGP5XWQ5OU5JXBC5HXPTJPJZOA5AN3P35IRQQC
learn_key_release = function(key, scancode)
end
{"teach_text_input":49,"learn_mouse_press":57,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"learn_key_release":61,"on.text_input":54,"learn_text_input":60,"draw_learn_screen":4,"learn_keychord_press":59,"on.draw":5,"learn_mouse_release":58,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":60,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
learn_text_input = function(t)
end
{"teach_text_input":49,"learn_mouse_press":57,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"on.text_input":54,"learn_text_input":60,"draw_learn_screen":4,"learn_keychord_press":59,"on.draw":5,"learn_mouse_release":58,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":59,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
learn_keychord_press = function(chord, key)
end
{"teach_text_input":49,"learn_mouse_press":57,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"on.text_input":54,"draw_learn_screen":4,"learn_keychord_press":59,"on.draw":5,"learn_mouse_release":58,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":58,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
learn_mouse_release = function(x,y, mouse_button)
end
{"teach_text_input":49,"learn_mouse_press":57,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"on.text_input":54,"draw_learn_screen":4,"on.draw":5,"learn_mouse_release":58,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":57,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
learn_mouse_press = function(x,y, mouse_button)
end
{"teach_text_input":49,"learn_mouse_press":57,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"on.text_input":54,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":56,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
teach_key_release = function(key, scancode)
if Cursor_word then
edit.key_release(Cursor_word, key, scancode)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":56,"on.key_release":55,"on.text_input":54,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":55,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.key_release = function(key, scancode)
if Mode == 'teach' then
teach_key_release(key, scancode)
else
learn_key_release(key, scancode)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":48,"on.key_release":55,"on.text_input":54,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":54,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.text_input = function(t)
if Mode == 'teach' then
teach_text_input(t)
else
learn_text_input(t)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":48,"on.key_release":22,"on.text_input":54,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":53,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.keychord_press = function(chord, key)
if Mode == 'teach' then
teach_keychord_press(chord, key)
else
learn_keychord_press(chord, key)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":53,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":52,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.mouse_release = function(x,y, mouse_button)
if Mode == 'teach' then
teach_mouse_release(x,y, mouse_button)
else
learn_mouse_release(x,y, mouse_button)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":52,"draw_teach_word":41,"on.keychord_press":38,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":51,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.mouse_press = function(x,y, mouse_button)
if Mode == 'teach' then
teach_mouse_press(x,y, mouse_button)
else
learn_mouse_press(x,y, mouse_button)
end
end
{"teach_text_input":49,"on.mouse_press":51,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Cursor_word":24,"Font_height":8,"teach_keychord_press":47,"Line_height":9,"teach_mouse_press":45,"fw_parent":49,"Mode":2,"draw_teach_screen":43,"fw_app":"spell-cards","on":1,"teach_mouse_release":46}
on.mouse_press = function(x,y, mouse_button)
if Mode == 'teach' then
teach_mouse_press(x,y, mouse_button)
else
learn_mouse_press(x,y, mouse_button)
{"teach_text_input":49,"on.mouse_press":50,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"teach_keychord_press":47,"Words":12,"new_word":37,"on.initialize":7,"teach_mouse_release":46,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":49,"on":1,"Cursor_word":24}
teach_text_input = function(t)
if Cursor_word then
edit.text_input(Cursor_word, t)
end
end
{"teach_text_input":49,"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"teach_keychord_press":47,"Words":12,"new_word":37,"on.initialize":7,"teach_mouse_release":46,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":48,"on":1,"Cursor_word":24}
teach_key_release = function(key, scancode)
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"teach_key_release":48,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"teach_keychord_press":47,"Words":12,"new_word":37,"on.initialize":7,"teach_mouse_release":46,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":47,"on":1,"Cursor_word":24}
teach_keychord_press = function(chord, key)
if chord == 'C-n' then
new_word()
elseif Cursor_word then
if chord == 'return' then
Cursor_word.contents = Cursor_word.lines[1].data
Cursor_word = nil
else
edit.keychord_press(Cursor_word, chord, key)
end
end
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"teach_keychord_press":47,"Words":12,"new_word":37,"on.initialize":7,"teach_mouse_release":46,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":46,"on":1,"Cursor_word":24}
teach_mouse_release = function(x,y, mouse_button)
if Cursor_word then
edit.mouse_release(Cursor_word, x,y, mouse_button)
end
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"teach_mouse_release":46,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":45,"on":1,"Cursor_word":24}
teach_mouse_press = function(x,y, mouse_button)
if x >= 20 and x < 20+App.width(to_text('new word (ctrl+n)')) + 10 and
y >= 5 and y < 5 + Line_height + 10 then
new_word()
return
end
if x >= 20 and x < 100 then
local idx = math.floor((y-50)/Line_height/2)
if idx >= 1 and idx <= #Words then
Cursor_word = Words[idx]
edit.mouse_press(Cursor_word, x,y, mouse_button)
end
end
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"fw_app":"spell-cards","Line_height":9,"teach_mouse_press":45,"draw_teach_screen":43,"Mode":2,"fw_parent":44,"on":1,"Cursor_word":24}
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_teach_screen":43,"Mode":2,"fw_parent":43,"on":1,"Cursor_word":24}
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":43,"Mode":2,"fw_parent":42,"on":1,"Cursor_word":24}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
local cmd = 'new word (ctrl+n)'
local cmd_text = to_text(cmd)
local cmd_width = App.width(cmd_text)
love.graphics.rectangle('fill', 20, 5, cmd_width+10, Line_height+10)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print(cmd, 20+5, 5+5)
local y = 50
for _,word in ipairs(Words) do
draw_teach_word(word)
y = y+Line_height
end
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":42,"Mode":2,"fw_parent":41,"on":1,"Cursor_word":24}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
local cmd = 'new word (ctrl+n)'
local cmd_text = to_text(cmd)
local cmd_width = App.width(cmd_text)
love.graphics.rectangle('fill', 20, 5, cmd_width+10, Line_height+10)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print(cmd, 20+5, 5+5)
local y = 50
for _,word in ipairs(Words) do
draw_teach_word(word)
y = y+Line_height
end
end
{"on.mouse_press":39,"on.mouse_release":40,"draw_teach_word":41,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":30,"Mode":2,"fw_parent":40,"on":1,"Cursor_word":24}
draw_teach_word = function(word)
if word == Cursor_word then
edit.draw(word, Text_color)
else
App.screen.print(word.contents, word.left, word.top)
end
end
on.mouse_release = function(x,y, mouse_button)
if Cursor_word then
edit.mouse_release(Cursor_word, x,y, mouse_button)
end
end
{"on.mouse_press":39,"on.mouse_release":40,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":30,"Mode":2,"fw_parent":39,"on":1,"Cursor_word":24}
on.mouse_press = function(x,y, mouse_button)
if x >= 20 and x < 20+App.width(to_text('new word (ctrl+n)')) + 10 and
y >= 5 and y < 5 + Line_height + 10 then
new_word()
return
end
if x >= 20 and x < 100 then
local idx = math.floor((y-50)/Line_height/2)
if idx >= 1 and idx <= #Words then
Cursor_word = Words[idx]
edit.mouse_press(Cursor_word, x,y, mouse_button)
end
end
end
{"on.mouse_press":39,"on.mouse_release":20,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":30,"Mode":2,"fw_parent":38,"on":1,"Cursor_word":24}
on.keychord_press = function(chord, key)
if chord == 'C-n' then
new_word()
elseif Cursor_word then
if chord == 'return' then
Cursor_word.contents = Cursor_word.lines[1].data
Cursor_word = nil
else
edit.keychord_press(Cursor_word, chord, key)
end
end
end
{"on.mouse_press":36,"on.mouse_release":20,"on.keychord_press":38,"on.key_release":22,"on.text_input":33,"draw_learn_screen":4,"on.draw":5,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8,"Line_height":9,"fw_app":"spell-cards","draw_word":32,"draw_teach_screen":30,"Mode":2,"fw_parent":37,"on":1,"Cursor_word":24}
new_word = function()
Cursor_word = edit.initialize_state(50 + (#Words+1)*Line_height*2, 20, 100, Font_height, Line_height)
Text.redraw_all(Cursor_word)
Cursor_word.contents = ''
table.insert(Words, Cursor_word)
end
{"on":1,"Line_height":9,"draw_word":32,"on.mouse_press":36,"on.mouse_release":20,"on.keychord_press":34,"draw_teach_screen":30,"fw_parent":36,"Mode":2,"fw_app":"spell-cards","on.text_input":33,"Cursor_word":24,"draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Words":12,"new_word":37,"on.initialize":7,"Font_height":8}
on.mouse_press = function(x,y, mouse_button)
if x >= 20 and x < 20+App.width(to_text('new word (ctrl+n)')) + 10 and
y >= 5 and y < 5 + Line_height + 10 then
new_word()
return
end
if x >= 20 and x < 100 then
local idx = math.floor((y-50)/Line_height/2)
if idx >= 1 and idx <= #Words then
Cursor_word = Words[idx]
end
end
end
{"on":1,"Line_height":9,"draw_word":32,"on.mouse_press":36,"on.mouse_release":20,"on.keychord_press":34,"draw_teach_screen":30,"fw_parent":35,"Mode":2,"fw_app":"spell-cards","on.text_input":33,"Cursor_word":24,"draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Words":12,"new_word":35,"on.initialize":7,"Font_height":8}
new_word = function()
Cursor_word = edit.initialize_state(50 + #Words*Line_height*2, 20, 100, Font_height, Line_height)
Text.redraw_all(Cursor_word)
Cursor_word.contents = ''
table.insert(Words, Cursor_word)
end
{"on":1,"Line_height":9,"draw_word":32,"on.mouse_press":27,"on.mouse_release":20,"on.keychord_press":34,"draw_teach_screen":30,"fw_parent":34,"Mode":2,"fw_app":"spell-cards","on.text_input":33,"Cursor_word":24,"draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Words":12,"new_word":35,"on.initialize":7,"Font_height":8}
on.keychord_press = function(chord, key)
if chord == 'C-n' then
new_word()
elseif Cursor_word then
if chord == 'return' then
Cursor_word.contents = Cursor_word.lines[1].data
Cursor_word = nil
end
end
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":33,"on.text_input":33,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on.key_release":22,"on.initialize":7,"Cursor_word":24,"Font_height":8,"on.mouse_press":27,"Line_height":9,"draw_teach_screen":30,"draw_word":32,"on.keychord_press":34}
on.text_input = function(t)
if Cursor_word then
edit.text_input(Cursor_word, t)
end
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":32,"on.text_input":33,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on.key_release":22,"on.initialize":7,"Cursor_word":24,"Font_height":8,"on.mouse_press":27,"Line_height":9,"draw_teach_screen":30,"draw_word":32,"on.keychord_press":25}
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":30,"on.text_input":23,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on.key_release":22,"on.initialize":7,"Cursor_word":24,"Font_height":8,"on.mouse_press":27,"Line_height":9,"draw_teach_screen":30,"draw_word":32,"on.keychord_press":25}
draw_word = function(word)
if word == Cursor_word then
edit.draw(word, Text_color)
else
App.screen.print(word.contents, word.left, word.top)
end
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":30,"draw_teach_screen":30,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":27,"draw_word":31,"on.keychord_press":25}
draw_word = function(word)
if word == Cursor_word then
edit.draw(word, Text_color)
else
App.screen.print(word.contents, word.left, word.top)
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":29,"draw_teach_screen":30,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":27,"draw_word":29,"on.keychord_press":25}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
local cmd = 'new word (ctrl+n)'
local cmd_text = to_text(cmd)
local cmd_width = App.width(cmd_text)
love.graphics.rectangle('fill', 20, 5, cmd_width+10, Line_height+10)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print(cmd, 20+5, 5+5)
local y = 50
for _,word in ipairs(Words) do
draw_word(word)
y = y+Line_height*2
end
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":28,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":27,"draw_word":29,"on.keychord_press":25}
draw_word = function(word, x,y)
App.screen.print(word.contents, x,y)
end
new_word = function()
Cursor_word = edit.initialize_state(50 + #Words*Line_height*2, 20, 100, Font_height, Line_height)
Cursor_word.contents = ''
table.insert(Words, Cursor_word)
end
{"new_word":28,"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":27,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":27,"draw_word":13,"on.keychord_press":25}
on.mouse_press = function(x,y, mouse_button)
if x >= 20 and x < 20+App.width(to_text('new word (ctrl+n)')) + 10 and
y >= 5 and y < 5 + Line_height + 10 then
new_word()
end
end
{"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":26,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":27,"draw_word":13,"on.keychord_press":25}
on.mouse_press = function(x,y, mouse_button)
if x >= 20 and x < 20+App.width(to_text('new word (ctrl+n)')) + 10 and
y >= 5 and y < 5 + Line_height + 10 then
add_word()
end
end
{"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":25,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":26,"draw_word":13,"on.keychord_press":25}
on.keychord_press = function(chord, key)
if chord == 'C-n' then
new_word()
end
end
{"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":24,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":19,"draw_word":13,"on.keychord_press":25}
{"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":23,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"Cursor_word":24,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":19,"draw_word":13,"on.keychord_press":21}
Cursor_word = nil
on.text_input = function(t)
end
{"on":1,"on.mouse_release":20,"Mode":2,"fw_parent":22,"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.key_release":22,"on.initialize":7,"on.text_input":23,"Font_height":8,"Words":12,"Line_height":9,"on.mouse_press":19,"draw_word":13,"on.keychord_press":21}
on.key_release = function(key, scancode)
end
{"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.key_release":22,"on.draw":5,"on.keychord_press":21,"Words":12,"on":1,"on.initialize":7,"on.mouse_release":20,"Font_height":8,"on.mouse_press":19,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":21}
on.keychord_press = function(chord, key)
end
{"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"on.keychord_press":21,"Words":12,"on":1,"on.initialize":7,"on.mouse_release":20,"Font_height":8,"on.mouse_press":19,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":20}
on.mouse_release = function(x,y, mouse_button)
end
{"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"on.mouse_release":20,"Font_height":8,"on.mouse_press":19,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":19}
on.mouse_press = function(x,y, mouse_button)
end
{"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"on.mouse_press":19,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":18}
{"draw_teach_screen":18,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":17}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
local cmd = 'new word (ctrl+n)'
local cmd_text = to_text(cmd)
local cmd_width = App.width(cmd_text)
love.graphics.rectangle('fill', 20, 5, cmd_width+10, Line_height+10)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print(cmd, 20+5, 5+5)
local y = 50
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"draw_teach_screen":17,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":16}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
local cmd = 'new word (ctrl+n)'
local cmd_text = to_text(cmd)
local cmd_width = App.width(cmd_text)
love.graphics.rectangle('fill', 20, 5, cmd_width+4, 25)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print(cmd, 22, 7)
local y = 50
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"draw_teach_screen":16,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":15}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
love.graphics.rectangle('fill', 20, 5, 50, 25)
App.color{r=0.2, g=0.2, b=0.2, a=1}
App.screen.print('new word (ctrl+n)', 22, 7)
local y = 50
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"draw_teach_screen":15,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":14}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
love.graphics.rectangle('fill', 20, 5, 50, 25)
local y = 50
App.color{r=0.2, g=0.2, b=0.2, a=1}
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"draw_teach_screen":14,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":13}
draw_teach_screen = function()
App.color{r=0.7, g=0.7, b=1, a=1}
love.graphics.rectangle(20, 5, 50, 25)
local y = 50
App.color{r=0.2, g=0.2, b=0.2, a=1}
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"draw_teach_screen":11,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":13,"Mode":2,"fw_parent":12}
draw_word = function(word, x,y)
App.screen.print(word.data, x,y)
end
{"draw_teach_screen":11,"fw_app":"spell-cards","draw_learn_screen":4,"on.draw":5,"Words":12,"on":1,"on.initialize":7,"Font_height":8,"Line_height":9,"draw_word":10,"Mode":2,"fw_parent":11}
Words = {} -- array of words (each an object table)
{"fw_app":"spell-cards","Words":6,"Line_height":9,"Font_height":8,"on.initialize":7,"Mode":2,"draw_word":10,"fw_parent":10,"on":1,"draw_learn_screen":4,"draw_teach_screen":11,"on.draw":5}
draw_teach_screen = function()
local y = 50
for _,word in ipairs(Words) do
draw_word(word, 20, y)
y = y+Line_height*2
end
end
{"fw_app":"spell-cards","Words":6,"Line_height":9,"Font_height":8,"on.initialize":7,"Mode":2,"draw_word":10,"fw_parent":9,"on":1,"draw_learn_screen":4,"draw_teach_screen":3,"on.draw":5}
draw_word = function(word, x,y)
App.screen.print(word, x,y)
end
{"Words":6,"Line_height":9,"Font_height":8,"on.initialize":7,"Mode":2,"fw_app":"spell-cards","fw_parent":8,"on":1,"draw_learn_screen":4,"draw_teach_screen":3,"on.draw":5}
Line_height = nil
{"Words":6,"Font_height":8,"on.initialize":7,"Mode":2,"fw_app":"spell-cards","fw_parent":7,"on":1,"draw_learn_screen":4,"draw_teach_screen":3,"on.draw":5}
Font_height = 0
on.initialize = function(arg)
Font_height = 20
love.graphics.setFont(love.graphics.newFont(Font_height))
Line_height = math.floor(Font_height * 1.3)
end
{"Words":6,"on.initialize":7,"Mode":2,"fw_app":"spell-cards","fw_parent":6,"on":1,"draw_learn_screen":4,"draw_teach_screen":3,"on.draw":5}
{"Words":6,"Mode":2,"draw_learn_screen":4,"fw_parent":5,"on":1,"fw_app":"spell-cards","draw_teach_screen":3,"on.draw":5}
Words = {'cat', 'mat', 'hat'}
on.draw = function()
if Mode == 'teach' then
draw_teach_screen()
else
draw_learn_screen()
end
end
{"Mode":2,"draw_learn_screen":4,"fw_parent":4,"on":1,"fw_app":"spell-cards","draw_teach_screen":3,"on.draw":5}
{"Mode":2,"fw_parent":3,"on":1,"fw_app":"spell-cards","draw_teach_screen":3,"draw_learn_screen":4}
draw_learn_screen = function()
end
{"Mode":2,"fw_parent":2,"on":1,"fw_app":"spell-cards","draw_teach_screen":3}
draw_teach_screen = function()
end
{"on":1,"fw_app":"spell-cards","Mode":2,"fw_parent":1}
Mode = 'teach'