|
|
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:
1.1.1.2 ! root 26: // マウスモードを設定
! 27: void SetMouseMode(bool enable);
! 28: // マウスモードを取得 (キャプチャされているなら true)
! 29: bool GetMouseMode() const { return mousemode; }
! 30:
1.1 root 31: private:
32: void OnPaint(wxPaintEvent& event);
33:
34: void DoPaint(wxDC &dc);
35:
36: void OnKeyDown(wxKeyEvent& event);
37: void OnKeyUp(wxKeyEvent& event);
1.1.1.2 ! root 38: void OnMouse(wxMouseEvent& event);
1.1 root 39:
40: // 裏バッファ。
41: // VM がレンダリングするバッファ。
42: uint8_t *ImageBuf = NULL;
43:
44: // 仮想画面サイズ (ピクセル)
45: int rendwidth = 0;
46: int rendheight = 0;
47:
48: // 実画面サイズ (ピクセル)
49: int viewwidth = 0;
50: int viewheight = 0;
51:
52: // 共通キーコードを取得する
53: int GetKeyCode(wxKeyEvent& event);
54:
55: #if defined(__WXGTK__)
56: static const int keycode_table[0xd4];
57: #elif defined(__WXOSX__)
58: static const int keycode_table[0x80];
59: #endif
60:
1.1.1.2 ! root 61: // マウスモード (キャプチャしていれば true)
! 62: bool mousemode = false;
! 63: // 前回のマウス座標
! 64: wxPoint prevpos {};
! 65: // WarpPointer() による移動検出用
! 66: bool motion_by_warp_pointer = false;
! 67: // マウスカーソルを移動させる
! 68: void MyWarpPointer(wxSize pos);
! 69:
1.1 root 70: wxTimer paintTimer;
71: std::atomic<bool> paintRequested {};
72: void OnTimer(wxTimerEvent& event);
73:
74: wxDECLARE_EVENT_TABLE();
75: };
76:
77: extern WXMainView *gMainView;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.