example.windowing.no.plugin.cpp#
Fully qualified name: 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
// SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates 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