Adonthell
0.4
Main Page
Related Pages
Classes
Files
File List
File Members
screen.h
Go to the documentation of this file.
1
/*
2
$Id: screen.h,v 1.25 2004/10/25 06:55:01 ksterker Exp $
3
4
Copyright (C) 1999/2000/2001/2004 Alexandre Courbot
5
Part of the Adonthell Project http://adonthell.linuxgames.com
6
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
/**
16
* @file screen.h
17
* @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
18
*
19
* @brief Declares the screen class.
20
*
21
*
22
*/
23
24
#ifndef SCREEN_H_
25
#define SCREEN_H_
26
27
#include "
surface.h
"
28
#include <string>
29
30
31
#ifndef SWIG
32
using namespace
std;
33
#endif
34
35
36
/** Screen access is made through this class.
37
* This static class sets video modes, flush the frame buffer to the physical
38
* screen and make abstraction of the real screen depth to ease the graphic
39
* programmer's task.
40
*/
41
class
screen
42
{
43
public
:
44
45
/**
46
* The actual screen surface.
47
* It is publicly available so you can do fast operations on the screen.
48
* Manipulate it just as a classic surface.
49
*
50
*/
51
static
surface
display
;
52
53
/** Sets the video mode.
54
* @param nl X screen resolution.
55
* @param nh Y screen resolution.
56
* @param depth desired screen depth.
57
*/
58
static
void
set_video_mode (
u_int16
nl,
u_int16
nh,
u_int8
depth = 0,
bool
dbl =
false
,
bool
fscreen =
false
);
59
60
/** Returns the length of the screen.
61
* @return length of the screen.
62
*/
63
static
u_int16
length ()
64
{
65
return
display.length ();
66
}
67
68
/** Returns the height of the screen.
69
* @return height of the screen.
70
*/
71
static
u_int16
height ()
72
{
73
return
display.height ();
74
}
75
76
/** Returns the screen depth, in bytes per pixel.
77
* @return screen depth, in bytes per pixel.
78
*/
79
static
u_int8
bytes_per_pixel ()
80
{
81
return
bytes_per_pixel_;
82
}
83
84
/** Returns the translucent color in %screen's depth format.
85
* For manipulation on images that will only be displayed, this is
86
* the right function to call for getting the translucent color.
87
* @return the translucent color in %screen's depth format.
88
*/
89
static
u_int32
trans_col ()
90
{
91
return
trans;
92
}
93
94
/**
95
* Totally clears the screen with black.
96
*
97
*/
98
static
void
clear ()
99
{
100
display.fillrect (0, 0, display.length (), display.height (), 0x0);
101
}
102
103
/** Ensure the framebuffer is copied to the physical screen.
104
*/
105
static
void
show ();
106
107
/** Returns whether the current mode is fullscreen or windowed.
108
* @return
109
* - true: fullscreen.
110
* - false: windowed.
111
*/
112
static
bool
is_fullscreen ()
113
{
114
return
fullscreen_;
115
}
116
117
/** Sets fullscreen/windowed mode.
118
* @param mode
119
* - true: fullscreen mode.
120
* - false: windowed mode.
121
* @return
122
* @li true if the operation succeed.
123
* @li false if the mode is already set, or the system doesn't support
124
* this mode.
125
*/
126
static
bool
set_fullscreen (
bool
m);
127
128
/**
129
* Returns information about the current screen settings,
130
* suitable for being displayed to the user.
131
*
132
*
133
* @return printable information about the current screen settings.
134
*/
135
static
string
info ();
136
137
static
bool
dbl_mode () {
return
dblmode; }
138
139
/**
140
* Make a nice transition effect.
141
*
142
* @param i advancement of the transition (finished when i == screen::length () / 2)
143
*/
144
static
void
transition (
u_int16
i);
145
146
private
:
147
/// Bytes per pixel.
148
static
u_int8
bytes_per_pixel_;
149
150
/// Transparent color.
151
static
u_int32
trans;
152
153
/// Whether fullscreen is on or not.
154
static
bool
fullscreen_;
155
156
static
bool
dblmode;
157
};
158
159
160
#endif
src
screen.h
Generated by
1.8.1.1