文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>using SDL with OpenGL

using SDL with OpenGL

时间:2010-12-06  来源:landuochong

#include "SDL.h"
#include <QWidget>

class SDLVideo : public QWidget {
Q_OBJECT

public:
SDLVideo(QWidget *parent = 0, Qt::WindowFlags f = 0) : QWidget(parent, f), m_Screen(0){
setAttribute
(Qt::WA_PaintOnScreen);
setUpdatesEnabled
(false);

// Set the new video mode with the new window size
char variable[64];
snprintf
(variable, sizeof(variable), "SDL_WINDOWID=0x%lx", winId());
putenv
(variable);

SDL_InitSubSystem
(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);

// initialize default Video
if((SDL_Init(SDL_INIT_VIDEO) == -1)) {
std
:cerr << "Could not initialize SDL: " << SDL_GetError() << std::endl;
}

m_Screen
= SDL_SetVideoMode(640, 480, 8, SDL_HWSURFACE | SDL_DOUBLEBUF);
if (m_Screen == 0) {
std
::cerr << "Couldn't set video mode: " << SDL_GetError() << std::endl;
}
}

virtual ~SDLVideo() {
if(SDL_WasInit(SDL_INIT_VIDEO) != 0) {
SDL_QuitSubSystem
(SDL_INIT_VIDEO);
m_Screen
= 0;
}
}
private:
SDL_Surface
*m_Screen;
};
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载