なぞの絵(2)
たいぶ実装(APIのBayGUI化)が進んでいる様子
// Encoding UTF-8N... #include <baygui.h> /* OSASKパレット */ static int osapal_r[9] = {0, 128, 0, 128, 0, 128, 0, 128, 192}; static int osapal_g[9] = {0, 0, 128, 128, 0, 0, 128, 128, 192}; static int osapal_b[9] = {0, 0, 0, 0, 128, 128, 128, 128, 192}; static int col = 0; class GHello : public Window { public: _P<Label> label1; _P<Timer> timer1; GHello() { this->InitializeComponent(); this->chgcol(this, EventArgs::get_Empty()); } private: void chgcol(_P<Object> sender, _P<EventArgs> e) { label1->setForeground(Color::FromArgb(osapal_r[col], osapal_g[col], osapal_b[col])); col++; if (col > 7) col = 0; } protected: virtual void create() { Window::create(); this->timer1->start(); } virtual void dispose() { this->timer1->dispose(); Window::dispose(); } private: void InitializeComponent() { this->label1 = new Label(); this->setBackground(Color::FromArgb(osapal_r[8], osapal_g[8], osapal_b[8])); /* ウィンドウの位置<Point(Xpos, Ypos)> */ this->setLocation(Point(300, 164)); /* ウィンドウのサイズ。<Size(Xsize, Ysize)> */ this->setClientSize(Size(14 * 8, 4 * 16)); this->setText(" M t . o r z 0 "); /* <Rect(Xpos, Ypos, Xsize, Ysize)> */ this->label1->setBounds(Rect(8, 8, 12 * 8, 3 * 16)); this->label1->setBackground(Color::FromArgb(osapal_r[8], osapal_g[8], osapal_b[8])); this->label1->setText( " orz\n" " orz orz\n" " orz orz orz\n" "orz orz orz orz"); this->getControls()->Add(this->label1.get()); this->timer1 = new Timer(); this->timer1->setInterval(500); this->timer1->add_Tick(new EventHandler<GHello>(this, &GHello::chgcol)); } }; int MonaMain(List<char*>* pekoe) { GHello *hello = new GHello(); hello->run(); delete(hello); return 0; }