Class Vaadoom
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable
DOOM runs inside a NOMMU Linux which itself runs on Adrian Cable's single-instruction
SUBLEQ virtual machine, compiled to WebAssembly and driven from a Web Worker. The
worker paints the emulated framebuffer onto an OffscreenCanvas inside the
<vaadoom-viewport> custom element.
The DOOM framebuffer is 800×512. By default the
component is sized to those pixels; use HasSize.setWidth(String) /
HasSize.setHeight(String) (from HasSize) to scale the viewport.
The engine boots a NOMMU Linux and auto-launches fbdoom; first paint takes ~15
seconds (a loading overlay is shown meanwhile). It is playable: when the
component has focus it forwards keyboard input to DOOM (arrows move, Ctrl fires, Space
uses, Alt strafes, 1–7 select weapons). Disable input with setPlayable(boolean).
Needs a browser with OffscreenCanvas, WebAssembly and
DecompressionStream; no cross-origin-isolation (COOP/COEP) headers are
required (input is delivered between VM slices, without SharedArrayBuffer).
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidsetAutostart(boolean autostart) Whether the emulator starts automatically when the component is attached.voidsetPlayable(boolean playable) Whether keyboard input is enabled (the viewport becomes focusable and forwards key events to DOOM).Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisibleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
FB_WIDTH
public static final int FB_WIDTHNative width, in pixels, of the DOOM framebuffer.- See Also:
-
FB_HEIGHT
public static final int FB_HEIGHTNative height, in pixels, of the DOOM framebuffer.- See Also:
-
-
Constructor Details
-
Vaadoom
-
-
Method Details
-
setAutostart
public void setAutostart(boolean autostart) Whether the emulator starts automatically when the component is attached. Defaults totrue.- Parameters:
autostart-trueto start on attach
-
isAutostart
public boolean isAutostart()- Returns:
- whether the emulator starts automatically on attach
-
setPlayable
public void setPlayable(boolean playable) Whether keyboard input is enabled (the viewport becomes focusable and forwards key events to DOOM). Defaults totrue. Input works without any cross-origin-isolation headers.- Parameters:
playable-trueto enable keyboard control
-
isPlayable
public boolean isPlayable()- Returns:
- whether keyboard input is enabled
-