MCPcopy Create free account
hub / github.com/HumbleUI/JWM / EventHandler

Class EventHandler

docs/GettingStarted.java:14–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14class 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected