Skip to content

Commit

Permalink
Enable antialias and increase resolution by default
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberDex committed Dec 11, 2024
1 parent 6ca0713 commit e65d649
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/template-creation-web/src/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import manifest from "../manifest.json";
import { CreationAudioPlugin } from "./audio/AudioPlugin";
import { CreationNavigationPlugin } from "./navigation/NavigationPlugin";
import { CreationResizePlugin } from "./resize/ResizePlugin";
import { getResolution } from "./utils/getResolution";

extensions.remove(ResizePlugin);
extensions.add(CreationResizePlugin);
Expand All @@ -36,6 +37,9 @@ export class CreationEngine extends Application {
/** Initialize the application */
public async init(opts: Partial<ApplicationOptions>): Promise<void> {
opts.resizeTo ??= window;
opts.resolution ??= getResolution();
opts.antialias ??= true;

await super.init(opts);

// Append the application canvas to the document body
Expand All @@ -55,7 +59,7 @@ export class CreationEngine extends Application {

public override destroy(
rendererDestroyOptions: RendererDestroyOptions = false,
options: DestroyOptions = false,
options: DestroyOptions = false

Check failure on line 62 in templates/template-creation-web/src/engine/engine.ts

View workflow job for this annotation

GitHub Actions / Build

Insert `,`
): void {
document.removeEventListener("visibilitychange", this.visibilityChange);
super.destroy(rendererDestroyOptions, options);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function getResolution(): number {
let resolution = Math.max(window.devicePixelRatio, 2);

if (resolution % 1 !== 0) {
resolution = 2;
}

return resolution;
}

0 comments on commit e65d649

Please sign in to comment.