34 u_int8 screen::bytes_per_pixel_ = 0;
36 bool screen::fullscreen_ =
false;
42 u_int32 SDL_flags = SDL_SWSURFACE;
47 SDL_flags |= SDL_FULLSCREEN;
53 if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
55 fprintf (stderr,
"couldn't init display: %s\n", SDL_GetError ());
60 if (!depth) depth = 16;
63 bpp = SDL_VideoModeOK (nl << 1, nh << 1, depth, SDL_flags);
65 bpp = SDL_VideoModeOK (nl, nh, depth, SDL_flags);
67 if ((emulated) && (bpp) && (bpp != depth)) bpp = depth;
72 fprintf (stderr,
"Video mode %dx%d unavailable. Exiting.. \n", nl,
77 bytes_per_pixel_ = bpp / 8;
80 display.set_dbl_mode (dbl);
81 display.set_length (nl);
82 display.set_height (nh);
85 display.not_screen =
false;
93 display.vis = SDL_SetVideoMode (nl, nh, bpp, SDL_flags);
94 if (display.vis == NULL)
96 fprintf (stderr,
"error: %s\n", SDL_GetError ());
101 trans = SDL_MapRGB (display.vis->format, 0xFF, 0x00, 0xFF);
104 SDL_WM_SetCaption (
"Adonthell", NULL);
112 SDL_Flip (display.vis);
118 const SDL_VideoInfo * vi = SDL_GetVideoInfo ();
121 const int driver_name_length = 500;
122 char drv_name[driver_name_length];
124 temp <<
"Video information: \n"
125 <<
"Video driver used: " << SDL_VideoDriverName(drv_name, driver_name_length) << endl
126 <<
"Internal game depth: " << bytes_per_pixel_ * 8 << endl
127 <<
"Can create hardware surfaces: " << (vi->hw_available ?
"Yes" :
"No") << endl
128 <<
"Window manager available: " << (vi->wm_available ?
"Yes" :
"No") << endl
129 <<
"Hardware blits accelerated: " << (vi->blit_hw ?
"Yes" :
"No") << endl
130 <<
"Colorkey hardware blits accelerated: " << (vi->blit_hw_CC ?
"Yes" :
"No") << endl
131 <<
"Alpha hardware blits accelerated: " << (vi->blit_hw_A ?
"Yes" :
"No") << endl
132 <<
"Software blits accelerated: " << (vi->blit_sw ?
"Yes" :
"No") << endl
133 <<
"Colorkey software blits accelerated: " << (vi->blit_sw_CC ?
"Yes" :
"No") << endl
134 <<
"Alpha software blits accelerated: " << (vi->blit_sw_A ?
"Yes" :
"No") << endl
135 <<
"Color fill blits accelerated: " << (vi->blit_fill ?
"Yes" :
"No") << endl
136 <<
"Total video memory available: " << vi->video_mem <<
" Kb" << endl
137 <<
"Using double size: " << (dblmode ?
"Yes" :
"No") << endl
138 <<
"Fullscreen: " << (fullscreen_ ?
"Yes" :
"No") << endl
141 string ret = temp.str ();
143 string ret =
"Sorry, not available under BeOS\n";
151 if (fullscreen_ != m)
153 int r = SDL_WM_ToggleFullScreen(display.vis);
154 if (r) fullscreen_ = m;
#define u_int16
16 bits long unsigned integer
Class where drawables can actually be drawn to.
Declares the screen class.
static u_int16 length()
Returns the length of the screen.
static string info()
Returns information about the current screen settings, suitable for being displayed to the user...
#define u_int32
32 bits long unsigned integer
#define u_int8
8 bits long unsigned integer
static void transition(u_int16 i)
Make a nice transition effect.
static surface display
The actual screen surface.
static bool set_fullscreen(bool m)
Sets fullscreen/windowed mode.
static void show()
Ensure the framebuffer is copied to the physical screen.
static void set_video_mode(u_int16 nl, u_int16 nh, u_int8 depth=0, bool dbl=false, bool fscreen=false)
Sets the video mode.
static u_int16 height()
Returns the height of the screen.