1
General / SFML 2 OpenGL version
« on: July 05, 2011, 11:03:30 pm »
Yeah, so when OS X Lion comes out, it'll work when I select 3.2 without any changes?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
int main(int argc, char *argv[])
{
sf::Window Win;
sf::ContextSettings cs;
cs.MajorVersion = 2;
cs.MinorVersion = 0;
cs.DepthBits = 32;
cs.StencilBits = 0;
cs.AntialiasingLevel = 0;
Win.Create(sf::VideoMode(1024, 768, 32), "Sortmania", sf::Style::Default, cs);
std::cout<< Win.GetSettings().MajorVersion << "." << Win.GetSettings().MinorVersion;
return 0;
}
#include <SFML/Graphics.hpp>
#include <Windows.h>
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768), "SFML window", sf::Style::None);
int sx = 0;
int sy = 0;
bool mouseDown = false;
while (window.IsOpened())
{
sf::Event event;
while (window.PollEvent(event))
{
if (event.Type == sf::Event::Closed)
{
window.Close();
}
if (event.Type == sf::Event::MouseButtonPressed)
{
if (event.MouseButton.Button == sf::Mouse::Left)
{
sx = event.MouseButton.X;
sy = event.MouseButton.Y;
mouseDown = true;
}
}
if (event.Type == sf::Event::MouseButtonReleased)
{
if (event.MouseButton.Button == sf::Mouse::Left)
{
mouseDown = false;
}
}
if (event.Type == sf::Event::MouseMoved)
{
if (mouseDown)
{
POINT p;
GetCursorPos(&p);
window.SetPosition(p.x-sx,
p.y-sy);
}
}
}
window.Clear();
window.Display();
}
return EXIT_SUCCESS;
}