Video display modes: Difference between revisions

From Rosetta Code
Content added Content deleted
(Add UNIX Shell with xrandr.)
Line 29: Line 29:
{{omit from|Blast}}
{{omit from|Blast}}
{{omit from|C|This is an OS feature, not a language one}}
{{omit from|C|This is an OS feature, not a language one}}
{{omit from|Mathematica}}
{{omit from|ML/I}}
{{omit from|ML/I}}
{{omit from|Tcl|Tcl is usually hosted on systems where the display device either isn't switchable or that feature isn't exposed to normal programs. If the OS provides an API to do it, Tcl can call that API using normal foreign-function interface methods, but that's really not very interesting.}}
{{omit from|Tcl|Tcl is usually hosted on systems where the display device either isn't switchable or that feature isn't exposed to normal programs. If the OS provides an API to do it, Tcl can call that API using normal foreign-function interface methods, but that's really not very interesting.}}

Revision as of 14:10, 12 January 2012

Video display modes is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to demonstrate how to switch video display modes within the language. A brief description of the supported video modes would be useful.

Locomotive Basic

The Amstrad CPC464 supports three video modes:

  • Mode 0 - Graphics: 160x200 Text: 20x25 Colours: 16
  • Mode 1 - Graphics: 320x200 Text: 40x25 Colours: 4
  • Mode 2 - Graphics: 640x200 Text: 80x25 Colours: 2

Note that text can be displayed using conventional means in all display modes.

<lang locobasic>10 MODE 0: REM switch to mode 0</lang>

UNIX Shell

If the system runs X11 and supports XRANDR, then

<lang bash>$ xrandr -q</lang>

lists the available modes, and

<lang bash>$ xrandr -s 1024x768</lang>

sets the screen to the given size.

With modern LCD monitors, this feature is not very useful. These monitors have a single best mode, and the X server discovers and uses that mode by default. Smaller screen modes might work, but make a blurry picture.