1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
IMPLEMENT_DYNAMIC_CLASS(Control, wxControl);
BEGIN_EVENT_TABLE(Frame, wxFrame)
EVT_CLOSE (Frame::OnClose)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(Control, wxControl)
EVT_CLOSE (Control::OnClose)
EVT_PAINT(Control::OnPaint)
EVT_ERASE_BACKGROUND(Control::OnEraseBackground)
EVT_IDLE(Control::OnIdle)
END_EVENT_TABLE()
Frame::Frame (wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxFrame(parent, -1, wxT("Test"), pos, size)
{
Control* window = new Control(this, wxID_ANY, wxDefaultPosition, size, wxSUNKEN_BORDER);
}
Frame::~Frame (void)
{
}
void Frame::OnClose(wxCloseEvent &event)
{
Destroy();
}
Control::Control(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxControl(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE), d3dInitialized(false), device(NULL)
{
}
Control::~Control(void)
{
}
void Control::OnClose(wxCloseEvent &event)
{
Destroy();
}
void Control::OnIdle(wxIdleEvent&)
{
Refresh();
}
void Control::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
if (!d3dInitialized)
{
d3dInitialized = true;
device = new D3D9Renderer (800, 600, 32, true, (HWND)GetHandle());
device->setClearColor (0.9f, 0.5f, 0.1f);
}
/*device->startRendering (true, true, false);
device->stopRendering ();*/
}
void Control::OnEraseBackground(wxEraseEvent&)
{
}
|