Project Mammut Wiki
projectmammut.com
Project Mammut is currently in open beta. The UI is being updated a lot during this time, and you may run into bugs. If you'd like to help develop the engine or suggest features, come find us on Bluesky or Discord.

Application

Written 18 Nov 2026 · Updated 20 Nov 2026 · Requires Mammut 0.9.22+

Application handles things outside the game itself: which platform it's running on, quitting, fullscreen, opening links and the mouse cursor. Each method works on both the desktop app and the web, so use these instead of browser or desktop APIs.

Member Description
GetPlatform() "desktop" on desktop, "web" in a browser
StorageKey() Makes a storage key unique to this game
Quit() Closes the game
Restart() Starts the game again from the beginning
EnterFullscreen() Goes fullscreen
ExitFullscreen() Leaves fullscreen
ToggleFullscreen() Switches fullscreen on or off
IsFullscreen() Whether the game is fullscreen
OpenURL() Opens a link in the player's browser
SetCursor() Changes the mouse cursor
ResetCursor() Puts the cursor back to the one in Project Settings

GetPlatform

Application.GetPlatform(): "desktop" | "web"

Returns "desktop" when the game is running as a desktop app, and "web" in a browser. Play in the desktop editor counts as desktop, and Play in the web editor counts as web.

Example

onEnter() {
  if (Application.GetPlatform() === "web") {
    this.dom.quit_button.hide(); // browsers usually won't let a page close itself
  }
},

StorageKey

Application.StorageKey(name: string): string

Makes a localStorage key that won't clash with other Mammut games.

Returns name unchanged in a browser, where each site already has its own storage. On desktop, where every Mammut game shares one storage, it returns name with the project's id in front.

How it works

  • SaveManager and AudioManager use it for their own keys.
  • Use it for anything you store yourself with localStorage.

Example

onEnter() {
  const key = Application.StorageKey("bestTime");
  this.dom.best_label.textContent = localStorage.getItem(key) ?? "No best time yet";
},

Quit

Application.Quit(): void

Closes the game. On desktop it closes the window.

How it works

In a browser it tries to close the tab, but browsers only allow that for tabs that a script opened. Most of the time nothing happens, so hide your quit button on the web.

Example

onQuitPressed() {
  SaveManager.Save(1); // keep the player's progress before closing
  Application.Quit();
},

Restart

Application.Restart(): void

Reloads the game, so it starts again from the splash screens.

How it works

Anything that only lived in memory is lost, including project variables and autosaves. Save slots and game settings are kept, because they're in storage.

Example

onRestartPressed() {
  Application.Restart();
},

EnterFullscreen

Application.EnterFullscreen(): void

Makes the game fill the screen.

How it works

  • On desktop it makes the window fullscreen.
  • In a browser it uses the browser's fullscreen mode, which only works straight after a click or key press. Pressing Escape always leaves it.

Example

onFullscreenPressed() {
  Application.EnterFullscreen();
},

ExitFullscreen

Application.ExitFullscreen(): void

Leaves fullscreen.

ToggleFullscreen

Application.ToggleFullscreen(): void

Leaves fullscreen if the game is fullscreen, and goes fullscreen if it isn't.

Example

onStart() {
  InputManager.Register("KeyDown", "F11", () => Application.ToggleFullscreen(), this);
},

IsFullscreen

Application.IsFullscreen(): boolean

Returns true while the game is fullscreen.

Example

onEnter() {
  this.dom.fullscreen_box.checked = Application.IsFullscreen();
},

OpenURL

Application.OpenURL(url: string): void

Opens a link in the player's web browser. On desktop it opens their default browser. In a browser it opens a new tab.

Example

onWishlistPressed() {
  Application.OpenURL("https://example.com/my-game");
},

SetCursor

Application.SetCursor(
  cursor: CursorName | AssetRef<"image"> | string | null,
  options?: { slot?: "default" | "pointer"; x?: number; y?: number },
): void

Changes the mouse cursor. The game has two cursor slots, both set in Project Settings:

  • default: the cursor used everywhere.
  • pointer: the cursor used over buttons, links and other clickable things.
Parameter Type Default Description
cursor CursorName | AssetRef<"image"> | string | null What to show, see below. null puts the slot back to its Project Settings cursor
options.slot "default" | "pointer" "default" Which slot to change
options.x, options.y number 0 The click point, in image pixels from the top left. Only used when cursor is an image

cursor is looked up in this order:

  1. A named cursor from Project Settings, such as "magnifier". These already have their click point.
  2. An image from the project, as an image variable or the image's name.
  3. A CSS cursor, such as "none" to hide the cursor, "crosshair" or "wait".

If nothing matches, the cursor doesn't change and a warning is logged.

How it works

  • The change lasts until you change it again or call ResetCursor(). Switching scenes doesn't reset it.
  • Browsers ignore cursor images bigger than 128 × 128 pixels, and some systems ignore anything over 32 × 32.
  • Hiding the default cursor doesn't hide the pointer cursor over buttons. Set both slots to hide it everywhere.

Example

onEnter() {
  Application.SetCursor("magnifier");          // a named cursor from Project Settings
},

onAimStart() {
  Application.SetCursor("target", { x: 16, y: 16 }); // the target image, clicking at its centre
},

onCutsceneStart() {
  Application.SetCursor("none");
  Application.SetCursor("none", { slot: "pointer" });
},

onExit() {
  Application.ResetCursor();
},

ResetCursor

Application.ResetCursor(slot?: "default" | "pointer"): void

Puts a cursor slot back to the cursor set in Project Settings. Without a slot, it resets both.

Example

onCutsceneEnd() {
  Application.ResetCursor();
},