ScreenRes flags

Forum for discussion about the documentation project.
Post Reply
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

ScreenRes flags

Post by Tourist Trap »

Hi,

There is already a topic about screenres here http://www.freebasic.net/forum/viewtopi ... %2A#p11314, though a little old.

[edit]
I think this scheme is correct, but still not sure. (I can't post as text, fixed text seems broken).

Image
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: ScreenRes flags

Post by Tourist Trap »

Hello, in continuation of above affairs, to the attention of the documentation maintainers, I would like to submit this reshapped version of the text. It's a quite radical reformating but nothing is changed in the content (just one or two corrections or unanswered questions I've put inside clearly sightable).

Not that I would say this is exactly how this has to be, but it helps me a lot for reading and understanding with oxygen injection in the text. The current version is too thick and this we can not distinguish very well between the graphics mode and screenres flags, and how all of this is interwinded.

Anyway, take it as a suggestion for the day you judge it useful to work at this important page. I'm not sure the order of the paragraphs is optimal, but the presentation is certainly far better from a reading point of view.
ScreenRes
tells the compiler to link the GfxLib and, depending on the flags setting, initializes one of the 3 following graphics modes:
- QB-only,
- QB-on-GUI
- OpenGL
(Be careful, those modes are not compatible one each other)

In QB-only mode:
  • a dumb window or fullscreen resolution is set,
  • one or more buffers in standard memory are created (screen pages),
  • console commands are redirected to their graphic versions and shows on the currently active graphics page,
  • a default palette is set
  • an automatic screen refresh thread is started.
  • all QB-like graphics and console statements can be used.
In QB-on-GUI mode:
  • one or more buffers in standard memory are created (screen pages),
  • console commands are redirected to their graphic versions ,
  • a default palette is set,
  • all QB-like graphics and console statements can be used,
  • It is up to the user to create a window and to refresh it with the contents of the graphics buffers.
In OpenGL mode:
  • a dumb window or fullscreen resolution is set,
  • one or more buffers in standard memory are created,
  • the system's OpenGL library is initialized,
  • only OpenGL commands can be used to write to the graphics buffer,
  • QB-like and console commands are forbidden ::?this includes SLEEP or OPEN CONS?::.
The OpenGL mode allows the user to initialize OpenGL in a portable way where differences between platforms are handled automatically.

Graphics mode console and text font

(Applies to QB-only, and QB-on-GUI graphics mode.)

::?some modifications here, Input, Screen and so on?::.
Console commands (Locate, Print, Input ...) can be used in the same way as for the Screen command. Where the table about text sizes (link???), says that more than one text resolution is available for the text mode, the required text resolution can be requested by using Width.

The font size in ScreenResmodes is set to 8x8 by default. This can be changed by setting the number of text rows and columns of the Width function.
Note:

any characters Printed will erase some of the background around them; it will not use the transparent background if any.

ScreenRes initialization and error code

When ScreenRes is called, the created surface (either a window or the full screen), is cleared.
In non-fullscreen modes, the resolution does not have to match any resolution of the graphics card. Resolutions like 555x111 are possible, GfxLib will create a window of such size.
See the page GfxLib overview for DOS issues.

The error code returned by ScreenRes can be checked using Err in the next line following the ScreenRes call.

::?The function version of Open returns directly the error code as a 32 bit Long.?::.
The function version of ScreenRes returns the error code as a 32 bits Long

Graphic mode flags

flags details:

If flags are omitted, the flag value is 0, and FreeBASIC creates a windowed QB-compatible (not OpenGl) graphics surface.
The flags are constants that have values that can be more conveniently accessed throught there names as defined in fbgfx.bi.

fbgfx.bi must be first included (see #include) in the code in order to use the defined names.
In the -lang fb dialect, these constants are part of the FB Namespace. (See also Using keyword in the context of Namespace)
The ::?compatible?::. flags values can be combined to form a mask using Operator Or. Example: GFX_NO_FRAME OR GFX_ALWAYS_ON_TOP is a valid combination.
Note that most of the flags are not supported in DOS.
Missing the flags descriptions. Maybe later, but the idea is the same. Articulate better the graphics modes with the flags (they are not separated enough currently), and the correct recipe for doing so.
Post Reply