|
|
1.1 root 1: //
2: // nono
1.1.1.2 ! root 3: // Copyright (C) 2020 nono project
! 4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "wxsubwindow.h"
1.1.1.2 ! root 10: #include "object.h"
1.1 root 11:
12: //
13: // LUNA ビットマップパネル
14: //
15: class WXLunaBitmapPanel : public wxScrolledWindow
16: {
1.1.1.2 ! root 17: using inherited = wxScrolledWindow;
1.1 root 18: public:
19: WXLunaBitmapPanel(wxWindow *parent);
20: virtual ~WXLunaBitmapPanel();
21:
22: private:
23: void OnSize(wxSizeEvent& event);
24: void OnPaint(wxPaintEvent& event);
25: void OnScrollWin(wxScrollWinEvent& event);
26: void Draw();
27:
28: const uint8 *src = NULL; // Bitmap デバイス内のバッファを指す
1.1.1.2 ! root 29: std::unique_ptr<uint8[]> bmpbuf {}; // 裏バッファ
1.1 root 30:
31: int view_x = 0; // ビューの表示開始 X 座標
32: int view_y = 0; // ビューの表示開始 Y 座標
33: int view_width = 0; // ビュー幅
34: int view_height = 0; // ビュー高さ
35:
36: // 縦は1ドットずつ処理出来るので特筆することはない。
37: // 横は少なくともバイト(8ドット)単位に制限したほうが実装が楽。
38: // 今はロングワード単位で描画しているため 32ドット単位としている。
39: static const int virtual_width = 2048; // 仮想画面幅 [pixel]
40: static const int virtual_height = 1024; // 仮想画面高さ [pixel]
41: static const int width_per_unit = 32; // 横スクロール単位 [pixel]
42: static const int height_per_unit = 1; // 縦スクロール単位 [pixel]
43: static_assert(virtual_width % width_per_unit == 0, "");
44: static_assert(virtual_height % height_per_unit == 0, "");
45:
46: // イベントテーブル
47: wxDECLARE_EVENT_TABLE();
48: };
49:
50: //
51: // LUNA ビットマップウィンドウ
52: //
53: class WXLunaBitmapWindow : public WXSubWindow
54: {
1.1.1.2 ! root 55: using inherited = WXSubWindow;
1.1 root 56: public:
57: WXLunaBitmapWindow(wxWindow *parent, wxWindowID id, const wxString& name);
58: virtual ~WXLunaBitmapWindow();
59:
60: private:
61: // タイマーイベント
62: void OnTimer(wxTimerEvent& event);
63:
64: // グラフィックパネル
65: WXLunaBitmapPanel *panel = NULL;
66:
67: // タイマー
68: wxTimer timer;
69:
70: // イベントテーブル
71: wxDECLARE_EVENT_TABLE();
72: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.