Replaced GetPossibleResolutions for GetDisplayModes.

This commit is contained in:
Martín Lucas Golini
2013-09-19 12:20:16 -03:00
parent 5bd65e9fc0
commit ddd482b584
10 changed files with 53 additions and 19 deletions

View File

@@ -374,16 +374,16 @@ void cWindowSDL::SwapBuffers() {
SDL_GL_SwapBuffers();
}
std::vector< std::pair<unsigned int, unsigned int> > cWindowSDL::GetPossibleResolutions() const {
std::vector<DisplayMode> cWindowSDL::GetDisplayModes() const {
SDL_Rect **modes = SDL_ListModes( NULL, SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL | SDL_FULLSCREEN );
if(modes == (SDL_Rect **)0)
cLog::instance()->Write("No VideoMode Found");
std::vector< std::pair<unsigned int, unsigned int> > result;
std::vector<DisplayMode> result;
if( modes != (SDL_Rect **)-1 )
for(unsigned int i = 0; modes[i]; ++i)
result.push_back( std::pair<unsigned int, unsigned int>(modes[i]->w, modes[i]->h) );
result.push_back( DisplayMode(modes[i]->w, modes[i]->h,60,0) );
return result;
}

View File

@@ -33,7 +33,7 @@ class EE_API cWindowSDL : public cWindow {
void Size( Uint32 Width, Uint32 Height, bool Windowed );
std::vector< std::pair<unsigned int, unsigned int> > GetPossibleResolutions() const;
std::vector<DisplayMode> GetDisplayModes() const;
void SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue );

View File

@@ -479,14 +479,20 @@ void cWindowSDL::SwapBuffers() {
SDL_GL_SwapWindow( mSDLWindow );
}
std::vector< std::pair<unsigned int, unsigned int> > cWindowSDL::GetPossibleResolutions() const {
std::vector< std::pair<unsigned int, unsigned int> > result;
std::vector<DisplayMode> cWindowSDL::GetDisplayModes() const {
std::vector<DisplayMode> result;
for ( Int32 i = 0; i < SDL_GetNumDisplayModes(0); i++ ) {
SDL_DisplayMode mode;
SDL_GetDisplayMode( 0, i, &mode );
int displays = SDL_GetNumVideoDisplays();
result.push_back( std::pair<unsigned int, unsigned int>( mode.w, mode.h ) );
for ( int x = 0; x < displays; x++ ) {
int displayModes = SDL_GetNumDisplayModes(x);
for ( int i = 0; i < displayModes; i++ ) {
SDL_DisplayMode mode;
SDL_GetDisplayMode( x, i, &mode );
result.push_back( DisplayMode( mode.w, mode.h, mode.refresh_rate, x ) );
}
}
return result;

View File

@@ -38,7 +38,7 @@ class EE_API cWindowSDL : public cWindow {
void Size( Uint32 Width, Uint32 Height, bool Windowed );
std::vector< std::pair<unsigned int, unsigned int> > GetPossibleResolutions() const;
std::vector<DisplayMode> GetDisplayModes() const;
void SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue );

View File

@@ -189,8 +189,18 @@ void cWindowSFML::SwapBuffers() {
mSFMLWindow.display();
}
std::vector< std::pair<unsigned int, unsigned int> > cWindowSFML::GetPossibleResolutions() const {
return std::vector< std::pair<unsigned int, unsigned int> >();
std::vector<DisplayMode> cWindowSFML::GetDisplayModes() const {
std::vector<DisplayMode> result;
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
for (std::size_t i = 0; i < modes.size(); ++i) {
sf::VideoMode mode = modes[i];
result.push_back( DisplayMode( mode.width, mode.height, 60, x ) );
}
return result;
}
void cWindowSFML::SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue ) {

View File

@@ -40,7 +40,7 @@ class EE_API cWindowSFML : public cWindow {
void Size( Uint32 Width, Uint32 Height, bool Windowed );
std::vector< std::pair<unsigned int, unsigned int> > GetPossibleResolutions() const;
std::vector<DisplayMode> GetDisplayModes() const;
void SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue );

View File

@@ -68,8 +68,8 @@ void cWindowNull::Size( Uint32 Width, Uint32 Height, bool Windowed ) {
void cWindowNull::SwapBuffers() {
}
std::vector< std::pair<unsigned int, unsigned int> > cWindowNull::GetPossibleResolutions() const {
return std::vector< std::pair<unsigned int, unsigned int> >();
std::vector<DisplayMode> cWindowNull::GetDisplayModes() const {
return std::vector<DisplayMode>();
}
void cWindowNull::SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue ) {

View File

@@ -41,7 +41,7 @@ class EE_API cWindowNull : public cWindow {
void Size( Uint32 Width, Uint32 Height, bool Windowed );
std::vector< std::pair<unsigned int, unsigned int> > GetPossibleResolutions() const;
std::vector<DisplayMode> GetDisplayModes() const;
void SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue );