-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
166 lines (144 loc) · 6.59 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!doctype html>
<html lang="en">
<head>
<title>Super Game Boy Border Converter</title>
<meta name="description" content="This tool can easily convert an image into SNES tile data for Super Game Boy. Useful for Game Boy homebrew development and more."/>
<meta name="keywords" content="super, game, boy, border, converter, sgb, snes"/>
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link type="text/css" rel="stylesheet" href="app/style.css" media="all"/>
<link rel="shortcut icon" href="./assets/favicon.png" type="image/png" sizes="16x16"/>
<script src="app/cash.min.js"></script>
<script src="app/FileSaver.min.js"></script>
<script type="module" src="app/sgb-converter.js"></script>
</head>
<body>
<div style="flex-grow:1; display:flex; align-items:center;">
<div id="wrapper">
<aside>
<header>
<img id="logo" src="assets/logo.png" loading="lazy" alt="Super Game Boy Border Converter" />
</header>
<hr/>
<img id="img-source" alt="source image" />
<div class="mt-10">
<button id="btn-import" class="btn"><img src="assets/octicon_upload.svg" class="octicon" /> Import image</button>
<input type="file" id="input-file" accept=".png" class="hide" />
</div>
<hr/>
<div id="settings">
<div class="row">
<label for="fraction-pixels">High quality</label>
<select id="fraction-pixels">
<option value="0.1">No</option>
<option value="1.0">Yes (slow)</option>
</select>
</div>
<div class="row">
<label for="input-color">Transparent color</label>
<input type="color" id="input-color" value="#ff00ff" aria-label="transparent color" />
</div>
<div class="row">
<label for="select-dither">Dithering</label>
<select id="select-dither">
<option value="0">disabled</option>
<option value="1">fast</option>
<option value="2">slow</option>
</select>
</div>
<div id="container-dithering-options">
<div class="row">
<label for="input-dithering-weight">Dithering weight</label>
<input type="number" id="input-dithering-weight" min="0.01" max="1.0" step="0.01" value="0.5" style="max-width: 80px" />
</div>
<div class="row">
<label for="select-dither-method">Dithering method</label>
<select id="select-dither-method">
<option value="0">diagonal4</option>
<option value="1">horizontal4</option>
<option value="2">vertical4</option>
<option value="3">diagonal2</option>
<option value="4">horizontal2</option>
<option value="5">vertical2</option>
</select>
</div>
</div>
</div>
<div class="mt-10">
<button type="button" id="btn-quantize" class="btn btn-primary"><img src="assets/octicon_package_dependents.svg" class="octicon" /> Convert</button>
</div>
<div>
<progress id="progress-bar" max="100" value="0"></progress>
</div>
</aside>
<main>
<div id="alerts"></div>
<div id="intro">
<h2 class="mt-0">About</h2>
<p>This tool can easily convert a 256×224 PNG image into SNES tile data for Super Game Boy.</p>
<div class="text-center mt-10 mb-20">
<a id="btn-donate" href="https://www.paypal.com/paypalme/marcrobledo/5" target="_blank"><img src="assets/octicon_heart.svg" alt="love" class="octicon" /> Donate</a>
</div>
<p>It uses <a href="https://rilden.github.io/tiledpalettequant/" target="_blank">Tiled Palette Quantization</a> by rilden to reduce and optimize palettes for SGB limitations.</p>
<p>Can be used with:</p>
<ul>
<li>
<strong><a href="https://www.marcrobledo.com/super-game-boy-border-injector" target="_blank">Super Game Boy Border Injector</a></strong><br/>
Turn your favorite Game Boy game into a Super Game Boy compatible game, including your own border and palette!
</li>
<li>
<strong><a href="https://github.com/MiSTer-devel/Gameboy_MiSTer?tab=readme-ov-file#custom-borders" target="_blank">MiSTer FPGA Game Boy Core</a></strong><br/>
MiSTer FPGA Game Boy Core allows you to load custom SGB borders (in .sgb format) at any time
</li>
<li>
<strong>Game Boy homebrew development</strong><br/>
Include SGB border data generated by this tool into your Game Boy homebrew game
</li>
</ul>
</div>
<div id="app" class="hide">
<!-- result -->
<h2 class="mt-0">Result</h2>
<div>
<div class="text-center">
<div class="mb-5"><canvas id="canvas-map" width="256" height="224" class="zoomable"></canvas></div>
<button type="button" id="btn-export-map" class="btn" disabled><img src="assets/octicon_download.svg" class="octicon" /> Export map+attributes</button>
</div>
</div>
<div class="row flex-space-between" style="align-items: start;">
<div style="width:calc(50% - 8px)">
<h2>Tiles</h2>
<div class="text-center">
<div class="mb-5" style="display:flex; justify-content:center; align-items:center;">
<canvas id="canvas-tiles" width="128" height="8" class="zoomable"></canvas>
</div>
<button type="button" id="btn-export-tiles" class="btn" disabled><img src="assets/octicon_download.svg" class="octicon" /> Export tiles</button>
</div>
</div>
<div style="width:calc(50% - 8px)">
<h2>Palettes</h2>
<div class="text-center">
<div class="mb-5" style="display:flex; justify-content:center; align-items:center;">
<canvas id="canvas-palettes" width="256" height="48"></canvas>
</div>
<div id="lossless-message" class="mb-5 hide"><img src="assets/octicon_check.svg" class="octicon" /> No colors lost!</div>
<button type="button" id="btn-export-palettes" class="btn" disabled><img src="assets/octicon_download.svg" class="octicon" /> Export palettes</button>
</div>
</div>
</div>
<div class="mt-20 text-center">
<hr/>
<button type="button" id="btn-export-sgb" class="btn" disabled><img src="assets/octicon_download.svg" class="octicon" /> Download .sgb file</button><br/>
<small>(all data in a single file)</small>
</div>
</div>
</main>
</div>
</div>
<footer>
Super Game Boy Border Converter v1.4<br/>
made with <span class="love" title="Super love">Super <img src="assets/octicon_heart_color.svg" alt="love" class="octicon" /></span> by <a href="https://www.marcrobledo.com" target="_blank">Marc Robledo</a>
<img src="assets/octicon_github.svg" alt="GitHub logo" class="octicon" /> <a href="https://github.com/marcrobledo/super-game-boy-border-converter/" target="_blank">See sourcecode in GitHub</a>
</footer>
</body>
</html>