| 38 | }; |
| 39 | |
| 40 | int main() |
| 41 | { |
| 42 | try |
| 43 | { |
| 44 | // Create window |
| 45 | LLGL::WindowDescriptor windowDesc; |
| 46 | |
| 47 | windowDesc.title = L"LLGL Test 1"; |
| 48 | windowDesc.visible = true; |
| 49 | windowDesc.centered = true; |
| 50 | windowDesc.resizable = true; |
| 51 | windowDesc.size = { 640, 480 }; |
| 52 | |
| 53 | auto window = LLGL::Window::Create(windowDesc); |
| 54 | |
| 55 | auto input = std::make_shared<LLGL::Input>(); |
| 56 | window->AddEventListener(input); |
| 57 | |
| 58 | window->AddEventListener(std::make_shared<WindowEventHandler>()); |
| 59 | |
| 60 | auto timer = LLGL::Timer::Create(); |
| 61 | |
| 62 | auto pos = window->GetPosition(); |
| 63 | |
| 64 | printWindowSize(*window); |
| 65 | |
| 66 | try |
| 67 | { |
| 68 | auto renderer = LLGL::RenderSystem::Load("OpenGL"); |
| 69 | |
| 70 | window->SetTitle( |
| 71 | windowDesc.title + L" ( " + std::wstring(renderer->GetName().begin(), renderer->GetName().end()) + L" )" |
| 72 | ); |
| 73 | |
| 74 | /*#ifdef __APPLE__ |
| 75 | LLGL::VideoModeDescriptor videoMode; |
| 76 | { |
| 77 | videoMode.fullscreen = true; |
| 78 | } |
| 79 | LLGL::Desktop::SetVideoMode(videoMode); |
| 80 | #endif*/ |
| 81 | } |
| 82 | catch (const std::exception& e) |
| 83 | { |
| 84 | std::cerr << e.what() << std::endl; |
| 85 | } |
| 86 | |
| 87 | LLGL::Extent2D desktopSize; |
| 88 | if (auto display = LLGL::Display::InstantiatePrimary()) |
| 89 | desktopSize = display->GetDisplayMode().resolution; |
| 90 | |
| 91 | std::wcout << "Screen Width = " << desktopSize.width << ", Screen Height = " << desktopSize.height << std::endl; |
| 92 | |
| 93 | while (window->ProcessEvents() && !input->KeyPressed(LLGL::Key::Escape)) |
| 94 | { |
| 95 | timer->MeasureTime(); |
| 96 | |
| 97 | //std::cout << 1.0 / timer->GetDeltaTime() << std::endl; |
nothing calls this directly
no test coverage detected