trigger on keypress

This commit is contained in:
Maas Lalani 2021-08-08 22:51:40 -04:00
parent 45abcd2122
commit 70c180fb36
No known key found for this signature in database
GPG Key ID: F53774FA051C052A

View File

@ -86,7 +86,12 @@ func (m model) Init() tea.Cmd {
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
return m, tea.Quit
switch msg.String() {
case "ctrl+c", "q":
return m, tea.Quit
}
m.system.Particles = spawn(m.system.Frame.Width, m.system.Frame.Height)
return m, nil
case frameMsg:
m.system.Update()
return m, animate()