• R/O
  • SSH
  • HTTPS

haribote: Commit


Commit MetaInfo

Revision186 (tree)
Time2007-08-04 17:11:42
Authorbayside

Log Message

baygui implemented

Change Summary

Incremental Difference

--- haribote/trunk/bayos_exp/bootpack.cpp (revision 185)
+++ haribote/trunk/bayos_exp/bootpack.cpp (revision 186)
@@ -86,7 +86,8 @@
8686 sheet_back = SheetManager::allocate(sheet_manager);
8787 buf_back = (unsigned short *) MemoryManager::allocate_4k(memory_manager, sysinfo->scrnx * sysinfo->scrny * 2);
8888 Sheet::set_buffer(sheet_back, buf_back, sysinfo->scrnx, sysinfo->scrny, -1); /* 透明色なし */
89- Graphics::init(buf_back, sysinfo->scrnx, sysinfo->scrny);
89+ //Graphics::init(buf_back, sysinfo->scrnx, sysinfo->scrny);
90+ Gui::init(fat, memory_manager, buf_back, sysinfo->scrnx, sysinfo->scrny);
9091
9192 /* sheet_console */
9293 key_win = open_console(sheet_manager, memtotal);
@@ -345,7 +346,8 @@
345346
346347 void keywin_off(Sheet *key_win)
347348 {
348- Window::change_wtitle(key_win, 0);
349+ //Window::change_wtitle(key_win, 0);
350+ Gui::drawTitle(key_win, false);
349351 if ((key_win->flags & 0x20) != 0) {
350352 Queue::push(&key_win->task->queue, 3); /* コンソールのカーソルOFF */
351353 }
@@ -354,7 +356,8 @@
354356
355357 void keywin_on(Sheet *key_win)
356358 {
357- Window::change_wtitle(key_win, 1);
359+ //Window::change_wtitle(key_win, 1);
360+ Gui::drawTitle(key_win, true);
358361 if ((key_win->flags & 0x20) != 0) {
359362 Queue::push(&key_win->task->queue, 2); /* コンソールのカーソルON */
360363 }
--- haribote/trunk/bayos_exp/window.cpp (revision 185)
+++ haribote/trunk/bayos_exp/window.cpp (revision 186)
@@ -2,7 +2,7 @@
22
33 #include "bootpack.h"
44
5-extern unsigned short table_8_565[256];
5+//extern unsigned short table_8_565[256];
66
77 //void Window::make_window(unsigned short *buf, int xsize, int ysize, char *title, char act)
88 //{
@@ -71,10 +71,12 @@
7171 Task *task = Task::now();
7272 Graphics::fill_rect(sheet->buf, sheet->bxsize, b, x, y, x + l * 8 - 1, y + 15);
7373 if (task->langmode != 0 && task->langbyte1 != 0) {
74- Graphics::draw_string(sheet->buf, sheet->bxsize, x, y, c, s);
74+ //Graphics::draw_string(sheet->buf, sheet->bxsize, x, y, c, s);
75+ Gui::drawString(sheet, s, x, y, c);
7576 Sheet::refresh(sheet, x - 8, y, x + l * 8, y + 16);
7677 } else {
77- Graphics::draw_string(sheet->buf, sheet->bxsize, x, y, c, s);
78+ //Graphics::draw_string(sheet->buf, sheet->bxsize, x, y, c, s);
79+ Gui::drawString(sheet, s, x, y, c);
7880 Sheet::refresh(sheet, x, y, x + l * 8, y + 16);
7981 }
8082 return;
@@ -95,33 +97,33 @@
9597 // return;
9698 //}
9799
98-void Window::change_wtitle(Sheet *sheet, char act)
99-{
100- int x, y, xsize = sheet->bxsize;
101- unsigned char tc_new, tbc_new, tc_old, tbc_old;
102- unsigned short c565, *buf = sheet->buf;
103- if (act != 0) {
104- tc_new = COL8_FFFFFF;
105- tbc_new = COL8_000084;
106- tc_old = COL8_C6C6C6;
107- tbc_old = COL8_848484;
108- } else {
109- tc_new = COL8_C6C6C6;
110- tbc_new = COL8_848484;
111- tc_old = COL8_FFFFFF;
112- tbc_old = COL8_000084;
113- }
114- for (y = 3; y <= 20; y++) {
115- for (x = 3; x <= xsize - 4; x++) {
116- c565 = buf[y * xsize + x];
117- if (c565 == table_8_565[tc_old] && x <= xsize - 22) {
118- c565 = table_8_565[tc_new];
119- } else if (c565 == table_8_565[tbc_old]) {
120- c565 = table_8_565[tbc_new];
121- }
122- buf[y * xsize + x] = c565;
123- }
124- }
125- Sheet::refresh(sheet, 3, 3, xsize, 21);
126- return;
127-}
100+//void Window::change_wtitle(Sheet *sheet, char act)
101+//{
102+// int x, y, xsize = sheet->bxsize;
103+// unsigned char tc_new, tbc_new, tc_old, tbc_old;
104+// unsigned short c565, *buf = sheet->buf;
105+// if (act != 0) {
106+// tc_new = COL8_FFFFFF;
107+// tbc_new = COL8_000084;
108+// tc_old = COL8_C6C6C6;
109+// tbc_old = COL8_848484;
110+// } else {
111+// tc_new = COL8_C6C6C6;
112+// tbc_new = COL8_848484;
113+// tc_old = COL8_FFFFFF;
114+// tbc_old = COL8_000084;
115+// }
116+// for (y = 3; y <= 20; y++) {
117+// for (x = 3; x <= xsize - 4; x++) {
118+// c565 = buf[y * xsize + x];
119+// if (c565 == table_8_565[tc_old] && x <= xsize - 22) {
120+// c565 = table_8_565[tc_new];
121+// } else if (c565 == table_8_565[tbc_old]) {
122+// c565 = table_8_565[tbc_new];
123+// }
124+// buf[y * xsize + x] = c565;
125+// }
126+// }
127+// Sheet::refresh(sheet, 3, 3, xsize, 21);
128+// return;
129+//}
--- haribote/trunk/bayos_exp/gui.cpp (revision 185)
+++ haribote/trunk/bayos_exp/gui.cpp (revision 186)
@@ -1,239 +1,307 @@
11 #include "bootpack.h"
2+#include <string.h>
23
3-#define BLACK 0x0000
4-#define LIGHT_RED 0xf800
4+#define BLACK 0x0000
5+#define LIGHT_RED 0xf800
56 #define LIGHT_GREEN 0x07e0
67 #define LIGHT_YELLOW 0xffe0
78 #define LIGHT_BLUE 0x001f
89 #define LIGHT_PURPLE 0xf81f
910 #define LIGHT_AQUA 0x07ff
10-#define WHITE 0xffff
11+#define WHITE 0xffff
1112 #define LIGHT_GRAY 0xc618
12-#define DARK_RED 0x8000
13+#define DARK_RED 0x8000
1314 #define DARK_GREEN 0x0420
1415 #define DARK_YELLOW 0x8420
15-#define DARK_BLUE 0x0010
16+#define DARK_BLUE 0x0010
1617 #define DARK_PURPLE 0x8010
17-#define DARK_AQUA 0x0410
18-#define DARK_GRAY 0x8410
18+#define DARK_AQUA 0x0410
19+#define DARK_GRAY 0x8410
1920
20-#define FONT_W 6
21-#define FONT_H 12
21+#define FONT_W 6
22+#define FONT_H 12
2223
23-extern unsigned short table_8_565[256];
24+#define inGetUInt16(b) (unsigned short)((unsigned short)((b)[1]) << 8 | (unsigned short)((b)[0]))
2425
25-void Gui::drawPixel(Sheet* sheet, int x, int y, unsigned short col)
26+unsigned char *Gui::fontdata = 0;
27+int *Gui::offsets = 0;
28+
29+void Gui::init(int *fat, MemoryManager *memory_manager, unsigned short *vram, int x, int y)
30+/* 初期化 */
31+{
32+ /* 背景塗りつぶし */
33+ for (int i = 0; i < x * y; i++) {
34+ vram[i] = 0xDF1F;
35+ }
36+
37+ /* shgoth12.fntの読み込み */
38+ FileInfo *finfo = File::search("shgoth12.fnt", (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
39+ if (finfo != 0) {
40+ int size = finfo->size;
41+ Gui::fontdata = File::load_file2(finfo->clustno, &size, fat);
42+ if (Gui::fontdata != 0) {
43+ Gui::offsets = (int *) MemoryManager::allocate_4k(memory_manager, 65536);
44+ if (Gui::offsets != 0) {
45+ int num = inGetUInt16(&Gui::fontdata[0]);
46+ int pos = 4;
47+ for (int i = 0; i < num; i++) {
48+ int fcode = inGetUInt16(&Gui::fontdata[pos]);
49+ offsets[fcode] = pos;
50+ pos += 4;
51+ unsigned char fw = Gui::fontdata[pos++];
52+ unsigned char fh = Gui::fontdata[pos++];
53+ pos += (int)((fw *fh + 7) / 8);
54+ }
55+ }
56+ }
57+ }
58+}
59+
60+void Gui::drawPixel(Sheet *sheet, int x, int y, unsigned short col)
2661 /* 点を打つ */
2762 {
28- int tx = 0;
29- int ty = 0;
30- int cw = sheet->bxsize;
63+ int tx = 0;
64+ int ty = 0;
65+ int cw = sheet->bxsize;
3166
32- sheet->buf[(tx + x) + cw * (ty + y)] = col;
67+ sheet->buf[(tx + x) + cw *(ty + y)] = col;
3368 }
3469
35-void Gui::drawLine(Sheet* sheet, int x0, int y0, int x1, int y1, unsigned short col)
70+void Gui::drawLine(Sheet *sheet, int x0, int y0, int x1, int y1, unsigned short col)
3671 /* 線を引く */
3772 {
38- int tx = 0;
39- int ty = 0;
40- int cw = sheet->bxsize;
41- int dx = (x0 > x1) ? (x0 - x1) : (x1 - x0);
42- int dy = (y0 > y1) ? (y0 - y1) : (y1 - y0);
73+ int tx = 0;
74+ int ty = 0;
75+ int cw = sheet->bxsize;
76+ int dx = (x0 > x1) ? (x0 - x1) : (x1 - x0);
77+ int dy = (y0 > y1) ? (y0 - y1) : (y1 - y0);
4378
44- if (dx == 0 && dy == 0) {
45- sheet->buf[(tx + x0) + cw * (ty + y0)] = col;
46- } else if (dx >= dy) {
47- if (x0 > x1) {
48- int tx = x0;
49- x0 = x1;
50- x1 = tx;
51- int ty = y0;
52- y0 = y1;
53- y1 = ty;
54- }
55- for (int x = x0; x <= x1; x++) {
56- sheet->buf[(tx + x) + cw * (ty + ((2 * y0 + 2 * (y1 - y0) * (x - x0) / (x1 - x0)) + 1) / 2)] = col;
57- }
58- } else {
59- if (y0 > y1) {
60- int tx = x0;
61- x0 = x1;
62- x1 = tx;
63- int ty = y0;
64- y0 = y1;
65- y1 = ty;
66- }
67- for (int y = y0; y <= y1; y++) {
68- sheet->buf[(tx + (2 * x0 + 2 * (x1 - x0) * (y - y0) / (y1 - y0) + 1) / 2) + cw * (ty + y)] = col;
69- }
70- }
79+ if (dx == 0 && dy == 0) {
80+ sheet->buf[(tx + x0) + cw *(ty + y0)] = col;
81+ } else if (dx >= dy) {
82+ if (x0 > x1) {
83+ int tx = x0;
84+ x0 = x1;
85+ x1 = tx;
86+ int ty = y0;
87+ y0 = y1;
88+ y1 = ty;
89+ }
90+ for (int x = x0; x <= x1; x++) {
91+ sheet->buf[(tx + x) + cw *(ty + ((2 *y0 + 2 *(y1 - y0) *(x - x0) / (x1 - x0)) + 1) / 2)] = col;
92+ }
93+ } else {
94+ if (y0 > y1) {
95+ int tx = x0;
96+ x0 = x1;
97+ x1 = tx;
98+ int ty = y0;
99+ y0 = y1;
100+ y1 = ty;
101+ }
102+ for (int y = y0; y <= y1; y++) {
103+ sheet->buf[(tx + (2 *x0 + 2 *(x1 - x0) *(y - y0) / (y1 - y0) + 1) / 2) + cw *(ty + y)] = col;
104+ }
105+ }
71106 }
72107
73-void Gui::drawRect(Sheet* sheet, int x, int y, int width, int height, unsigned short col)
108+void Gui::drawRect(Sheet *sheet, int x, int y, int width, int height, unsigned short col)
74109 /* 矩形を描く */
75110 {
76- int tx = 0;
77- int ty = 0;
78- int cw = sheet->bxsize;
79- int xw = x + width - 1;
80- int yh = y + height - 1;
111+ int tx = 0;
112+ int ty = 0;
113+ int cw = sheet->bxsize;
114+ int xw = x + width - 1;
115+ int yh = y + height - 1;
81116
82- for (int xx = x; xx <= xw; xx++) {
83- sheet->buf[(tx + xx) + cw * (ty + y)] = col;
84- sheet->buf[(tx + xx) + cw * (ty + yh)] = col;
85- }
86- for (int yy = y + 1; yy <= yh - 1; yy++) {
87- sheet->buf[(tx + x) + cw * (ty + yy)] = col;
88- sheet->buf[(tx + xw) + cw * (ty + yy)] = col;
89- }
117+ for (int xx = x; xx <= xw; xx++) {
118+ sheet->buf[(tx + xx) + cw *(ty + y)] = col;
119+ sheet->buf[(tx + xx) + cw *(ty + yh)] = col;
120+ }
121+ for (int yy = y + 1; yy <= yh - 1; yy++) {
122+ sheet->buf[(tx + x) + cw *(ty + yy)] = col;
123+ sheet->buf[(tx + xw) + cw *(ty + yy)] = col;
124+ }
90125 }
91126
92-void Gui::fillRect(Sheet* sheet, int x0, int y0, int x1, int y1, unsigned short col)
127+void Gui::fillRect(Sheet *sheet, int x0, int y0, int x1, int y1, unsigned short col)
93128 /* 矩形を塗りつぶす */
94129 {
95- int tx = 0;
96- int ty = 0;
97- int cw = sheet->bxsize;
130+ int tx = 0;
131+ int ty = 0;
132+ int cw = sheet->bxsize;
98133
99- for (int y = y0; y < y0 + y1; y++) {
100- for (int x = x0; x < x0 + x1; x++) {
101- sheet->buf[(tx + x) + cw * (ty + y)] = col;
102- }
103- }
134+ for (int y = y0; y < y0 + y1; y++) {
135+ for (int x = x0; x < x0 + x1; x++) {
136+ sheet->buf[(tx + x) + cw *(ty + y)] = col;
137+ }
138+ }
104139 }
105140
106-void Gui::drawString(Sheet* sheet, char* title, int x0, int y0, unsigned short col)
141+void Gui::drawString(Sheet *sheet, char *title, int x0, int y0, unsigned short col, StringInfo *info)
107142 /* 文字列を描画する */
108143 {
109-#if 0
110- int bw = 0, bh = FONT_H, length = 0;
111- int sw = sheet != NULL ? sheet->bxsize : 0;
112- int I = strlen(title);
144+ int bw = 0, bh = FONT_H, length = 0;
145+ int sw = sheet != 0 ? sheet->bxsize : 0;
113146
114- for (int i = 0; i < I;) {
115- unsigned short ucs2 = 0;
116- byte c = title[i] & 0xe0;
117- if (c < 0x80) {
118- ucs2 = (unsigned short) title[i];
119- i++;
120- } else if (c < 0xe0) {
121- ucs2 = (unsigned short) title[i] & 0x1f;
122- i++;
123- ucs2 = ucs2 << 6;
124- ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
125- i++;
126- } else if (c < 0xf0) {
127- ucs2 = (unsigned short) title[i] & 0x0f;
128- i++;
129- ucs2 = ucs2 << 6;
130- ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
131- i++;
132- ucs2 = ucs2 << 6;
133- ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
134- i++;
135- }
147+ if (Gui::fontdata == 0 || Gui::offsets == 0) return;
136148
137- int offset = offsets[ucs2] + 4;
138- if (offset != 0) {
139- byte fw = SheetCtl::zenkaku[offset++];
140- byte fh = SheetCtl::zenkaku[offset++];
141- if (sw > 0) {
142- int bit = 1;
143- for (int y = 0; y < fh; y++) {
144- for (int x = 0; x < fw; x++) {
145- if ((SheetCtl::zenkaku[offset] & bit) != 0) {
146- sheet->buf[(x0 + x + bw) + sw * (y0 + y)] = col;
147- }
148- bit <<= 1;
149- if (bit == 256) {
150- offset++;
151- bit = 1;
152- }
153- }
154- }
155- }
156- bw += fw;
157- length++;
158- }
159- }
160-#endif
149+ int I = strlen(title);
150+ for (int i = 0; i < I;) {
151+ unsigned short ucs2 = 0;
152+ unsigned char c = title[i] & 0xe0;
153+ if (c < 0x80) {
154+ ucs2 = (unsigned short) title[i];
155+ i++;
156+ } else if (c < 0xe0) {
157+ ucs2 = (unsigned short) title[i] & 0x1f;
158+ i++;
159+ ucs2 = ucs2 << 6;
160+ ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
161+ i++;
162+ } else if (c < 0xf0) {
163+ ucs2 = (unsigned short) title[i] & 0x0f;
164+ i++;
165+ ucs2 = ucs2 << 6;
166+ ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
167+ i++;
168+ ucs2 = ucs2 << 6;
169+ ucs2 = ucs2 | ((unsigned short) title[i] & 0x3f);
170+ i++;
171+ }
172+
173+ int offset = offsets[ucs2] + 4;
174+ if (offset != 0) {
175+ unsigned char fw = Gui::fontdata[offset++];
176+ unsigned char fh = Gui::fontdata[offset++];
177+ if (sw > 0) {
178+ int bit = 1;
179+ for (int y = 0; y < fh; y++) {
180+ for (int x = 0; x < fw; x++) {
181+ if ((Gui::fontdata[offset] & bit) != 0) {
182+ sheet->buf[(x0 + x + bw) + sw *(y0 + y)] = col;
183+ }
184+ bit <<= 1;
185+ if (bit == 256) {
186+ offset++;
187+ bit = 1;
188+ }
189+ }
190+ }
191+ }
192+ bw += fw;
193+ length++;
194+ }
195+ }
196+ if (info != 0) {
197+ info->width = bw;
198+ info->height = bh;
199+ info->length = length;
200+ }
161201 }
162202
163-void Gui::drawFrame(Sheet* sheet, char* title)
164-/* 枠を描く */
203+void Gui::drawTitle(Sheet *sheet, bool active)
204+/* タイトルを描画する */
165205 {
166- int w = sheet->bxsize;
167- int h = sheet->bysize;
206+ int w = sheet->bxsize;
168207
169- /* 背景塗りつぶし */
170- fillRect(sheet, 0, 0, w, h, LIGHT_GRAY);
208+ /* 閉じるボタン */
209+ static unsigned char icon_close_data [] =
210+ {
211+ 0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x2,
212+ 0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,
213+ 0x1,0x0,0x8,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x8,
214+ 0x1,0x0,0x2,0x5,0x5,0x3,0x3,0x7,0x7,0x2,0x1,0x0,0x8,
215+ 0x1,0x0,0x2,0x5,0x3,0x3,0x7,0x7,0x2,0x2,0x1,0x0,0x8,
216+ 0x1,0x0,0x2,0x3,0x3,0x7,0x7,0x2,0x2,0x6,0x1,0x0,0x8,
217+ 0x1,0x0,0x2,0x3,0x7,0x7,0x2,0x2,0x6,0x6,0x1,0x0,0x8,
218+ 0x1,0x0,0x2,0x7,0x7,0x2,0x2,0x6,0x6,0x4,0x1,0x0,0x8,
219+ 0x1,0x0,0x2,0x7,0x2,0x2,0x6,0x6,0x4,0x4,0x1,0x0,0x8,
220+ 0x1,0x0,0x2,0x2,0x2,0x6,0x6,0x4,0x4,0x8,0x1,0x0,0x8,
221+ 0x1,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x8,
222+ 0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,
223+ 0x2,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
224+ };
225+ static unsigned short icon_close_pallete [] =
226+ {
227+ 0x18c3,
228+ 0x8c71,
229+ 0xce79,
230+ 0xad75,
231+ 0xef7d,
232+ 0x9cf3,
233+ 0xdefb,
234+ 0xbdf7,
235+ 0xffff,
236+ };
171237
172- /* 閉じるボタン */
173- static unsigned char icon_close_data [] = {
174- 0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x2,
175- 0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,
176- 0x1,0x0,0x8,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x8,
177- 0x1,0x0,0x2,0x5,0x5,0x3,0x3,0x7,0x7,0x2,0x1,0x0,0x8,
178- 0x1,0x0,0x2,0x5,0x3,0x3,0x7,0x7,0x2,0x2,0x1,0x0,0x8,
179- 0x1,0x0,0x2,0x3,0x3,0x7,0x7,0x2,0x2,0x6,0x1,0x0,0x8,
180- 0x1,0x0,0x2,0x3,0x7,0x7,0x2,0x2,0x6,0x6,0x1,0x0,0x8,
181- 0x1,0x0,0x2,0x7,0x7,0x2,0x2,0x6,0x6,0x4,0x1,0x0,0x8,
182- 0x1,0x0,0x2,0x7,0x2,0x2,0x6,0x6,0x4,0x4,0x1,0x0,0x8,
183- 0x1,0x0,0x2,0x2,0x2,0x6,0x6,0x4,0x4,0x8,0x1,0x0,0x8,
184- 0x1,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x8,
185- 0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,
186- 0x2,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
187- };
188- static unsigned short icon_close_pallete [] = {
189- 0x18c3,
190- 0x8c71,
191- 0xce79,
192- 0xad75,
193- 0xef7d,
194- 0x9cf3,
195- 0xdefb,
196- 0xbdf7,
197- 0xffff,
198- };
238+ /* タイトル領域塗りつぶし */
239+ fillRect(sheet, 3, 3, w - 6, 17, LIGHT_GRAY);
199240
200- for (int y = 0; y < 13; y++) {
201- for (int x = 0; x < 13; x++) {
202- sheet->buf[(y + 4) * w + (x + 4)] =
203- icon_close_pallete[icon_close_data[y * 13 + x]];
204- }
205- }
241+ /* 閉じるボタン */
242+ if (active) {
243+ for (int y = 0; y < 13; y++) {
244+ for (int x = 0; x < 13; x++) {
245+ sheet->buf[(y + 4) * w + (x + 4)] =
246+ icon_close_pallete[icon_close_data[y *13 + x]];
247+ }
248+ }
249+ }
206250
207- /* 外枠 */
208- Gui::drawRect(sheet, 0, 0, w, h, BLACK);
251+ /* タイトル幅 */
252+ StringInfo info;
253+ Gui::drawString(0, sheet->title, 0, 0, 0, &info);
254+ int L = info.width + FONT_W;
255+ int W = (w - L) / 2;
209256
210- /* 内枠 */
211- Gui::drawRect(sheet, 5, 21, w - 10, h - 26, BLACK);
257+ /* タイトル線 */
258+ if (active) {
259+ for (int y = 4; y <= 14; y += 2) {
260+ Gui::drawLine(sheet, 21, y, W - 1, y, WHITE);
261+ Gui::drawLine(sheet, 22, y + 1, W, y + 1, DARK_GRAY);
262+ Gui::drawLine(sheet, W + L, y, w - 6, y, WHITE);
263+ Gui::drawLine(sheet, W + L + 1, y + 1, w - 5, y + 1, DARK_GRAY);
264+ }
265+ }
212266
213- /* 縁線 */
214- Gui::drawLine(sheet, 4, 20, 4, h - 6, DARK_GRAY);
215- Gui::drawLine(sheet, 4, 20, w - 6, 20, DARK_GRAY);
216- Gui::drawLine(sheet, w - 5, 21, w - 5, h - 6, WHITE);
217- Gui::drawLine(sheet, 4, h - 5, w - 5, h - 5, WHITE);
218- Gui::drawLine(sheet, 1, 1, 1, h - 3, WHITE);
219- Gui::drawLine(sheet, 1, 1, w - 3, 1, WHITE);
220- Gui::drawLine(sheet, w - 2, 2, w - 2, h - 2, DARK_GRAY);
221- Gui::drawLine(sheet, 2, h - 2, w - 3, h - 2, DARK_GRAY);
267+ /* タイトル */
268+ if (active) {
269+ Gui::drawString(sheet, sheet->title, W + FONT_W / 2, ((22 - FONT_H) / 2), BLACK);
270+ Gui::drawString(sheet, sheet->title, W + FONT_W / 2 + 1, ((22 - FONT_H) / 2), BLACK);
271+ } else {
272+ Gui::drawString(sheet, sheet->title, W + FONT_W / 2, ((22 - FONT_H) / 2), DARK_GRAY);
273+ }
222274
223- /* タイトル幅 */
224- Gui::drawString(0, title, 0, 0, 0);
225- int L = 100;//SheetCtl::wstrinfo->width + FONT_W;
226- int W = (w - L) / 2;
275+ /* 描画更新 */
276+ Sheet::refresh(sheet, 0, 0, w, 20);
277+}
227278
228- /* タイトル線 */
229- for (int y = 4; y <= 14; y += 2) {
230- Gui::drawLine(sheet, 21, y, W - 1, y, WHITE);
231- Gui::drawLine(sheet, 22, y + 1, W, y + 1, DARK_GRAY);
232- Gui::drawLine(sheet, W + L, y, w - 6, y, WHITE);
233- Gui::drawLine(sheet, W + L + 1, y + 1, w - 5, y + 1, DARK_GRAY);
234- }
279+void Gui::drawFrame(Sheet *sheet, char *title)
280+/* 枠を描く */
281+{
282+ int w = sheet->bxsize;
283+ int h = sheet->bysize;
235284
236- /* タイトル */
237- Gui::drawString(sheet, title, W + FONT_W / 2, ((22 - FONT_H) / 2), BLACK);
238- Gui::drawString(sheet, title, W + FONT_W / 2 + 1, ((22 - FONT_H) / 2), BLACK);
285+ /* 背景塗りつぶし */
286+ fillRect(sheet, 0, 0, w, h, LIGHT_GRAY);
287+
288+ /* 外枠 */
289+ Gui::drawRect(sheet, 0, 0, w, h, BLACK);
290+
291+ /* 内枠 */
292+ Gui::drawRect(sheet, 5, 21, w - 10, h - 26, BLACK);
293+
294+ /* 縁線 */
295+ Gui::drawLine(sheet, 4, 20, 4, h - 6, DARK_GRAY);
296+ Gui::drawLine(sheet, 4, 20, w - 6, 20, DARK_GRAY);
297+ Gui::drawLine(sheet, w - 5, 21, w - 5, h - 6, WHITE);
298+ Gui::drawLine(sheet, 4, h - 5, w - 5, h - 5, WHITE);
299+ Gui::drawLine(sheet, 1, 1, 1, h - 3, WHITE);
300+ Gui::drawLine(sheet, 1, 1, w - 3, 1, WHITE);
301+ Gui::drawLine(sheet, w - 2, 2, w - 2, h - 2, DARK_GRAY);
302+ Gui::drawLine(sheet, 2, h - 2, w - 3, h - 2, DARK_GRAY);
303+
304+ /* タイトル */
305+ sheet->title = title;
306+ Gui::drawTitle(sheet, true);
239307 }
--- haribote/trunk/bayos_exp/Makefile (revision 185)
+++ haribote/trunk/bayos_exp/Makefile (revision 186)
@@ -58,6 +58,7 @@
5858 wbinimg src:ipl20.bin len:512 from:0 to:0 \
5959 copy from:haribote.sys to:@: \
6060 copy from:nihongo.fnt to:@: \
61+ copy from:shgoth12.fnt to:@: \
6162 imgout:haribote.img
6263
6364 # copy from:hrbwall.jpg to:@: \
--- haribote/trunk/bayos_exp/console.cpp (revision 185)
+++ haribote/trunk/bayos_exp/console.cpp (revision 186)
@@ -174,7 +174,7 @@
174174 }
175175 for (y = 28 + 112; y < 28 + 128; y++) {
176176 for (x = 8; x < 8 + 240; x++) {
177- sheet->buf[x + y * sheet->bxsize] = COL8_C6C6C6;
177+ sheet->buf[x + y * sheet->bxsize] = table_8_565[COL8_C6C6C6];
178178 }
179179 }
180180 Sheet::refresh(sheet, 8, 28, 8 + 240, 28 + 128);
@@ -458,7 +458,8 @@
458458 reg[7] = (int) sheet;
459459 } else if (edx == 6) {
460460 sheet = (Sheet *) (ebx & 0xfffffffe);
461- Graphics::draw_string(sheet->buf, sheet->bxsize, esi, edi, eax, (char *) ebp + ds_base);
461+ //Graphics::draw_string(sheet->buf, sheet->bxsize, esi, edi, eax, (char *) ebp + ds_base);
462+ Gui::drawString(sheet, (char *) ebp + ds_base, esi, edi, table_8_565[eax]);
462463 if ((ebx & 1) == 0) {
463464 Sheet::refresh(sheet, esi, edi, esi + ecx * 8, edi + 16);
464465 }
--- haribote/trunk/bayos_exp/bootpack.h (revision 185)
+++ haribote/trunk/bayos_exp/bootpack.h (revision 186)
@@ -193,11 +193,11 @@
193193
194194 class Graphics {
195195 public:
196- static void init(unsigned short *vram, int x, int y);
196+ //static void init(unsigned short *vram, int x, int y);
197197 static void fill_rect(unsigned short *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1);
198- static void draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s);
198+ //static void draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s);
199199 private:
200- static void draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font);
200+ //static void draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font);
201201 };
202202
203203 /* descriptor.cpp */
@@ -316,6 +316,7 @@
316316 int bxsize, bysize, vx0, vy0, col_inv, height, flags;
317317 SheetManager *sheet_manager;
318318 Task *task;
319+ char *title;
319320
320321 public:
321322 static void set_buffer(Sheet *sheet, unsigned short *buf, int xsize, int ysize, int col_inv);
@@ -340,14 +341,25 @@
340341 static Sheet *allocate(SheetManager *sheet_manager);
341342 };
342343
344+class StringInfo {
345+public:
346+ int width, height, length;
347+};
348+
343349 class Gui {
344350 public:
345- static void drawPixel(Sheet* sheet, int x, int y, unsigned short col);
346- static void drawLine(Sheet* sheet, int x0, int y0, int x1, int y1, unsigned short col);
347- static void drawRect(Sheet* sheet, int x, int y, int width, int height, unsigned short col);
348- static void fillRect(Sheet* sheet, int x0, int y0, int x1, int y1, unsigned short col);
349- static void drawString(Sheet* sheet, char* title, int x0, int y0, unsigned short col);
350- static void drawFrame(Sheet* sheet, char* title);
351+ static unsigned char *fontdata;
352+ static int *offsets;
353+
354+public:
355+ static void init(int *fat, MemoryManager *memory_manager, unsigned short *vram, int x, int y);
356+ static void drawPixel(Sheet *sheet, int x, int y, unsigned short col);
357+ static void drawLine(Sheet *sheet, int x0, int y0, int x1, int y1, unsigned short col);
358+ static void drawRect(Sheet *sheet, int x, int y, int width, int height, unsigned short col);
359+ static void fillRect(Sheet *sheet, int x0, int y0, int x1, int y1, unsigned short col);
360+ static void drawString(Sheet *sheet, char *title, int x0, int y0, unsigned short col, StringInfo *info = 0);
361+ static void drawTitle(Sheet *sheet, bool active);
362+ static void drawFrame(Sheet *sheet, char *title);
351363 };
352364
353365 /* timer.cpp */
@@ -478,7 +490,7 @@
478490 static void putfonts_asc_sheet(Sheet *sheet, int x, int y, int c, int b, char *s, int l);
479491 //static void make_textbox(Sheet *sheet, int x0, int y0, int sx, int sy, int c);
480492 //static void make_wtitle(unsigned short *buf, int xsize, char *title, char act);
481- static void change_wtitle(Sheet *sheet, char act);
493+ //static void change_wtitle(Sheet *sheet, char act);
482494 };
483495
484496 /* bootpack.cpp */
--- haribote/trunk/bayos_exp/graphic.cpp (revision 185)
+++ haribote/trunk/bayos_exp/graphic.cpp (revision 186)
@@ -90,120 +90,112 @@
9090 return;
9191 }
9292
93-void Graphics::init(unsigned short *vram, int x, int y)
94-{
95- SystemInfo *sysinfo = SystemInfo::get_instance();
93+//void Graphics::init(unsigned short *vram, int x, int y)
94+//{
95+// Graphics::fill_rect(vram, x, COL8_008484, 0, 0, x - 1, y - 29);
96+// Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 28, x - 1, y - 28);
97+// Graphics::fill_rect(vram, x, COL8_FFFFFF, 0, y - 27, x - 1, y - 27);
98+// Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 26, x - 1, y - 1);
99+//
100+// Graphics::fill_rect(vram, x, COL8_FFFFFF, 3, y - 24, 59, y - 24);
101+// Graphics::fill_rect(vram, x, COL8_FFFFFF, 2, y - 24, 2, y - 4);
102+// Graphics::fill_rect(vram, x, COL8_848484, 3, y - 4, 59, y - 4);
103+// Graphics::fill_rect(vram, x, COL8_848484, 59, y - 23, 59, y - 5);
104+// Graphics::fill_rect(vram, x, COL8_000000, 2, y - 3, 59, y - 3);
105+// Graphics::fill_rect(vram, x, COL8_000000, 60, y - 24, 60, y - 3);
106+//
107+// Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 24, x - 4, y - 24);
108+// Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 23, x - 47, y - 4);
109+// Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 47, y - 3, x - 4, y - 3);
110+// Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 3, y - 24, x - 3, y - 3);
111+// return;
112+//}
96113
97- if (sysinfo->vmode == 16) {
98- for (int i = 0; i < x * y; i++) {
99- vram[i] = 0xDF1F;
100- }
101- } else {
102- Graphics::fill_rect(vram, x, COL8_008484, 0, 0, x - 1, y - 29);
103- Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 28, x - 1, y - 28);
104- Graphics::fill_rect(vram, x, COL8_FFFFFF, 0, y - 27, x - 1, y - 27);
105- Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 26, x - 1, y - 1);
114+//void Graphics::draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font)
115+//{
116+// int i;
117+// char d /* data */;
118+// unsigned short *p;
119+// for (i = 0; i < 16; i++) {
120+// p = vram + (y + i) * xsize + x;
121+// d = font[i];
122+// if ((d & 0x80) != 0) { p[0] = table_8_565[c & 0xff]; }
123+// if ((d & 0x40) != 0) { p[1] = table_8_565[c & 0xff]; }
124+// if ((d & 0x20) != 0) { p[2] = table_8_565[c & 0xff]; }
125+// if ((d & 0x10) != 0) { p[3] = table_8_565[c & 0xff]; }
126+// if ((d & 0x08) != 0) { p[4] = table_8_565[c & 0xff]; }
127+// if ((d & 0x04) != 0) { p[5] = table_8_565[c & 0xff]; }
128+// if ((d & 0x02) != 0) { p[6] = table_8_565[c & 0xff]; }
129+// if ((d & 0x01) != 0) { p[7] = table_8_565[c & 0xff]; }
130+// }
131+// return;
132+//}
106133
107- Graphics::fill_rect(vram, x, COL8_FFFFFF, 3, y - 24, 59, y - 24);
108- Graphics::fill_rect(vram, x, COL8_FFFFFF, 2, y - 24, 2, y - 4);
109- Graphics::fill_rect(vram, x, COL8_848484, 3, y - 4, 59, y - 4);
110- Graphics::fill_rect(vram, x, COL8_848484, 59, y - 23, 59, y - 5);
111- Graphics::fill_rect(vram, x, COL8_000000, 2, y - 3, 59, y - 3);
112- Graphics::fill_rect(vram, x, COL8_000000, 60, y - 24, 60, y - 3);
134+//void Graphics::draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s)
135+//{
136+// extern char hankaku[4096];
137+// Task *task = Task::now();
138+// char *nihongo = (char *) *((int *) 0x0fe8), *font;
139+// int k, t;
140+//
141+// if (task->langmode == 0) {
142+// for (; *s != 0x00; s++) {
143+// Graphics::draw_char(vram, xsize, x, y, c, hankaku + *s * 16);
144+// x += 8;
145+// }
146+// }
147+// if (task->langmode == 1) {
148+// for (; *s != 0x00; s++) {
149+// if (task->langbyte1 == 0) {
150+// if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) {
151+// task->langbyte1 = *s;
152+// } else {
153+// Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
154+// }
155+// } else {
156+// if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) {
157+// k = (task->langbyte1 - 0x81) * 2;
158+// } else {
159+// k = (task->langbyte1 - 0xe0) * 2 + 62;
160+// }
161+// if (0x40 <= *s && *s <= 0x7e) {
162+// t = *s - 0x40;
163+// } else if (0x80 <= *s && *s <= 0x9e) {
164+// t = *s - 0x80 + 63;
165+// } else {
166+// t = *s - 0x9f;
167+// k++;
168+// }
169+// task->langbyte1 = 0;
170+// font = nihongo + 256 * 16 + (k * 94 + t) * 32;
171+// Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
172+// Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
173+// }
174+// x += 8;
175+// }
176+// }
177+// if (task->langmode == 2) {
178+// for (; *s != 0x00; s++) {
179+// if (task->langbyte1 == 0) {
180+// if (0x81 <= *s && *s <= 0xfe) {
181+// task->langbyte1 = *s;
182+// } else {
183+// Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
184+// }
185+// } else {
186+// k = task->langbyte1 - 0xa1;
187+// t = *s - 0xa1;
188+// task->langbyte1 = 0;
189+// font = nihongo + 256 * 16 + (k * 94 + t) * 32;
190+// Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
191+// Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
192+// }
193+// x += 8;
194+// }
195+// }
196+// return;
197+//}
113198
114- Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 24, x - 4, y - 24);
115- Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 23, x - 47, y - 4);
116- Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 47, y - 3, x - 4, y - 3);
117- Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 3, y - 24, x - 3, y - 3);
118- }
119- return;
120-}
121-
122-void Graphics::draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font)
123-{
124- int i;
125- char d /* data */;
126- unsigned short *p;
127- for (i = 0; i < 16; i++) {
128- p = vram + (y + i) * xsize + x;
129- d = font[i];
130- if ((d & 0x80) != 0) { p[0] = table_8_565[c & 0xff]; }
131- if ((d & 0x40) != 0) { p[1] = table_8_565[c & 0xff]; }
132- if ((d & 0x20) != 0) { p[2] = table_8_565[c & 0xff]; }
133- if ((d & 0x10) != 0) { p[3] = table_8_565[c & 0xff]; }
134- if ((d & 0x08) != 0) { p[4] = table_8_565[c & 0xff]; }
135- if ((d & 0x04) != 0) { p[5] = table_8_565[c & 0xff]; }
136- if ((d & 0x02) != 0) { p[6] = table_8_565[c & 0xff]; }
137- if ((d & 0x01) != 0) { p[7] = table_8_565[c & 0xff]; }
138- }
139- return;
140-}
141-
142-void Graphics::draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s)
143-{
144- extern char hankaku[4096];
145- Task *task = Task::now();
146- char *nihongo = (char *) *((int *) 0x0fe8), *font;
147- int k, t;
148-
149- if (task->langmode == 0) {
150- for (; *s != 0x00; s++) {
151- Graphics::draw_char(vram, xsize, x, y, c, hankaku + *s * 16);
152- x += 8;
153- }
154- }
155- if (task->langmode == 1) {
156- for (; *s != 0x00; s++) {
157- if (task->langbyte1 == 0) {
158- if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) {
159- task->langbyte1 = *s;
160- } else {
161- Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
162- }
163- } else {
164- if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) {
165- k = (task->langbyte1 - 0x81) * 2;
166- } else {
167- k = (task->langbyte1 - 0xe0) * 2 + 62;
168- }
169- if (0x40 <= *s && *s <= 0x7e) {
170- t = *s - 0x40;
171- } else if (0x80 <= *s && *s <= 0x9e) {
172- t = *s - 0x80 + 63;
173- } else {
174- t = *s - 0x9f;
175- k++;
176- }
177- task->langbyte1 = 0;
178- font = nihongo + 256 * 16 + (k * 94 + t) * 32;
179- Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
180- Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
181- }
182- x += 8;
183- }
184- }
185- if (task->langmode == 2) {
186- for (; *s != 0x00; s++) {
187- if (task->langbyte1 == 0) {
188- if (0x81 <= *s && *s <= 0xfe) {
189- task->langbyte1 = *s;
190- } else {
191- Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
192- }
193- } else {
194- k = task->langbyte1 - 0xa1;
195- t = *s - 0xa1;
196- task->langbyte1 = 0;
197- font = nihongo + 256 * 16 + (k * 94 + t) * 32;
198- Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
199- Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
200- }
201- x += 8;
202- }
203- }
204- return;
205-}
206-
207199 //void putblock8_8(unsigned short *vram, int vxsize, int pxsize,
208200 // int pysize, int px0, int py0, unsigned short *buf, int bxsize)
209201 //{
Show on old repository browser