BayGUIキター!!
- 出版社/メーカー: 毎日コミュニケーションズ
- 価格: ¥ 3,990
- メディア: 和書
私製 GUI ライブラリーである BayGUI がようやく移植できました。ソースコードは こちら から落とせます。BayOS 固有部分(ただし、イベントを抜いた表示のみ)は以下のとおりです。
Window::addNotify()
ウィンドウ1枚に、はりぼてOS の下敷き1枚を割り当てています。
#if defined(BAYOS) this->_sheet = Sheet::allocate(getWidth(), getHeight(), -1); this->_sheet->slide(getX(), getY()); this->_sheet->up_down(Sheet::top + 1); #endif
Window::update(int x, int y, int w, int h)
BayGUIの内部形式(32 ビット RGB)からはりぼてOS の内部形式(8 ビット Web セーフカラー)に変換しています。
#if defined(BAYOS) int W = this->getWidth(); for (int j = y; j < y + h; j++) { for (int i = x; i < x + w; i++) { this->_sheet->buf[j * W + i] = Screen::change888to8(this->_buffer->getPixel(i, j)); } } this->_sheet->refresh(x, y, x + w, y + h); #endif
FontMetrics::FontMetrics()
12 ドットモナーフォント を読み込んでいます。
#elif defined(BAYOS) dword read_size; this->defaultFontData = File::load("MONA-12.MNF", &read_size); #endif
わずか20行弱のコードで移植できてしまうのは、われながらびっくりです。ちなみに BayGUI の文字コードは UTF-8 なので、ソースコードは UTF-8 で保存します。