/
graph_library.c
562 lines (551 loc) · 16.8 KB
/
graph_library.c
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
// graph-library.c
// グラフィックビデオ出力用ライブラリ by K.Tanaka
#include "spi_composite.h"
const unsigned char __attribute__((__weak__ , aligned (4))) FontData[256*8]={
//フォントデータ
//キャラクタコード順に8バイトずつ、上位ビットが左
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x08,0x0C,0xFE,0xFE,0x0C,0x08,0x00,
0x00,0x20,0x60,0xFE,0xFE,0x60,0x20,0x00,
0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x00,
0x00,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x00,
0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,
0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00,
0x18,0x7E,0xD8,0x7E,0x1A,0xFE,0x18,0x00,
0xE0,0xE6,0x0C,0x18,0x30,0x6E,0xCE,0x00,
0x78,0xCC,0xD8,0x70,0xDE,0xCC,0x76,0x00,
0x0C,0x18,0x30,0x00,0x00,0x00,0x00,0x00,
0x0C,0x18,0x30,0x30,0x30,0x18,0x0C,0x00,
0x30,0x18,0x0C,0x0C,0x0C,0x18,0x30,0x00,
0xD6,0x7C,0x38,0xFE,0x38,0x7C,0xD6,0x00,
0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,
0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x00,
0x00,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,
0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,
0x18,0x38,0x78,0x18,0x18,0x18,0x7E,0x00,
0x7C,0xC6,0x06,0x1C,0x70,0xC0,0xFE,0x00,
0x7C,0xC6,0x06,0x3C,0x06,0xC6,0x7C,0x00,
0x0C,0x1C,0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0xCC,0x78,
0xC0,0xC0,0xCC,0xD8,0xF0,0xF8,0xCC,0x00,
0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,
0x00,0x00,0xFC,0xB6,0xB6,0xB6,0xB6,0x00,
0x00,0x00,0xFC,0xE6,0xC6,0xC6,0xC6,0x00,
0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0x00,
0x00,0x00,0xFC,0xE6,0xE6,0xFC,0xC0,0xC0,
0x00,0x00,0x7E,0xCE,0xCE,0x7E,0x06,0x06,
0x00,0x00,0xDC,0xE6,0xC0,0xC0,0xC0,0x00,
0x00,0x00,0x7E,0xC0,0x7C,0x06,0xFC,0x00,
0x30,0x30,0xFC,0x30,0x30,0x36,0x1C,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0xCE,0x76,0x00,
0x00,0x00,0xC6,0xC6,0xC6,0x6C,0x38,0x00,
0x00,0x00,0x86,0xB6,0xB6,0xB6,0xFC,0x00,
0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00,
0x00,0x00,0xC6,0xC6,0xCE,0x7E,0x06,0x7C,
0x00,0x00,0xFE,0x0C,0x38,0x60,0xFE,0x00,
0x3C,0x60,0x60,0xC0,0x60,0x60,0x3C,0x00,
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,
0xF0,0x18,0x18,0x0C,0x18,0x18,0xF0,0x00,
0x60,0xB6,0x1C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,
0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,
0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,
0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x0C,0x18,0x18,
0x00,0x00,0x00,0x00,0xE0,0x30,0x18,0x18,
0x18,0x18,0x18,0x0C,0x07,0x00,0x00,0x00,
0x18,0x18,0x18,0x30,0xE0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x78,0x68,0x78,0x00,
0x78,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x18,0x18,0x18,0x78,0x00,
0x00,0x00,0x00,0x00,0x60,0x30,0x18,0x00,
0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,
0xFE,0x06,0x06,0xFE,0x06,0x0C,0x78,0x00,
0x00,0x00,0xFC,0x0C,0x38,0x30,0x60,0x00,
0x00,0x00,0x0C,0x18,0x38,0x78,0x18,0x00,
0x00,0x00,0x30,0xFC,0xCC,0x0C,0x38,0x00,
0x00,0x00,0x00,0xFC,0x30,0x30,0xFC,0x00,
0x00,0x00,0x18,0xFC,0x38,0x78,0xD8,0x00,
0x00,0x00,0x60,0xFC,0x6C,0x68,0x60,0x00,
0x00,0x00,0x00,0x78,0x18,0x18,0xFC,0x00,
0x00,0x00,0x7C,0x0C,0x7C,0x0C,0x7C,0x00,
0x00,0x00,0x00,0xAC,0xAC,0x0C,0x38,0x00,
0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,
0xFE,0x06,0x06,0x34,0x38,0x30,0x60,0x00,
0x06,0x0C,0x18,0x38,0x78,0xD8,0x18,0x00,
0x18,0xFE,0xC6,0xC6,0x06,0x0C,0x38,0x00,
0x00,0x7E,0x18,0x18,0x18,0x18,0x7E,0x00,
0x18,0xFE,0x18,0x38,0x78,0xD8,0x18,0x00,
0x30,0xFE,0x36,0x36,0x36,0x36,0x6C,0x00,
0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x00,
0x3E,0x66,0xC6,0x0C,0x18,0x30,0xE0,0x00,
0x60,0x7E,0xD8,0x18,0x18,0x18,0x30,0x00,
0x00,0xFE,0x06,0x06,0x06,0x06,0xFE,0x00,
0x6C,0xFE,0x6C,0x0C,0x0C,0x18,0x30,0x00,
0x00,0xF0,0x00,0xF6,0x06,0x0C,0xF8,0x00,
0xFE,0x06,0x0C,0x18,0x38,0x6C,0xC6,0x00,
0x60,0xFE,0x66,0x6C,0x60,0x60,0x3E,0x00,
0xC6,0xC6,0x66,0x06,0x0C,0x18,0xF0,0x00,
0x3E,0x66,0xE6,0x3C,0x18,0x30,0xE0,0x00,
0x0C,0x78,0x18,0xFE,0x18,0x18,0xF0,0x00,
0x00,0xD6,0xD6,0xD6,0x0C,0x18,0xF0,0x00,
0x7C,0x00,0xFE,0x18,0x18,0x30,0x60,0x00,
0x30,0x30,0x38,0x3C,0x36,0x30,0x30,0x00,
0x18,0x18,0xFE,0x18,0x18,0x30,0x60,0x00,
0x00,0x7C,0x00,0x00,0x00,0x00,0xFE,0x00,
0x00,0x7E,0x06,0x6C,0x18,0x36,0x60,0x00,
0x18,0x7E,0x0C,0x18,0x3C,0x7E,0x18,0x00,
0x06,0x06,0x06,0x0C,0x18,0x30,0x60,0x00,
0x30,0x18,0x0C,0xC6,0xC6,0xC6,0xC6,0x00,
0xC0,0xC0,0xFE,0xC0,0xC0,0xC0,0x7E,0x00,
0x00,0xFE,0x06,0x06,0x0C,0x18,0x70,0x00,
0x00,0x30,0x78,0xCC,0x06,0x06,0x00,0x00,
0x18,0x18,0xFE,0x18,0xDB,0xDB,0x18,0x00,
0xFE,0x06,0x06,0x6C,0x38,0x30,0x18,0x00,
0x00,0x3C,0x00,0x3C,0x00,0x7C,0x06,0x00,
0x0C,0x18,0x30,0x60,0xCC,0xFC,0x06,0x00,
0x02,0x36,0x3C,0x18,0x3C,0x6C,0xC0,0x00,
0x00,0xFE,0x30,0xFE,0x30,0x30,0x3E,0x00,
0x30,0x30,0xFE,0x36,0x3C,0x30,0x30,0x00,
0x00,0x78,0x18,0x18,0x18,0x18,0xFE,0x00,
0xFE,0x06,0x06,0xFE,0x06,0x06,0xFE,0x00,
0x7C,0x00,0xFE,0x06,0x0C,0x18,0x30,0x00,
0xC6,0xC6,0xC6,0x06,0x06,0x0C,0x38,0x00,
0x6C,0x6C,0x6C,0x6E,0x6E,0x6C,0xC8,0x00,
0x60,0x60,0x60,0x66,0x6C,0x78,0x70,0x00,
0x00,0xFE,0xC6,0xC6,0xC6,0xC6,0xFE,0x00,
0x00,0xFE,0xC6,0xC6,0x06,0x0C,0x38,0x00,
0x00,0xF0,0x06,0x06,0x0C,0x18,0xF0,0x00,
0x18,0xCC,0x60,0x00,0x00,0x00,0x00,0x00,
0x70,0xD8,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,
0x18,0x18,0x1F,0x18,0x18,0x1F,0x18,0x18,
0x18,0x18,0xFF,0x18,0x18,0xFF,0x18,0x18,
0x18,0x18,0xF8,0x18,0x18,0xF8,0x18,0x18,
0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,
0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF,
0xFF,0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,
0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,
0x10,0x38,0x7C,0xFE,0xFE,0x38,0x7C,0x00,
0x6C,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,
0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,
0x38,0x38,0xFE,0xFE,0xD6,0x10,0x7C,0x00,
0x00,0x3C,0x7E,0x7E,0x7E,0x7E,0x3C,0x00,
0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,
0x03,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,
0x80,0xC0,0x60,0x30,0x18,0x0C,0x06,0x03,
0x83,0xC6,0x6C,0x38,0x38,0x6C,0xC6,0x83,
0xFE,0xB6,0xB6,0xFE,0x86,0x86,0x86,0x00,
0xC0,0xFE,0xD8,0x7E,0x58,0xFE,0x18,0x00,
0x7E,0x66,0x7E,0x66,0x7E,0x66,0xC6,0x00,
0xFE,0xC6,0xC6,0xFE,0xC6,0xC6,0xFE,0x00,
0x06,0xEF,0xA6,0xFF,0xA2,0xFF,0x0A,0x06,
0x00,0x38,0x6C,0xC6,0x7C,0x34,0x6C,0x00,
0xFC,0x6C,0xFE,0x6E,0xF6,0xEC,0x6C,0x78,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
void g_pset(int x,int y,unsigned int c)
// (x,y)の位置にカラーcで点を描画
{
if(x<0 || x>=X_RES) return;
if(y<0 || y>=Y_RES) return;
*(VRAM+y*X_RES+x)=(unsigned short)c;
}
void g_putbmpmn(int x,int y,char m,char n,const unsigned short bmp[])
// 横m*縦nドットのキャラクターを座標x,yに表示
// unsigned char bmp[m*n]配列に、単純にカラー番号を並べる
// カラー番号が0の部分は透明色として扱う
{
int i,j;
unsigned short *vp;
const unsigned short *p;
if(x<=-m || x>X_RES || y<=-n || y>=Y_RES) return; //画面外
if(y<0){ //画面上部に切れる場合
i=0;
p=bmp-y*m;
}
else{
i=y;
p=bmp;
}
for(;i<y+n;i++){
if(i>=Y_RES) return; //画面下部に切れる場合
if(x<0){ //画面左に切れる場合は残る部分のみ描画
j=0;
p+=-x;
vp=VRAM+i*X_RES;
}
else{
j=x;
vp=VRAM+i*X_RES+x;
}
for(;j<x+m;j++){
if(j>=X_RES){ //画面右に切れる場合
p+=x+m-j;
break;
}
if(*p!=0){ //カラー番号が0の場合、透明として処理
*vp=*p;
}
p++;
vp++;
}
}
}
void g_clrbmpmn(int x,int y,char m,char n)
// 縦m*横nドットのキャラクター消去
// カラー0で塗りつぶし
{
int i,j;
unsigned short *vp;
if(x<=-m || x>=X_RES || y<=-n || y>=Y_RES) return; //画面外
if(y<0){ //画面上部に切れる場合
i=0;
}
else{
i=y;
}
for(;i<y+n;i++){
if(i>=Y_RES) return; //画面下部に切れる場合
if(x<0){ //画面左に切れる場合は残る部分のみ描画
j=0;
vp=VRAM+i*X_RES;
}
else{
j=x;
vp=VRAM+i*X_RES+x;
}
for(;j<x+m;j++){
if(j>=X_RES){ //画面右に切れる場合
break;
}
*vp++=0;
}
}
}
void g_gline(int x1,int y1,int x2,int y2,unsigned int c)
// (x1,y1)-(x2,y2)にカラーcで線分を描画
{
int sx,sy,dx,dy,i;
int e;
if(x2>x1){
dx=x2-x1;
sx=1;
}
else{
dx=x1-x2;
sx=-1;
}
if(y2>y1){
dy=y2-y1;
sy=1;
}
else{
dy=y1-y2;
sy=-1;
}
if(dx>=dy){
e=-dx;
for(i=0;i<=dx;i++){
g_pset(x1,y1,c);
x1+=sx;
e+=dy*2;
if(e>=0){
y1+=sy;
e-=dx*2;
}
}
}
else{
e=-dy;
for(i=0;i<=dy;i++){
g_pset(x1,y1,c);
y1+=sy;
e+=dx*2;
if(e>=0){
x1+=sx;
e-=dy*2;
}
}
}
}
void g_circle(int x0,int y0,unsigned int r,unsigned int c)
// (x0,y0)を中心に、半径r、カラーcの円を描画
{
int x,y,f;
x=r;
y=0;
f=-2*r+3;
while(x>=y){
g_pset(x0-x,y0-y,c);
g_pset(x0-x,y0+y,c);
g_pset(x0+x,y0-y,c);
g_pset(x0+x,y0+y,c);
g_pset(x0-y,y0-x,c);
g_pset(x0-y,y0+x,c);
g_pset(x0+y,y0-x,c);
g_pset(x0+y,y0+x,c);
if(f>=0){
x--;
f-=x*4;
}
y++;
f+=y*4+2;
}
}
void g_hline(int x1,int x2,int y,unsigned int c)
// (x1,y)-(x2,y)の水平ラインをカラーcで高速描画
{
int temp;
unsigned int d,*ad;
if(y<0 || y>=Y_RES) return;
if(x1>x2){
temp=x1;
x1=x2;
x2=temp;
}
if(x2<0 || x1>=X_RES) return;
if(x1<0) x1=0;
if(x2>=X_RES) x2=X_RES-1;
if(x1&1){
g_pset(x1++,y,c);
if(x1>x2) return;
}
d=c|(c<<16);
ad=(unsigned int *)(VRAM+y*X_RES+x1);
while(x1+1<=x2){
*ad++=d;
x1+=2;
}
while(x1<=x2) g_pset(x1++,y,c);
}
void g_boxfill(int x1,int y1,int x2,int y2,unsigned int c)
// (x1,y1),(x2,y2)を対角線とするカラーcで塗られた長方形を描画
{
int temp;
if(x1>x2){
temp=x1;
x1=x2;
x2=temp;
}
if(x2<0 || x1>=X_RES) return;
if(y1>y2){
temp=y1;
y1=y2;
y2=temp;
}
if(y2<0 || y1>=Y_RES) return;
if(y1<0) y1=0;
if(y2>=Y_RES) y2=Y_RES-1;
while(y1<=y2){
g_hline(x1,x2,y1++,c);
}
}
void g_circlefill(int x0,int y0,unsigned int r,unsigned int c)
// (x0,y0)を中心に、半径r、カラーcで塗られた円を描画
{
int x,y,f;
x=r;
y=0;
f=-2*r+3;
while(x>=y){
g_hline(x0-x,x0+x,y0-y,c);
g_hline(x0-x,x0+x,y0+y,c);
g_hline(x0-y,x0+y,y0-x,c);
g_hline(x0-y,x0+y,y0+x,c);
if(f>=0){
x--;
f-=x*4;
}
y++;
f+=y*4+2;
}
}
void g_putfont(int x,int y,unsigned int c,int bc,unsigned char n)
//8*8ドットのアルファベットフォント表示
//座標(x,y)、カラー番号c
//bc:バックグランドカラー、負数の場合無視
//n:文字番号
{
int i,j;
unsigned char d;
const unsigned char *p;
p=FontData+n*8;
for(i=0;i<8;i++){
d=*p++;
for(j=0;j<8;j++){
if(d&0x80) g_pset(x+j,y+i,c);
else if(bc>=0) g_pset(x+j,y+i,bc);
d<<=1;
}
}
}
void g_printstr(int x,int y,unsigned int c,int bc,unsigned char *s){
//座標(x,y)からカラー番号cで文字列sを表示、bc:バックグランドカラー
while(*s){
g_putfont(x,y,c,bc,*s++);
x+=8;
}
}
void g_printnum(int x,int y,unsigned char c,int bc,unsigned int n){
//座標(x,y)にカラー番号cで数値nを表示、bc:バックグランドカラー
unsigned int d,e;
d=10;
e=0;
while(n>=d){
e++;
if(e==9) break;
d*=10;
}
x+=e*8;
do{
g_putfont(x,y,c,bc,'0'+n%10);
n/=10;
x-=8;
}while(n!=0);
}
void g_printnum2(int x,int y,unsigned char c,int bc,unsigned int n,unsigned char e){
//座標(x,y)にカラー番号cで数値nを表示、bc:バックグランドカラー、e桁で表示
if(e==0) return;
x+=(e-1)*8;
do{
g_putfont(x,y,c,bc,'0'+n%10);
e--;
n/=10;
x-=8;
}while(e!=0 && n!=0);
while(e!=0){
g_putfont(x,y,c,bc,' ');
x-=8;
e--;
}
}
unsigned int g_color(int x,int y){
//座標(x,y)のVRAM上の現在のパレット番号を返す、画面外は0を返す
if(x<0 || x>=X_RES || y<0 || y>=Y_RES) return 0;
return *(VRAM+y*Y_RES+x);
}
void g_clearscreen(void)
{
unsigned int *vp;
int i;
vp=(unsigned int *)VRAM;
for(i=0;i<X_RES*Y_RES/2;i++) *vp++=0;
}