本文整理汇总了C++中idList::SortWithTemplate方法的典型用法代码示例。如果您正苦于以下问题:C++ idList::SortWithTemplate方法的具体用法?C++ idList::SortWithTemplate怎么用?C++ idList::SortWithTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idList
的用法示例。
在下文中一共展示了idList::SortWithTemplate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillStaticVidModes
// RB: resolutions supported by XreaL
static void FillStaticVidModes( idList<vidMode_t>& modeList )
{
modeList.AddUnique( vidMode_t( 320, 240, 60 ) );
modeList.AddUnique( vidMode_t( 400, 300, 60 ) );
modeList.AddUnique( vidMode_t( 512, 384, 60 ) );
modeList.AddUnique( vidMode_t( 640, 480, 60 ) );
modeList.AddUnique( vidMode_t( 800, 600, 60 ) );
modeList.AddUnique( vidMode_t( 960, 720, 60 ) );
modeList.AddUnique( vidMode_t( 1024, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1152, 864, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 720, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 800, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 1024, 60 ) );
modeList.AddUnique( vidMode_t( 1360, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1440, 900, 60 ) );
modeList.AddUnique( vidMode_t( 1680, 1050, 60 ) );
modeList.AddUnique( vidMode_t( 1600, 1200, 60 ) );
modeList.AddUnique( vidMode_t( 1920, 1080, 60 ) );
modeList.AddUnique( vidMode_t( 1920, 1200, 60 ) );
modeList.AddUnique( vidMode_t( 2048, 1536, 60 ) );
modeList.AddUnique( vidMode_t( 2560, 1600, 60 ) );
modeList.SortWithTemplate( idSort_VidMode() );
}
示例2: R_GetModeListForDisplay
/*
====================
R_GetModeListForDisplay
====================
*/
bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>& modeList ) {
assert( requestedDisplayNum >= 0 );
modeList.Clear();
if( requestedDisplayNum >= SDL_GetNumVideoDisplays() ) {
// requested invalid displaynum
return false;
}
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
if( numModes > 0 ) {
for( int i = 0; i < numModes; i++ ) {
SDL_DisplayMode m;
int ret = SDL_GetDisplayMode( requestedDisplayNum, i, &m );
if( ret != 0 ) {
common->Warning( "Can't get video mode no %i, because of %s\n", i, SDL_GetError() );
continue;
}
vidMode_t mode;
mode.width = m.w;
mode.height = m.h;
mode.displayHz = m.refresh_rate ? m.refresh_rate : 60; // default to 60 if unknown (0)
modeList.AddUnique( mode );
}
if( modeList.Num() < 1 ) {
common->Warning( "Couldn't get a single video mode for display %i, using default ones..!\n", requestedDisplayNum );
FillStaticVidModes( modeList );
}
// sort with lowest resolution first
modeList.SortWithTemplate( idSort_VidMode() );
} else {
common->Warning( "Can't get Video Info, using default modes...\n" );
if( numModes < 0 ) {
common->Warning( "Reason was: %s\n", SDL_GetError() );
}
FillStaticVidModes( modeList );
}
return true;
}
示例3: R_GetModeListForDisplay
//.........这里部分代码省略.........
bool verbose = false;
for( int displayNum = requestedDisplayNum; ; displayNum++ )
{
DISPLAY_DEVICE device;
device.cb = sizeof( device );
if( !EnumDisplayDevices(
0, // lpDevice
displayNum,
&device,
0 /* dwFlags */ ) )
{
return false;
}
// get the monitor for this display
if( !( device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) )
{
continue;
}
DISPLAY_DEVICE monitor;
monitor.cb = sizeof( monitor );
if( !EnumDisplayDevices(
device.DeviceName,
0,
&monitor,
0 /* dwFlags */ ) )
{
continue;
}
DEVMODE devmode;
devmode.dmSize = sizeof( devmode );
if( verbose )
{
common->Printf( "display device: %i\n", displayNum );
common->Printf( " DeviceName : %s\n", device.DeviceName );
common->Printf( " DeviceString: %s\n", device.DeviceString );
common->Printf( " StateFlags : 0x%x\n", device.StateFlags );
common->Printf( " DeviceID : %s\n", device.DeviceID );
common->Printf( " DeviceKey : %s\n", device.DeviceKey );
common->Printf( " DeviceName : %s\n", monitor.DeviceName );
common->Printf( " DeviceString: %s\n", monitor.DeviceString );
common->Printf( " StateFlags : 0x%x\n", monitor.StateFlags );
common->Printf( " DeviceID : %s\n", monitor.DeviceID );
common->Printf( " DeviceKey : %s\n", monitor.DeviceKey );
}
for( int modeNum = 0 ; ; modeNum++ )
{
if( !EnumDisplaySettings( device.DeviceName, modeNum, &devmode ) )
{
break;
}
if( devmode.dmBitsPerPel != 32 )
{
continue;
}
if( ( devmode.dmDisplayFrequency != 60 ) && ( devmode.dmDisplayFrequency != 120 ) )
{
continue;
}
if( devmode.dmPelsHeight < 720 )
{
continue;
}
if( verbose )
{
common->Printf( " -------------------\n" );
common->Printf( " modeNum : %i\n", modeNum );
common->Printf( " dmPosition.x : %i\n", devmode.dmPosition.x );
common->Printf( " dmPosition.y : %i\n", devmode.dmPosition.y );
common->Printf( " dmBitsPerPel : %i\n", devmode.dmBitsPerPel );
common->Printf( " dmPelsWidth : %i\n", devmode.dmPelsWidth );
common->Printf( " dmPelsHeight : %i\n", devmode.dmPelsHeight );
common->Printf( " dmDisplayFixedOutput: %s\n", DMDFO( devmode.dmDisplayFixedOutput ) );
common->Printf( " dmDisplayFlags : 0x%x\n", devmode.dmDisplayFlags );
common->Printf( " dmDisplayFrequency : %i\n", devmode.dmDisplayFrequency );
}
vidMode_t mode;
mode.width = devmode.dmPelsWidth;
mode.height = devmode.dmPelsHeight;
mode.displayHz = devmode.dmDisplayFrequency;
modeList.AddUnique( mode );
}
if( modeList.Num() > 0 )
{
// sort with lowest resolution first
modeList.SortWithTemplate( idSort_VidMode() );
return true;
}
}
// Never gets here
}
示例4: R_GetModeListForDisplay
/*
====================
R_GetModeListForDisplay
====================
*/
bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>& modeList )
{
assert( requestedDisplayNum >= 0 );
modeList.Clear();
#if SDL_VERSION_ATLEAST(2, 0, 0)
// DG: SDL2 implementation
if( requestedDisplayNum >= SDL_GetNumVideoDisplays() )
{
// requested invalid displaynum
return false;
}
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
if( numModes > 0 )
{
for( int i = 0; i < numModes; i++ )
{
SDL_DisplayMode m;
int ret = SDL_GetDisplayMode( requestedDisplayNum, i, &m );
if( ret != 0 )
{
common->Warning( "Can't get video mode no %i, because of %s\n", i, SDL_GetError() );
continue;
}
vidMode_t mode;
mode.width = m.w;
mode.height = m.h;
mode.displayHz = m.refresh_rate ? m.refresh_rate : 60; // default to 60 if unknown (0)
modeList.AddUnique( mode );
}
if( modeList.Num() < 1 )
{
common->Warning( "Couldn't get a single video mode for display %i, using default ones..!\n", requestedDisplayNum );
FillStaticVidModes( modeList );
}
// sort with lowest resolution first
modeList.SortWithTemplate( idSort_VidMode() );
}
else
{
common->Warning( "Can't get Video Info, using default modes...\n" );
if( numModes < 0 )
{
common->Warning( "Reason was: %s\n", SDL_GetError() );
}
FillStaticVidModes( modeList );
}
return true;
// DG end
#else // SDL 1
// DG: SDL1 only knows of one display - some functions rely on
// R_GetModeListForDisplay() returning false for invalid displaynum to iterate all displays
if( requestedDisplayNum >= 1 )
{
return false;
}
// DG end
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
if( videoInfo == NULL )
{
// DG: yes, this can actually fail, e.g. if SDL_Init( SDL_INIT_VIDEO ) wasn't called
common->Warning( "Can't get Video Info, using default modes...\n" );
FillStaticVidModes( modeList );
return true;
}
SDL_Rect** modes = SDL_ListModes( videoInfo->vfmt, SDL_OPENGL | SDL_FULLSCREEN );
if( !modes )
{
common->Warning( "Can't get list of available modes, using default ones...\n" );
FillStaticVidModes( modeList );
return true;
}
if( modes == ( SDL_Rect** ) - 1 )
{
common->Printf( "Display supports any resolution\n" );
FillStaticVidModes( modeList );
return true;
}
int numModes;
for( numModes = 0; modes[numModes]; numModes++ );
if( numModes > 1 )
{
//.........这里部分代码省略.........