examples/example.windowing/example.windowing.no.plugin.app/example.windowing.no.plugin.cpp
File members: examples/example.windowing/example.windowing.no.plugin.app/example.windowing.no.plugin.cpp
// Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#ifndef DOXYGEN_BUILD // Just need the full listing
# include <omni/core/ModuleInfo.h>
# include <omni/core/OmniInit.h>
# include <ExampleGlfw.h>
OMNI_APP_GLOBALS("example.windowing.no.plugins.app",
"Example app showing how plugins can be statically or implicitly linked.")
namespace omni
{
using namespace omni::core;
} // namespace omni
int main(int argc, char** argv)
{
OMNI_CORE_INIT();
auto windowSystem = example::glfw::createWindowSystem();
if (!windowSystem)
{
OMNI_LOG_FATAL("unable to access window system");
return 1;
}
printf("IWindowSystem provided by: '%s'\n", omni::getModuleFilename(windowSystem.get()).c_str());
auto window = windowSystem->createWindow({ 640, 480 }, "example.windowing", windowing::fWindowHintScaleToMonitor);
if (!window)
{
OMNI_LOG_FATAL("unable to create window");
return 1;
}
window->addOnKeyboardEventConsumer([&window](input::IKeyboard* /*keyboard*/, const input::KeyboardEvent* event) {
if (input::isKeyRelease(*event, input::KeyboardKey::eEscape))
{
window->setShouldClose(true);
}
});
window->setShown(true);
while (!window->getShouldClose())
{
windowSystem->pollEvents();
}
printf("shutting down...\n");
return 0;
}
#endif