warvair / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Add some way to switch between fullscreen and windowed mode #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The program should be able to switch between fullscreen and windowed mode.
Either add
  * A command line switch, a keyboard shortcut and a button on the screen 
prefs window. May require modifications to the config file, thus a rework 
of the Turbo Pascal tool used to generate it,
  * A field to the screenmode struct. Maybe use the "freq." field wich is 
irrelevant in SDL, or add a new field.

This is important because fullscreen allows to use non-square pixels on 
CRT screens, but most of the strange modes will not work with newer LCD.

Original issue reported on code.google.com by pulkoma...@gmail.com on 18 Aug 2008 at 4:22

GoogleCodeExporter commented 9 years ago
In my opinion:
As long as the list of resolutions is hard-coded, the windowed mode has to be 
be a 
single "dummy" resolution in the list, with no specific width and height.
If we set it as the "safe mode" for all our supported OSes (linux, windows), 
then 
the existing shortcut for safe resolution (shift+enter) will come back from 
fullscreen to window.
The window size can easily (?) be changed by dragging a window edge with the 
mouse, 
catching the event SDL_VIDEORESIZE within the program.
Window width and height can be saved and reloaded with the .ini or .cfg 
settings.

Original comment by yrizoud on 18 Sep 2008 at 2:45

GoogleCodeExporter commented 9 years ago
That's a good idea, the only problem is the resizing needs to update various 
global 
variables and that will fuck up everything if the program is processing 
something 
meanwhile. But that should not happen because we catch event only in the 
Get_input() 
function, ie when the program is idle and waiting for user input.

The other small problem is the menu, there is a zoom factor wich is set up for 
each 
mode (two variables, Menu_Facteur_X and Menu_Facteur_Y. When resizing, you'll 
have 
to decide when to go from x1 to x2 (or x3 or more ?)
I guess a good heuristic would be
-The menu height should be less than 1/4 of the total height
-The menu width should be less than 3/4 of the total, the remaining space being 
filled by the palette (wich is "elastic")

Please keep both variables even if you choose to have them being always equal, 
as 
i'm planning to add some modes with rectangles pixels for drawing pictures in 
the 
Amstrad CPC weird videomodes.

Original comment by pulkoma...@gmail.com on 18 Sep 2008 at 3:00

GoogleCodeExporter commented 9 years ago
Done around r180-r185.
the video modes are now either fullscreen or windowed. The list of fullscreen 
modes 
is built from a copy of the windowed ones. However, the fulscreen and windowed 
modes 
share the same information in the cfg file and the way there are handled is 
quite 
hacky.
The only visible artifact is if you select a fullscreen mode, the program will 
switch back to windowed when you exit and relauch, because the selected mode 
will 
not be saved in the .cfg file as it should.

Anyways, we will need some cleanup in this area if we want to add 16/32bit 
truecolor 
modes someday :) (may be useful for layers transparency even if the picture is 
still 
256colors, for example).

Original comment by pulkoma...@gmail.com on 30 Sep 2008 at 5:09

GoogleCodeExporter commented 9 years ago
Fixed.
You can now have a resizeable window.

Original comment by pulkoma...@gmail.com on 4 Oct 2008 at 2:06