⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cpp

📁 MONA是为数不多的C++语言编写的一个很小的操作系统
💻 CPP
字号:
// This file is in the public domain.
// There are no restrictions on any sort of usage of this file.

#include <gui/System/Mona/Forms/Application.h>
#include <gui/System/Mona/Forms/Form.h>

#define SCREEN_W 256
#define SCREEN_H 256

extern int cube_init(int,int);
extern int cube_end( void );
extern int cube_draw(unsigned long *);

using namespace System;
using namespace System::Drawing;
using namespace System::Mona::Forms;

class BgBox : public Control
{
public:
    BgBox()
    {
        ::cube_init(SCREEN_W,SCREEN_H);
        this->set_Size(Size(SCREEN_W, SCREEN_H));
    }

    virtual ~BgBox() {
        ::cube_end();
    }

    void Next()
    {
        this->Refresh();
    }

protected:
    virtual void OnPaint(){
        ::cube_draw((unsigned long *)this->buffer->get());
    }
};

class Form1 : public Form
{
public:
    _P<BgBox> bgbox;

    Form1()
    {
        this->InitializeComponent();
    }

private:
    void InitializeComponent()
    {
        this->bgbox = new BgBox();

        this->set_Location(Point(128, 128));
        this->set_ClientSize(Size(SCREEN_W, SCREEN_H));
        this->set_Text(":: cube ::");

        this->get_Controls()->Add(this->bgbox.get());
    }

public:
    static void Main(_A<String> args)
    {
        _P<Form1> f = new Form1();
        for (f->Show(); f->get_Visible(); Application::DoEvents())
        {
            f->bgbox->Next();
        }
    }
};

SET_MAIN_CLASS(Form1)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -