Class SFML::VideoMode
In: window/main.cpp
Parent: Object

A video mode is defined by a width and a height (in pixels) and a depth (in bits per pixel).

Video modes are used to setup windows (SFML::Window) at creation time.

The main usage of video modes is for fullscreen mode: indeed you must use one of the valid video modes allowed by the OS (which are defined by what the monitor and the graphics card support), otherwise your window creation will just fail.

SFML::VideoMode provides a static function for retrieving the list of all the video modes supported by the system: getFullscreenModes().

A custom video mode can also be checked directly for fullscreen compatibility with its isValid() function.

Additionnally, SFML::VideoMode provides a static function to get the mode currently used by the desktop: getDesktopMode(). This allows to build windows with the same size or pixel depth as the current resolution.

Usage example:

  # Display the list of all the video modes available for fullscreen
  modes = SFML::VideoMode.getFullscreenModes()
  i = 0
  modes.each do | mode |
    puts "Mode #" + i + ": " + mode.width + "x" + mode.height + " - " + mode.bitsPerPixel + " bpp"

  end

  # Create a window with the same pixel depth as the desktop
  desktop = SFML::VideoMode.getDesktopMode()
  window.create( SFML::VideoMode.new( 1024, 768, desktop.BitsPerPixel ), "SFML window" )

Methods

Public Class methods

Get the current desktop video mode.

Retrieve all the video modes supported in fullscreen mode.

When creating a fullscreen window, the video mode is restricted to be compatible with what the graphics driver and monitor support. This function returns the complete list of all video modes that can be used in fullscreen mode. The returned array is sorted from best to worst, so that the first element will always give the best mode (higher width, height and bits-per-pixel).

Public Instance methods

Video mode pixel depth, in bits per pixels.

Video mode pixel depth, in bits per pixels.

bits_per_pixel()

Alias for bitsPerPixel

bits_per_pixel=(p1)

Alias for bitsPerPixel=

bpp()

Alias for bitsPerPixel

bpp=(p1)

Alias for bitsPerPixel=

Video mode width, in pixels.

Video mode width, in pixels.

[Validate]