| 12 | } |
| 13 | |
| 14 | class EventHandler implements Consumer<Event> { |
| 15 | public final Window window; |
| 16 | public final LayerGL layer; |
| 17 | |
| 18 | public EventHandler(Window window) { |
| 19 | this.window = window; |
| 20 | layer = new LayerGL(); |
| 21 | window.setLayer(layer); |
| 22 | } |
| 23 | |
| 24 | @Override |
| 25 | public void accept(Event e) { |
| 26 | System.out.println(e); |
| 27 | if (e instanceof EventWindowCloseRequest) { |
| 28 | window.close(); |
| 29 | App.terminate(); |
| 30 | } else if (e instanceof EventFrame) { |
| 31 | paint(); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | public void paint() { |
| 36 | layer.makeCurrent(); |
| 37 | // do the drawing |
| 38 | layer.swapBuffers(); |
| 39 | } |
| 40 | } |
nothing calls this directly
no outgoing calls
no test coverage detected