Mercurial > hg > easaier-soundaccess
view data/model/SDLWidget.cpp @ 138:3b2b790e47e5
(none)
author | ivand_qmul |
---|---|
date | Fri, 09 Nov 2007 12:58:47 +0000 |
parents | e236ce53a2e7 |
children | 2d883a374b79 |
line wrap: on
line source
#include <vector> #include <cstdlib> #include <ctime> #include "SDLWidget.h" extern int Videow; extern int Videoh; SDLWidget::SDLWidget() :windowInitialized(false), screen(0) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); setMinimumSize(720,576); resize(Videow, Videoh); } SDLWidget::~SDLWidget() { SDL_Quit(); } void SDLWidget::showEvent(QShowEvent *e) { (void)e; if(!windowInitialized) { // it's here the link between SDL and QT char windowid[64]; #ifdef Q_WS_WIN sprintf(windowid, "SDL_WINDOWID=0x%lx", reinterpret_cast<qlonglong>(winId())); #elif defined Q_WS_X11 sprintf(windowid, "SDL_WINDOWID=0x%lx", winId()); #else qFatal("uncorrect window ID"); #endif SDL_putenv(windowid); //SDL_Init(SDL_INIT_VIDEO); //screen = SDL_SetVideoMode(width(), height(), 32, SDL_SWSURFACE); windowInitialized = true; } }