4jcraft/targets/platform/input/input.h
Tropical abeead819e
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run
rework build system dependencies
2026-04-10 02:49:30 -05:00

20 lines
729 B
C++

#pragma once
#include "IPlatformInput.h"
#include "InputConstants.h"
// Function accessor backed by a function-local static (Meyers singleton).
// Avoids the static-initialization-order fiasco that the previous
// `extern IPlatformInput& PlatformInput;` form had: anything reading
// PlatformInput during another translation unit's static init was UB.
//
// The macro lets the existing call sites keep writing `PlatformInput.foo()`
// without each call site having to add the `()`. The expansion is just
// a call to a function returning a reference, so codegen is unchanged
// once inlined.
namespace platform_internal {
IPlatformInput& PlatformInput_get();
}
#define PlatformInput (::platform_internal::PlatformInput_get())