|
@@ -18,47 +18,9 @@ public:
|
18
|
18
|
window = DKWindow::Create("DefaultWindow");
|
19
|
19
|
window->Activate();
|
20
|
20
|
|
21
|
|
- window->AddEventHandler(this,
|
22
|
|
- DKFunction([this](const DKWindow::WindowEvent& e)
|
23
|
|
- {
|
24
|
|
- DKLog("WindowEvent: %d, origin:(%.1f, %.1f), size:(%.1f x %.1f), content:(%.1f, %.1f), scale:%f",
|
25
|
|
- e.type,
|
26
|
|
- e.windowRect.origin.x, e.windowRect.origin.y,
|
27
|
|
- e.windowRect.size.width, e.windowRect.size.height,
|
28
|
|
- e.contentRect.size.width, e.contentRect.size.height,
|
29
|
|
- e.contentScaleFactor);
|
30
|
|
- if (e.type == DKWindow::WindowEvent::WindowClosed)
|
31
|
|
- DKApplication::Instance()->Terminate(0);
|
32
|
|
- }),
|
33
|
|
- DKFunction([this](const DKWindow::KeyboardEvent& e)
|
34
|
|
- {
|
35
|
|
- if (e.type == DKWindow::KeyboardEvent::KeyUp)
|
36
|
|
- {
|
37
|
|
- if (e.key == DKVK_ENTER || e.key == DKVK_RETURN)
|
38
|
|
- {
|
39
|
|
- window->SetTextInputEnabled(0, !window->IsTextInputEnabled(0));
|
40
|
|
- DKLog("TextInput: %d", window->IsTextInputEnabled(0));
|
41
|
|
- }
|
42
|
|
- else if (e.key == DKVK_ESCAPE)
|
43
|
|
- {
|
44
|
|
- window->HoldMouse(0, !window->IsMouseHeld(0));
|
45
|
|
- DKLog("HoldMouse: %d", window->IsMouseHeld(0));
|
46
|
|
- }
|
47
|
|
- }
|
48
|
|
- DKLog("KeyboardEvent: %d, %ls, %ls",
|
49
|
|
- e.type,
|
50
|
|
- (const wchar_t*)DKWindow::GetVKName(e.key),
|
51
|
|
- (const wchar_t*)e.text);
|
52
|
|
- }),
|
53
|
|
- DKFunction([this](const DKWindow::MouseEvent& e)
|
54
|
|
- {
|
55
|
|
- if (e.type != DKWindow::MouseEvent::Move || window->IsMouseHeld(0))
|
56
|
|
- {
|
57
|
|
- DKLog("MouseEvent: %d, btn:%d, location:%.1f, %.1f, delta:%.1f, %.1f",
|
58
|
|
- e.type, e.buttonId, e.location.x, e.location.y, e.delta.x, e.delta.y);
|
59
|
|
- }
|
60
|
|
- })
|
61
|
|
- );
|
|
21
|
+
|
|
22
|
+ DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
|
|
23
|
+ device->CreateCommandQueue();
|
62
|
24
|
}
|
63
|
25
|
void OnTerminate(void) override
|
64
|
26
|
{
|