|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2018 [email protected]
4: //
5:
6: #pragma once
7:
8: #include <atomic>
9:
10: class WXMainView
11: : public wxPanel
12: {
13: typedef wxPanel inherited;
14: public:
15: WXMainView(wxWindow *);
16: virtual ~WXMainView();
17:
18: void DoRefresh();
19: void DoResize(double scale);
20:
21: // 現在のスケールを返す
22: double GetScale() const;
23: // 現在のスケール (wxapp が初期値を指定するため static 変数にしてある)
24: static double screen_scale;
25:
26: private:
27: void OnPaint(wxPaintEvent& event);
28:
29: void DoPaint(wxDC &dc);
30:
31: void OnKeyDown(wxKeyEvent& event);
32: void OnKeyUp(wxKeyEvent& event);
33:
34: // 裏バッファ。
35: // VM がレンダリングするバッファ。
36: uint8_t *ImageBuf = NULL;
37:
38: // 仮想画面サイズ (ピクセル)
39: int rendwidth = 0;
40: int rendheight = 0;
41:
42: // 実画面サイズ (ピクセル)
43: int viewwidth = 0;
44: int viewheight = 0;
45:
46: // 共通キーコードを取得する
47: int GetKeyCode(wxKeyEvent& event);
48:
49: #if defined(__WXGTK__)
50: static const int keycode_table[0xd4];
51: #elif defined(__WXOSX__)
52: static const int keycode_table[0x80];
53: #endif
54:
55: wxTimer paintTimer;
56: std::atomic<bool> paintRequested {};
57: void OnTimer(wxTimerEvent& event);
58:
59: wxDECLARE_EVENT_TABLE();
60: };
61:
62: extern WXMainView *gMainView;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.