MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Window

Class Window

src/main/java/field/graphics/Window.java:42–1391  ·  view source on GitHub ↗

An Window with an associated OpenGL draw context, and a base Field graphics Scene

Source from the content-addressed store, hash-verified

40import static org.lwjgl.glfw.GLFW.glfwPollEvents;
41
42
43/**
44 * An Window with an associated OpenGL draw context, and a base Field graphics Scene
45 */
46public class Window implements ProvidesGraphicsContext, BoxBrowser.HasMarkdownInformation {
47
48 static public final Dict.Prop<Boolean> consumed = new Dict.Prop<>("consumed").type()
49 .doc("marks an event as handled elsewhere")
50 .toCanon().set(Dict.domain, "event");
51 static public final boolean glDebugging = Options.dict().isTrue(new Dict.Prop<>("gldebugging"), false);
52 static public boolean doubleBuffered = Options.dict()
53 .isTrue(new Dict.Prop("doubleBuffered"), Main.os == Main.OS.mac);
54 static public boolean dontShare = Options.dict()
55 .isTrue(new Dict.Prop("dontShare"), Main.os == Main.OS.windows);
56
57 static public boolean neverDisable = Options.dict().isTrue(new Dict.Prop("neverDisableWindows"), false);
58
59 static public Window shareContext = null;
60 static ThreadLocal<Window> currentWindow = new ThreadLocal<Window>() {
61 @Override
62 protected Window initialValue() {
63 return null;
64 }
65 };
66 /**
67 * the Scene associated with this window.
68 * <p>f.bat
69 * This is the principle entry point into this window
70 */
71
72 public final Scene scene = new Scene();
73 protected final Window shareContextAtConstruction;
74 private final Thread createdInThread;
75 public GlfwCallback callback;
76 public Vec3 background = Colors.backgroundColor;
77 public IdempotencyMap<Mouse.OnMouseDown> onMouseDown = new IdempotencyMap<>(Mouse.OnMouseDown.class);
78 public IdempotencyMap<Mouse.OnMouseScroll> onMouseScroll = new IdempotencyMap<>(Mouse.OnMouseScroll.class);
79 public SwapControl swapControl = (w) -> glfwSwapBuffers(w);
80 public RenderControl renderControl = () -> false;
81 /**
82 * an integer that increases every time this window is drawn
83 */
84 public long frame;
85 /**
86 * a rough estimate of the current framerate of this window, in Frames-per-second
87 */
88 public double frameRate;
89 /**
90 * disables the swapping of this window to the screen (the window continues to repaint itself whenever it would repaint before, but no call to SwapBuffers happens if this is set to true)
91 */
92 public boolean doRetina = (int) (Options.dict().getFloat(new Dict.Prop<Number>("retina"), 0f)) == 1;
93 public boolean dontSwap = false;
94 protected GraphicsContext graphicsContext;
95 protected long window;
96 protected int w, x;
97 protected int h, y;
98 protected MouseState mouseState = new MouseState();
99 protected KeyboardState keyboardState = new KeyboardState();

Callers

nothing calls this directly

Calls 9

dictMethod · 0.95
loopMethod · 0.95
toCanonMethod · 0.80
docMethod · 0.80
typeMethod · 0.80
isTrueMethod · 0.80
getFloatMethod · 0.80
setMethod · 0.65
orderMethod · 0.45

Tested by

no test coverage detected