As I said, there are no dedicated gfx API calls for changing the window size, or for changing the window scale. Scaling is set by calling gfx_setoption - see set_scale_factor in allmodex.bas.
gfx_sdl calls gfx_sdl_recenter_window_hint() from inside gfx_sdl_set_zoom and I think gfx_directx should do the equivalent thing. I wanted to add support for -z to gfx_directx, but I didn't because I couldn't compile it at the time. On 1 March 2016 at 05:32, James Paige <[email protected]> wrote: > > > On Mon, Feb 29, 2016 at 7:57 AM, Ralph Versteegen <[email protected]> > wrote: >> >> gfx_recenter_window_hint is no longer called when changing the window >> scale; so you should call Window::centerWindow() from inside >> gfx_setoption in gfx_directx.cpp. > > > I am confused. I am looking at gfx_setoption, and this seems to be called > once for each command-line argument. That does not seem to be the right > place to center the window after it is resized to 80% of the screen. > > I also notice that gfx_directx has no support for the -z command line for > forcing zoom level (and produces a pretty confusing error message if you try > to use it) > >> >> Secondly (and this is moot because gfx_directx doesn't support other >> resolutions anyway), gfx_recenter_window_hint as implemented in >> gfx_sdl takes effect at the next call to gfx_showpage, whereas if you >> make it call Window::centerWindow() to recenter the window immediately >> that actually won't work, because it'll recenter using the previous >> game resolution rather than the new one. Probably gfx_sdl should be >> changed (as well as apply_game_window_settings) >> >> On 1 March 2016 at 04:20, James Paige <[email protected]> wrote: >> > I noticed that gfx_directx's window.cpp has a function named >> > Window::centerWindow() but when I tried to use it to implement >> > gfx_recenter_window_hint it did not seem to actually do anything. >> > >> > --- >> > James >> > >> > On Sun, Feb 28, 2016 at 6:27 AM, Ralph Versteegen <[email protected]> >> > wrote: >> >> >> >> The trick of quitting and reiniting the video subsystem was already >> >> using on OSX. >> >> >> >> Anyway, that was the easy bug. More complex was the bug that puts the >> >> window completely off the top-left of the screen if the resolution is >> >> low (happened on both X11/Linux and Windows) and in general doesn't >> >> center it if it's not 320x200. I fixed that by painfully trying every >> >> combination of resolution and scale changes when entering and quitting >> >> a game or exiting or leaving the graphics editors in Custom against >> >> many combinations of possible calls into the backend. The fundamental >> >> reason for these problems is that all the resolution and scaling stuff >> >> is an absolute mess; it's given to the gfx backend through multiple >> >> calls. We need to add a new gfx API call to set the window resolution >> >> and size. The backend learns about page size changes through >> >> gfx_showpage, scale changes through gfx_setoption, requests for >> >> recentering through gfx_recenter_window_hint which affects the next >> >> call to gfx_sdl_set_screen_mode, and several other gfx_* calls have >> >> the side effect of calling gfx_sdl_set_screen_mode, like >> >> set_safe_zone_margin. The latter was the main reason for the bug. >> >> >> >> On 28 February 2016 at 23:22, Ralph Versteegen <[email protected]> >> >> wrote: >> >> > I thought you meant in gfx_directx (gfx_recenter_window_hint isn't >> >> > implemented in it), but I see it doesn't work with gfx_sdl on Windows >> >> > either. Some fiddling around reveals that under Windows, >> >> > SDL_SetVideoMode only repositions the window when something, eg. >> >> > window size, is changed from the previous settings. >> >> > >> >> > On 27 February 2016 at 09:20, James Paige <[email protected]> >> >> > wrote: >> >> >> Actually, I take that back... this only seems to fix the bug on >> >> >> Linux, >> >> >> not >> >> >> on Windows >> >> >> >> >> >> >> >> >> On Fri, Feb 26, 2016 at 12:18 PM, <[email protected]> >> >> >> wrote: >> >> >>> >> >> >>> james >> >> >>> 2016-02-26 12:18:31 -0800 (Fri, 26 Feb 2016) >> >> >>> 263 >> >> >>> gfx_recenter_window_hint() was not being called when the window was >> >> >>> scaled, only when the game had a resolution other than 320x200 >> >> >>> Fixed the bug where for most games, the window was being centered >> >> >>> at >> >> >>> 50% >> >> >>> and then resized to 80% without moving the top left corner >> >> >>> --- >> >> >>> U wip/yetmore2.bas >> >> >>> _______________________________________________ >> >> >>> Ohrrpgce mailing list >> >> >>> [email protected] >> >> >>> >> >> >>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> Ohrrpgce mailing list >> >> >> [email protected] >> >> >> >> >> >> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >> >> >> >> >> _______________________________________________ >> >> Ohrrpgce mailing list >> >> [email protected] >> >> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >> > >> > >> > >> > _______________________________________________ >> > Ohrrpgce mailing list >> > [email protected] >> > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >> > >> _______________________________________________ >> Ohrrpgce mailing list >> [email protected] >> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > > > > _______________________________________________ > Ohrrpgce mailing list > [email protected] > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
