No Description

TestApp1.cpp 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // TestApp1.cpp : Defines the entry point for the application.
  2. //
  3. #ifdef _WIN32
  4. #include "Win32/stdafx.h"
  5. #endif
  6. #include <DK.h>
  7. class TestApp1 : public DKApplication
  8. {
  9. DKObject<DKWindow> window;
  10. public:
  11. void OnInitialize(void) override
  12. {
  13. DKLog("%s", DKGL_FUNCTION_NAME);
  14. window = DKWindow::Create("DefaultWindow");
  15. window->Activate();
  16. window->AddEventHandler(this,
  17. DKFunction([this](const DKWindow::WindowEvent& e) {
  18. if (e.type == DKWindow::WindowEvent::WindowClosed)
  19. DKApplication::Instance()->Terminate(0);
  20. }),
  21. NULL, NULL);
  22. DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
  23. device->CreateCommandQueue();
  24. }
  25. void OnTerminate(void) override
  26. {
  27. DKLog("%s", DKGL_FUNCTION_NAME);
  28. }
  29. };
  30. #ifdef _WIN32
  31. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  32. _In_opt_ HINSTANCE hPrevInstance,
  33. _In_ LPWSTR lpCmdLine,
  34. _In_ int nCmdShow)
  35. #else
  36. int main(int argc, const char * argv[])
  37. #endif
  38. {
  39. TestApp1 app;
  40. DKPropertySet::SystemConfig().SetValue("AppDelegate", "AppDelegate");
  41. return app.Run();
  42. }