| @@ -10,6 +10,9 @@ module Caca | |||||
| i = i.to_i | i = i.to_i | ||||
| const_get("TYPE")|i | const_get("TYPE")|i | ||||
| end | end | ||||
| def quit? | |||||
| false | |||||
| end | |||||
| class Key | class Key | ||||
| attr_reader :ch, :utf32, :utf8 | attr_reader :ch, :utf32, :utf8 | ||||
| def initialize(ch, utf32, utf8) | def initialize(ch, utf32, utf8) | ||||
| @@ -28,5 +31,10 @@ module Caca | |||||
| @w, @h = w, h | @w, @h = w, h | ||||
| end | end | ||||
| end | end | ||||
| class Quit | |||||
| def quit? | |||||
| true | |||||
| end | |||||
| end | |||||
| end | end | ||||
| end | end | ||||
| @@ -56,8 +56,7 @@ c.draw_thin_polyline([[0,0], [0,2], [5,2], [0,0]]) | |||||
| d = Caca::Display.new(c) | d = Caca::Display.new(c) | ||||
| d.title = "Test !" | d.title = "Test !" | ||||
| d.refresh | d.refresh | ||||
| while((e = d.get_event(Caca::Event, -1)) && | |||||
| ! e.kind_of?(Caca::Event::Quit)) | |||||
| while((e = d.get_event(Caca::Event, -1)) && ! e.quit?) | |||||
| p e | p e | ||||
| d.refresh | d.refresh | ||||
| end | end | ||||