我正在尝试使用SFML的全屏模式进行测试,但是每次窗口进入全屏模式时它都会崩溃。下面是我的程序:
#include <stdio.h>
#include <SFML/Graphics.hpp>
int main ( int argc, char** argv ) {
sf::Window win( sf::VideoMode ( argc >= 3 ? atoi ( ( const *char ) argv[1] ) : 1280, argc >= 3 ? atoi ( ( const *char ) argv[2] ) ), "", sf::Style::Fullscreen );
while ( win.IsOpened ( ) ) {
sf::Event in;
while ( win.GetEvent ( in ) ) {
if ( in.Type == sf::Event::KeyPressed ) {
switch ( in.Key.Code ) {
case sf::Key::Q:
win.Close ( );
break;
default:
break;
}
}
}
win.Display ( );
}
}我用这个命令编译了一个makefile:
g++ -o build/Test -lsfml-system -lsfml-window -lsfml-graphics src/main.cpp
当我从终端运行程序时,它崩溃了:
build/Test 1440 900
build/Test
我在苹果Macbook Air (4,2)上运行ubuntu linux 12.04。我尝试使用gdm和lightdm,它们都有相同的结果。此外,它在gnome 2,unity和openbox上运行良好,只是不能在gnome 3上运行。
我不介意摆弄配置文件,但我想继续使用gnome shell,因为它是我目前最喜欢的DE。
发布于 2012-06-14 05:36:45
切换到SFML 2.0解决了这个问题。感谢Konrad Rudolph在评论中发布了这一点。
https://stackoverflow.com/questions/10969813
复制相似问题