/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include int APIENTRY WinMain([[maybe_unused]] HINSTANCE hInstance, [[maybe_unused]] HINSTANCE hPrevInstance, [[maybe_unused]] LPSTR lpCmdLine, [[maybe_unused]] int nCmdShow) { InitRootDir(); using namespace O3DELauncher; PlatformMainInfo mainInfo; mainInfo.m_instance = GetModuleHandle(0); mainInfo.CopyCommandLine(__argc, __argv); // Prevent allocator from growing in small chunks // Pre-create our system allocator and configure it to ask for larger chunks from the OS // Creating this here to be consistent with other platforms AZ::SystemAllocator::Descriptor sysHeapDesc; sysHeapDesc.m_heap.m_systemChunkSize = 64 * 1024 * 1024; AZ::AllocatorInstance::Create(sysHeapDesc); ReturnCode status = Run(mainInfo); #if !defined(_RELEASE) bool noPrompt = (strstr(mainInfo.m_commandLine, "-noprompt") != nullptr); #else bool noPrompt = false; #endif // !defined(_RELEASE) if (!noPrompt && status != ReturnCode::Success) { MessageBoxA(0, GetReturnCodeString(status), "Error", MB_OK | MB_DEFAULT_DESKTOP_ONLY | MB_ICONERROR); } // there is no way to transfer ownership of the allocator to the component application // without altering the app descriptor, so it must be destroyed here AZ::AllocatorInstance::Destroy(); return static_cast(status); } void CVar_OnViewportPosition(const AZ::Vector2& value) { if (HWND windowHandle = GetActiveWindow()) { SetWindowPos(windowHandle, nullptr, static_cast(value.GetX()), static_cast(value.GetY()), 0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE); } }