sig/network - added r_viewportPos cvar for set the position of a viewport (Windows only)
Example: +r_viewportPos 100 200 Works from a command line or --console-command-file
This commit is contained in:
@@ -46,20 +46,25 @@ extern "C" void CreateStaticModules(AZStd::vector<AZ::Module*>& modulesOut);
|
||||
# define REMOTE_ASSET_PROCESSOR
|
||||
#endif
|
||||
|
||||
void CVar_OnViewportPosition(const AZ::Vector2& value);
|
||||
|
||||
namespace
|
||||
{
|
||||
void OnViewportResize(const AZ::Vector2& value);
|
||||
void CVar_OnViewportResize(const AZ::Vector2& value);
|
||||
|
||||
AZ_CVAR(AZ::Vector2, r_viewportSize, AZ::Vector2::CreateZero(), OnViewportResize, AZ::ConsoleFunctorFlags::DontReplicate,
|
||||
AZ_CVAR(AZ::Vector2, r_viewportSize, AZ::Vector2::CreateZero(), CVar_OnViewportResize, AZ::ConsoleFunctorFlags::DontReplicate,
|
||||
"The default size for the launcher viewport, 0 0 means full screen");
|
||||
|
||||
void OnViewportResize(const AZ::Vector2& value)
|
||||
void CVar_OnViewportResize(const AZ::Vector2& value)
|
||||
{
|
||||
AzFramework::NativeWindowHandle windowHandle = nullptr;
|
||||
AzFramework::WindowSystemRequestBus::BroadcastResult(windowHandle, &AzFramework::WindowSystemRequestBus::Events::GetDefaultWindowHandle);
|
||||
AzFramework::WindowSize newSize = AzFramework::WindowSize(aznumeric_cast<int32_t>(value.GetX()), aznumeric_cast<int32_t>(value.GetY()));
|
||||
AzFramework::WindowRequestBus::Broadcast(&AzFramework::WindowRequestBus::Events::ResizeClientArea, newSize);
|
||||
}
|
||||
|
||||
AZ_CVAR(AZ::Vector2, r_viewportPos, AZ::Vector2::CreateZero(), CVar_OnViewportPosition, AZ::ConsoleFunctorFlags::DontReplicate,
|
||||
"The default position for the launcher viewport, 0 0 means top left corner of your main desktop");
|
||||
|
||||
void ExecuteConsoleCommandFile(AzFramework::Application& application)
|
||||
{
|
||||
|
||||
@@ -433,3 +433,5 @@ void android_main(android_app* appState)
|
||||
MAIN_EXIT_FAILURE(appState, GetReturnCodeString(status));
|
||||
}
|
||||
}
|
||||
|
||||
void CVar_OnViewportPosition([[maybe_unused]] const AZ::Vector2& value) {}
|
||||
|
||||
@@ -113,3 +113,5 @@ int main(int argc, char** argv)
|
||||
|
||||
return static_cast<int>(status);
|
||||
}
|
||||
|
||||
void CVar_OnViewportPosition([[maybe_unused]] const AZ::Vector2& value) {}
|
||||
|
||||
@@ -63,3 +63,5 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
#endif // AZ_TESTS_ENABLED
|
||||
|
||||
void CVar_OnViewportPosition([[maybe_unused]] const AZ::Vector2& value) {}
|
||||
|
||||
@@ -69,3 +69,14 @@ int APIENTRY WinMain([[maybe_unused]] HINSTANCE hInstance, [[maybe_unused]] HINS
|
||||
|
||||
return static_cast<int>(status);
|
||||
}
|
||||
|
||||
void CVar_OnViewportPosition(const AZ::Vector2& value)
|
||||
{
|
||||
if (HWND windowHandle = GetActiveWindow())
|
||||
{
|
||||
SetWindowPos(windowHandle, nullptr,
|
||||
value.GetX(),
|
||||
value.GetY(),
|
||||
0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +23,5 @@ int main(int argc, char* argv[])
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CVar_OnViewportPosition([[maybe_unused]] const AZ::Vector2& value) {}
|
||||
|
||||
Reference in New Issue
Block a user