/** * Sets the icon of the display. Must point to an image (PNG, BMP, JPEG are supported). For HTML5, use a .ICO file. * * @param filePath The file path to the image. * @param success The success callback to be called after setting the icon. */ @PlatformDesktop @PlatformHTML5 default void setIcon(FilePath filePath, SimpleCallback success) { setIcon(filePath, success, SilenceEngine.log.getRootLogger()::error); }
/** * Sets the icon of the display. Must point to an image (PNG, BMP, JPEG are supported). For HTML5, use a .ICO file. * * @param filePath The file path to the image. * * @return A void {@link Promise} that wraps the callbacks. */ @PlatformDesktop @PlatformHTML5 default Promise<Void> setIcon(FilePath filePath) { return new Promise<>((resolve, reject) -> setIcon(filePath, () -> resolve.invoke(null), reject)); }
public static void start(Game game) { SilenceEngine.log = new GwtLogDevice(); SilenceEngine.display = new GwtDisplayDevice(); SilenceEngine.input = new GwtInputDevice(); SilenceEngine.io = new GwtIODevice(); SilenceEngine.graphics = new GwtGraphicsDevice(); SilenceEngine.audio = new GwtAudioDevice(); SilenceEngine.display.setTitle("SilenceEngine " + SilenceEngine.getVersionString()); SilenceEngine.display.setIcon(FilePath.getResourceFile("engine_resources/icon.png")); SilenceEngine.init(() -> { game.init(); // Prevent fullscreen requests in init SilenceEngine.display.setFullscreen(false); AnimationScheduler.get().requestAnimationFrame(GwtRuntime::frameLoop); }); }
SilenceEngine.display.setIcon(FilePath.getResourceFile("engine_resources/icon.png"), () ->