Back to index

Index

DisplaySurface < Surface

Class Methods

 new  destroy  modes  mode_ok?  best_mode_info  gl_set_attribute  gl_get_attribute

Instance Methods

 info  driver  update  flip  active?  caption  set_caption  iconify  gamma=  toggle_fullscreen

DisplaySurface < Surface

The DisplaySurface is the surface that represents the window or the full screen that you will be drawing and blitting on. Since it is inherited from Surface, it can be used just like an ordinary surface. You will need to create a DisplaySurface to show anything on your screen.

Class Methods

DisplaySurface.new( [w,h] )
DisplaySurface.new( [w,h], flags )
DisplaySurface.new( [w,h], flags, depth )

Return value: the new DisplaySurface object

DisplaySurface.destroy

Destroys the display, removing the window or returning from fullscreen mode. Do not call methods on a destroyed DisplaySurface

DisplaySurface.modes
DisplaySurface.modes( bitdepth )
DisplaySurface.modes( bitdepth, flags )

Lists available modes for a certain bitdepth and optionally only those modes that can do flags. Flags are like those in DisplaySurface.new. No flags is the same as passing FULLSCREEN. Returns an array with arrays of [w, h], or nil. nil means any mode is ok, an empty array means no mode is supported.

DisplaySurface.mode_ok?

Like DisplaySurface.new, but doesn't set the mode, only returns true if the mode can be set, and false if it can't.

DisplaySurface.best_mode_info

This method return a hash filled with information about the video hardware.

These entries are true or false:

This is in kilobytes:

There is currently no difference between best_mode_info and info, except that one is a class method and the other an instance method, but there may be differences in the future.

DisplaySurface.gl_set_attribute( name, value )

Set an attribute of the OpenGL subsystem before intialization.

Returns self.

DisplaySurface.gl_get_attribute( name )

From the SDL documentation:

Get an attribute of the OpenGL subsystem from the windowing interface, such as glX. This is of course different from getting the values from SDL's internal OpenGL subsystem, which only stores the values you request before initialization.

Developers should track the values they pass into SDL_GL_SetAttribute themselves if they want to retrieve these values.

Instance Methods

DisplaySurface#info

See DisplaySurface.best_mode_info

DisplaySurface#driver

Returns the name of the videodriver that is being used.

DisplaySurface#update
DisplaySurface#update( rect )

This call will update a section (or sections) of the display screen. You must update an area of your display when you change its contents. rect is, starting from v0.4, an array of rectangles. If passed with no arguments, this will update the entire display surface.

This call cannot be used on OPENGL displays, and will generate an exception.

DisplaySurface#flip

This will update the contents of the entire display. If your display mode is using the flags HWSURFACE and DOUBLEBUF, this will wait for a vertical retrace (if the video driver supports it) and swap the surfaces. If you are using a different type of display mode, it will simply update the entire contents of the surface.

DisplaySurface#active?

Returns true if the application is active.

DisplaySurface#caption
DisplaySurface#set_caption( title )
DisplaySurface#set_caption( title, icontitle )

caption= sets the title of the window (if the application runs in a window) to title. Sets the title of the icon that shows when the application is iconified to icontitle, or title if icontitle is not supplied. caption returns the title and icontitle of the window.

DisplaySurface#iconify

Iconifies the application. Returns true if it is succesfull.

DisplaySurface#gamma=([r,g,b])
DisplaySurface#gamma=(intensity)

Sets the gamma value for the display when this is supported. Intensity is a shortcut for values where r=g=b.

DisplaySurface#toggle_fullscreen

Toggles between fullscreen and windowed mode. The code is experimental, please report problems if found.

Back to index