DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | Protected Attributes
GUI::Screen Class Reference

A Screen represents the framebuffer that is the final destination of the GUI. More...

#include <gui_tk.h>

Inheritance diagram for GUI::Screen:
GUI::Window GUI::ScreenRGB32le

List of all members.

Public Member Functions

virtual ~Screen ()
 Destructor.
template<typename STR >
void setClipboard (const STR s)
 Set clipboard content.
virtual void setClipboard (const String &s)
 Set clipboard content.
virtual const StringgetClipboard ()
 Get clipboard content.
virtual void resize (int w, int h)
 Do nothing.
virtual void move (int x, int y)
 Do nothing.
virtual bool hasFocus () const
 Screen has always focus.
Ticks update (void *surface, Ticks ticks=1)
 Update the given surface with this screen's content, fully honouring the alpha channel.
virtual void paint (Drawable &d) const
 Default: clear screen.

Protected Member Functions

virtual void rgbToSurface (RGB color, void **pixel)=0
 Store a single RGB triple (8 bit each) as a native pixel value and advance pointer.
virtual RGB surfaceToRGB (void *pixel)=0
 Map a single framebuffer pixel to an RGB value.
 Screen (Size width, Size height)
 Create a new screen with the given characteristics.
 Screen (Drawable *d)
 Create a new screen from the given GUI::Drawable.

Protected Attributes

Drawable *const buffer
 Screen buffer.
String clipboard
 Clipboard.
MouseButton button
 Currently pressed mouse button.

Detailed Description

A Screen represents the framebuffer that is the final destination of the GUI.

It's main purpose is to manage the current contents of the surface and to combine it with all GUI elements. You can't resize and move the screen. Requests to do so will be ignored.

This is an abstract base class. You need to use a subclass which implements rgbToSurface and surfaceToRGB.

To make things work, Screen needs events. Call the mouse and key event functions (see Window) whenever such an event occurs. Call update(void *surface, int ticks) regularly, if possible about every 40msec (25 fps). If nothing has changed, screen updates are quite fast.

Definition at line 694 of file gui_tk.h.


Member Function Documentation

unsigned int GUI::Screen::update ( void *  surface,
Ticks  ticks = 1 
)

Update the given surface with this screen's content, fully honouring the alpha channel.

ticks can be set to a different value depending on how much time has passed. Timing doesn't need to be perfect, but try to call this at least every 40 msec. Each tick amounts to about 10 msec. Returns the number of ticks until the next event is scheduled, or 0 if none.

Definition at line 1278 of file gui_tk.cpp.

References buffer, GUI::Drawable::buffer, GUI::Color::GreenMask, GUI::Window::height, GUI::Color::MagentaMask, GUI::Timer::next(), GUI::Window::paintAll(), rgbToSurface(), surfaceToRGB(), GUI::Window::width, GUI::Window::x, and GUI::Window::y.


The documentation for this class was generated from the following files: