MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / main

Function main

deps/LLGL/tests/Test_Window.cpp:40–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38};
39
40int 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;

Callers

nothing calls this directly

Calls 15

printWindowSizeFunction · 0.85
printWindowPosFunction · 0.85
KeyPressedMethod · 0.80
KeyDownMethod · 0.80
AddEventListenerMethod · 0.45
GetPositionMethod · 0.45
SetTitleMethod · 0.45
beginMethod · 0.45
GetNameMethod · 0.45
endMethod · 0.45
whatMethod · 0.45
GetDisplayModeMethod · 0.45

Tested by

no test coverage detected