pass antialias level and compatibility context flags to Client

This commit is contained in:
Josh Holtrop 2012-09-06 21:49:14 -04:00
parent 305fa696f6
commit cf227cc5ab
3 changed files with 10 additions and 4 deletions

View File

@ -10,7 +10,8 @@
using namespace std; using namespace std;
Client::Client(bool fullscreen) Client::Client(bool fullscreen, bool compatibility_context,
unsigned int antialias_level)
{ {
sf::VideoMode mode = fullscreen sf::VideoMode mode = fullscreen
? sf::VideoMode::getDesktopMode() ? sf::VideoMode::getDesktopMode()
@ -18,7 +19,11 @@ Client::Client(bool fullscreen)
long style = fullscreen long style = fullscreen
? sf::Style::Fullscreen ? sf::Style::Fullscreen
: sf::Style::Resize | sf::Style::Close; : sf::Style::Resize | sf::Style::Close;
m_window = new sf::Window(mode, "Treacherous Terrain", style); const unsigned int opengl_major = compatibility_context ? 2 : 4;
const unsigned int opengl_minor = 0u;
sf::ContextSettings cs = sf::ContextSettings(0, 0, antialias_level,
opengl_major, opengl_minor);
m_window = new sf::Window(mode, "Treacherous Terrain", style, cs);
GLenum err = glewInit(); GLenum err = glewInit();
if (err != GLEW_OK) if (err != GLEW_OK)
{ {

View File

@ -10,7 +10,8 @@
class Client class Client
{ {
public: public:
Client(bool fullscreen); Client(bool fullscreen, bool compatibility_context,
unsigned int antialias_level);
void run(); void run();
protected: protected:
void initgl(); void initgl();

View File

@ -34,7 +34,7 @@ int main(int argc, char *argv[])
} }
} }
Client client(fullscreen); Client client(fullscreen, compatibility_context, antialias_level);
client.run(); client.run();