32 lines
No EOL
2.6 KiB
HTML
32 lines
No EOL
2.6 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>App.set_icon — Ludic</title>
|
||
<meta name="description" content="Set the Dock icon from an image the game ships.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-app.html">App</a> <span>›</span> <span class="here">App.set_icon</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">App.set_icon</h1>
|
||
</div>
|
||
<code class="sig">App.set_icon(path) -> void</code>
|
||
<div class="desc"><p>Sets the application's icon — the Dock tile, the Cmd-Tab switcher, the About box — from an image the game ships.</p><p>A **bundled** app already has one: <code>ludic bundle</code> builds <code>AppIcon.icns</code> from the manifest's <code>app icon</code> and macOS reads it from the bundle, so calling this there is harmless and changes nothing you can see. A **plain binary** is the case this exists for. <code>ludic build</code> produces an executable with no bundle around it, so macOS has nowhere to find an icon and draws the generic one — which is what a developer looks at every time they run the game.</p><p>The path is resolved the same way every other asset is, through the pack first and the filesystem second, so the same call works in a packed build and in a project directory. An image that cannot be found or decoded leaves the current icon alone rather than clearing it.</p><p>Headless builds have no AppKit, so this compiles to nothing there.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-path"><code class="pname">path</code><span class="pdesc">an image the game ships (PNG, JPEG or TIFF); 1024x1024 is the size macOS wants</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Titled {
|
||
entry {
|
||
App.set_icon("assets/app/icon.png")
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |