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