Repository navigation
Expand file tree
/
Copy pathindex_v2.html
More file actions
358 lines (312 loc) · 12 KB
/
Copy pathindex_v2.html
File metadata and controls
358 lines (312 loc) · 12 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>Генератор Текстурных Шрифтов</title>
<style>
:root {
--primary-color: #2196F3;
--background-color: #ffffff;
--text-color: #333333;
--border-color: #e0e0e0;
}
/* Динамическая загрузка шрифтов */
#fontLoader {
position: absolute;
width: 0;
height: 0;
overflow: hidden;
visibility: hidden;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--background-color);
padding: 2rem;
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 2rem;
}
.header h1 {
font-size: 2.5rem;
color: var(--primary-color);
margin-bottom: 1rem;
}
.description {
margin-bottom: 2rem;
text-align: center;
}
.controls-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.control-group {
background: #f5f5f5;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.control-group h2 {
margin-bottom: 1rem;
color: var(--primary-color);
font-size: 1.2rem;
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
}
.scale-controls {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
.scale-controls input[type="number"] {
width: 100%;
}
input[type="text"],
input[type="number"] {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
}
select.font-select {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
background-color: white;
cursor: pointer;
}
.font-upload {
margin-top: 0.5rem;
}
.upload-label {
display: inline-block;
padding: 0.5rem 1rem;
background: var(--primary-color);
color: white;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
}
.upload-label:hover {
background: #1976D2;
}
.upload-label input[type="file"] {
display: none;
}
select.font-select option {
padding: 0.5rem;
font-size: 1rem;
}
input[type="radio"],
input[type="checkbox"] {
margin-right: 0.5rem;
}
.radio-group {
display: flex;
gap: 1rem;
}
.preview-container {
margin-top: 2rem;
text-align: center;
}
canvas {
max-width: 100%;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAC1JREFUeNpi/P//PwMIMALxfyAGsRnR2YxwCTQJJnQJZhTNyBJMWCQYAAIMAK7iBRABIrWDAAAAAElFTkSuQmCC');
border: 1px solid var(--border-color);
border-radius: 4px;
margin: 1rem auto;
}
.button-group {
display: flex;
gap: 1rem;
justify-content: center;
margin-top: 2rem;
}
button {
padding: 0.8rem 1.5rem;
border: none;
border-radius: 4px;
background: var(--primary-color);
color: white;
font-size: 1rem;
cursor: pointer;
transition: background 0.3s ease;
}
button:hover {
background: #1976D2;
}
button:disabled {
background: #ccc;
cursor: not-allowed;
}
textarea {
width: 100%;
height: 200px;
padding: 1rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-family: monospace;
margin-top: 1rem;
}
.error {
color: #f44336;
font-size: 0.9rem;
margin-top: 0.5rem;
}
@media (max-width: 768px) {
body {
padding: 1rem;
}
.controls-container {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="header">
<h1>Генератор Текстурных Шрифтов</h1>
</div>
<div class="description">
<p>Инструмент для создания текстурных шрифтов для игр и веб-приложений.
Поддерживает создание дистанционных полей и различные форматы экспорта.</p>
</div>
<div class="controls-container">
<div class="control-group">
<h2>Настройки шрифта</h2>
<div class="form-group">
<label>Название шрифта:</label>
<select id="fontName" class="font-select">
<option value="Arial">Arial</option>
</select>
<div class="font-upload">
<label class="upload-label">Добавить шрифты:
<input type="file" id="fontUpload" accept=".ttf,.woff,.woff2,.otf" multiple>
</label>
</div>
</div>
<div class="form-group">
<label>Размер шрифта:</label>
<input type="number" id="fontSize" value="70" min="1" max="256">
</div>
<div class="form-group">
<label>Цвет шрифта:</label>
<input type="color" id="fontColor" value="#ffffff" style="width: 100%; height: 40px; cursor: pointer;">
</div>
<div class="form-group">
<label>Масштабирование:</label>
<div class="scale-controls">
<div>
<label>Ширина (%):</label>
<input type="number" id="fontScaleX" value="100" min="1" max="500">
</div>
<div>
<label>Высота (%):</label>
<input type="number" id="fontScaleY" value="100" min="1" max="500">
</div>
</div>
</div>
<div class="form-group">
<label>Стиль:</label>
<div class="checkbox-group">
<label><input type="checkbox" id="fontBold"> Жирный</label>
<label><input type="checkbox" id="fontItalic"> Курсив</label>
</div>
</div>
</div>
<div class="control-group">
<h2>Параметры текстуры</h2>
<div class="form-group">
<label>Разрешение:</label>
<div class="radio-group">
<label><input type="radio" name="resolution" id="resolutionSmallest" checked> Минимальное</label>
<label><input type="radio" name="resolution" id="resolutionPowerOf2"> Степень двойки</label>
</div>
</div>
<div class="form-group">
<label>Тип отображения:</label>
<div class="radio-group">
<label><input type="radio" name="displayType" id="displayTypeNormal"> Обычный</label>
<label><input type="radio" name="displayType" id="displayTypeDistanceField" checked> Дистанционное
поле</label>
</div>
<div id="normalOptions" style="display: none;">
<div class="form-group">
<label>Фон:</label>
<div class="radio-group">
<label><input type="radio" name="normalBackground" id="normalBackgroundTransparent">
Прозрачный</label>
<label><input type="radio" name="normalBackground" id="normalBackgroundBlack" checked>
Чёрный</label>
</div>
</div>
</div>
<div id="distanceFieldOptions">
<div class="form-group">
<label>Falloff:</label>
<input type="number" id="distanceFieldFalloff" value="5" min="1" max="32">
</div>
<div class="form-group">
<label>Фон:</label>
<div class="radio-group">
<label><input type="radio" name="distanceFieldBackground"
id="distanceFieldBackgroundTransparent"> Прозрачный</label>
<label><input type="radio" name="distanceFieldBackground" id="distanceFieldBackgroundBlack"
checked> Чёрный</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Зеркалирование текстуры:</label>
<div class="checkbox-group">
<label><input type="checkbox" id="mirrorX"> По горизонтали (X)</label>
<label><input type="checkbox" id="mirrorY"> По вертикали (Y)</label>
</div>
</div>
</div>
<div class="control-group">
<h2>Символы</h2>
<div class="form-group">
<div class="radio-group">
<label><input type="radio" name="characters" id="charactersASCII"> ASCII</label>
<label><input type="radio" name="characters" id="charactersCustom" checked> Свой набор</label>
</div>
</div>
<div class="form-group">
<input type="text" id="customCharacters"
value=" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя">
</div>
</div>
</div>
<div class="button-group">
<button id="generateBtn">Сгенерировать</button>
<button id="downloadBtn" disabled>Скачать текстуру</button>
</div>
<div class="preview-container">
<canvas id="previewCanvas"></canvas>
</div>
<textarea id="outputData" readonly placeholder="Здесь появится код..."></textarea>
<div id="fontLoader"></div>
<script src="js_v2/generator.js"></script>
</body>
</html>