MCPcopy Create free account
hub / github.com/agateau/pixelwheels / createUiInstance

Method createUiInstance

core/src/com/agateau/ui/KeyMapper.java:36–54  ·  view source on GitHub ↗

Create a KeyMapper to use when navigating UIs

()

Source from the content-addressed store, hash-verified

34
35 /** Create a KeyMapper to use when navigating UIs */
36 public static KeyMapper createUiInstance() {
37 KeyMapper mapper = new KeyMapper();
38 mapper.setKey(VirtualKey.LEFT, Input.Keys.LEFT);
39 mapper.setKey(VirtualKey.RIGHT, Input.Keys.RIGHT);
40 mapper.setKey(VirtualKey.UP, Input.Keys.UP);
41 mapper.setKey(VirtualKey.DOWN, Input.Keys.DOWN);
42 mapper.setKey(VirtualKey.TRIGGER, Input.Keys.SPACE);
43 mapper.setKey(VirtualKey.BACK, Input.Keys.ESCAPE);
44 mapper.setKey(VirtualKey.PAUSE, Input.Keys.ESCAPE);
45 mapper.setKey(VirtualKey.SCREENSHOT, Input.Keys.F9);
46
47 mapper.addKey(VirtualKey.TRIGGER, Input.Keys.ENTER);
48 if (!PlatformUtils.isDesktop()) {
49 // Do not use CENTER or BACK on Desktop, it causes invalid enum value errors with lwjgl3
50 mapper.addKey(VirtualKey.TRIGGER, Input.Keys.CENTER);
51 mapper.addKey(VirtualKey.BACK, Input.Keys.BACK);
52 }
53 return mapper;
54 }
55
56 /**
57 * Create a KeyMapper used by a player during actual play, not to navigate UIs (except when

Callers 1

UiInputMapperClass · 0.95

Calls 3

setKeyMethod · 0.95
addKeyMethod · 0.95
isDesktopMethod · 0.95

Tested by

no test coverage detected