gResMenEntry Class Reference

Collaboration diagram for gResMenEntry:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gResMenEntry (uMenu &screen_menu_mode, rScreenSize &res, const tOutput &text, const tOutput &help, bool addFixed)

Private Member Functions

void NewChoice (rScreenSize const &size)
void NewChoice (rResolution res)

Private Attributes

uMenuItemSelection< rScreenSizeres_men
std::set< rScreenSizesizes


Detailed Description

Definition at line 191 of file gMenus.cpp.


Constructor & Destructor Documentation

gResMenEntry::gResMenEntry ( uMenu screen_menu_mode,
rScreenSize res,
const tOutput text,
const tOutput help,
bool  addFixed 
) [inline]

Definition at line 213 of file gMenus.cpp.

References ArmageTron_Custom, ArmageTron_Desktop, ArmageTron_Min, rScreenSize::height, uMenuItemSelection< T >::NewChoice(), NewChoice(), NULL, res_men, sizes, sr_DesktopScreensizeSupported(), and rScreenSize::width.

00214             :res_men
00215             (&screen_menu_mode,
00216              text,
00217              help,
00218              res)
00219     {
00220 #ifndef DEDICATED
00221         // fetch valid screen modes from SDL
00222         SDL_Rect **modes;
00223         modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_OPENGL);
00224 
00225         // Check is there are any modes available
00226         int i;
00227         if(modes == 0 || modes == (SDL_Rect **)-1)
00228         {
00229             // add all fixed resolutions
00230             for ( i = ArmageTron_Custom; i>=0; --i )
00231             {
00232                 NewChoice( rResolution(i) );
00233             }
00234         }
00235         else
00236         {
00237             // add custom resolution
00238             NewChoice( ArmageTron_Custom );
00239 
00240             // add desktop resolution
00241             if ( sr_DesktopScreensizeSupported() && !addFixed )
00242                 NewChoice( ArmageTron_Desktop );
00243 
00244             // the maximal allowed screen size
00245             rScreenSize maxSize(0,0);
00246 
00247             // fill in available modes (avoid duplicates)
00248             for(i=0;modes[i];++i)
00249             {
00250                 // add mode (if it's new)
00251                 rScreenSize size(modes[i]->w, modes[i]->h);
00252                 NewChoice( size );
00253                 if ( maxSize.width < size.width )
00254                     maxSize.width = size.width;
00255                 if ( maxSize.height < size.height )
00256                     maxSize.height = size.height;
00257             }
00258 
00259             // add fixed resolutions (as window sizes)
00260             if ( addFixed )
00261             {
00262                 for ( i = ArmageTron_Custom; i>=ArmageTron_Min; --i )
00263                 {
00264                     rScreenSize size( static_cast< rResolution >(i) );
00265 
00266                     // only add those that fit the maximal resolution
00267                     if ( maxSize.height >= size.height && maxSize.width >= size.width )
00268                         NewChoice( size );
00269                 }
00270             }
00271         }
00272 
00273         // insert sorted resolutions into menu
00274         for( std::set< rScreenSize >::iterator iter = sizes.begin(); iter != sizes.end(); ++iter )
00275             {
00276                 rScreenSize const & size = *iter;
00277 
00278                 std::stringstream s;
00279                 if ( size.width + size.height > 0 )
00280                     s << size.width << " x " << size.height;
00281                 else
00282                     s << tOutput("$screen_size_desktop");
00283 
00284                 res_men.NewChoice( s.str().c_str(), help, size );
00285             }
00286 
00287 #endif
00288     }

Here is the call graph for this function:


Member Function Documentation

void gResMenEntry::NewChoice ( rScreenSize const &  size  )  [inline, private]

Definition at line 197 of file gMenus.cpp.

References sizes.

Referenced by gResMenEntry(), and NewChoice().

00198     {
00199         if ( sizes.find( size ) == sizes.end() )
00200         {
00201             sizes.insert(size);
00202         }
00203     }

Here is the caller graph for this function:

void gResMenEntry::NewChoice ( rResolution  res  )  [inline, private]

Definition at line 206 of file gMenus.cpp.

References NewChoice().

00207     {
00208         rScreenSize size( res );
00209         NewChoice( size );
00210     }

Here is the call graph for this function:


Member Data Documentation

uMenuItemSelection<rScreenSize> gResMenEntry::res_men [private]

Definition at line 193 of file gMenus.cpp.

Referenced by gResMenEntry().

std::set< rScreenSize > gResMenEntry::sizes [private]

Definition at line 194 of file gMenus.cpp.

Referenced by gResMenEntry(), and NewChoice().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:44:46 2008 for Armagetron Advanced by  doxygen 1.5.4