From 5e4e56d42caaaf3c510eed0e6fa3717b8a44a44d Mon Sep 17 00:00:00 2001 From: slipher Date: Thu, 25 Apr 2024 19:52:28 -0500 Subject: [PATCH] Add setWindowOrigin command --- src/engine/sys/sdl_glimp.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/engine/sys/sdl_glimp.cpp b/src/engine/sys/sdl_glimp.cpp index 6ac806b911..3060e26b6e 100644 --- a/src/engine/sys/sdl_glimp.cpp +++ b/src/engine/sys/sdl_glimp.cpp @@ -2231,3 +2231,23 @@ void GLimp_LogComment( const char *comment ) strlen( buf ), buf ); } } + +class SetWindowOriginCmd : public Cmd::StaticCmd +{ +public: + SetWindowOriginCmd() : StaticCmd("setWindowOrigin", "move the window") {} + + void Run( const Cmd::Args &args ) const + { + int x, y; + if ( args.Argc() != 3 + || !Str::ParseInt( x, args.Argv( 1 ) ) || !Str::ParseInt( y, args.Argv( 2 ) ) ) + { + Print( "Usage: setWindowOrigin " ); + return; + } + + SDL_SetWindowPosition( window, x, y ); + } +}; +static SetWindowOriginCmd setWindowOriginCmdRegistration;