2013-01-13 23:29:42 +00:00
|
|
|
#include "qtemugl.h"
|
|
|
|
|
|
|
|
QtEmuGL::QtEmuGL(QWidget *parent) :
|
|
|
|
QGLWidget(parent),
|
|
|
|
running_(false),
|
|
|
|
thread()
|
|
|
|
{
|
|
|
|
setAutoBufferSwap(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::init(InputState *inputState)
|
|
|
|
{
|
2013-01-15 16:16:07 +00:00
|
|
|
thread.init(inputState);
|
2013-01-13 23:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::SetRunning(bool value)
|
|
|
|
{
|
|
|
|
running_ = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::initializeGL()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void QtEmuGL::paintGL()
|
|
|
|
{
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::start_rendering()
|
|
|
|
{
|
|
|
|
thread.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::stop_rendering()
|
|
|
|
{
|
|
|
|
thread.setRunning(false);
|
|
|
|
thread.wait();
|
|
|
|
thread.Shutdown();
|
|
|
|
}
|
|
|
|
|
2013-02-05 21:22:14 +00:00
|
|
|
void QtEmuGL::start_game(QString filename)
|
|
|
|
{
|
|
|
|
thread.startGame(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::stop_game()
|
|
|
|
{
|
|
|
|
thread.stopGame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::LockDraw(bool value)
|
|
|
|
{
|
2013-02-10 15:36:06 +00:00
|
|
|
thread.LockGL(value);
|
2013-02-05 21:22:14 +00:00
|
|
|
}
|
|
|
|
|
2013-01-13 23:29:42 +00:00
|
|
|
void QtEmuGL::resizeEvent(QResizeEvent *evt)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
//glt.resizeViewport(evt->size());
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::paintEvent(QPaintEvent *)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtEmuGL::closeEvent(QCloseEvent *evt)
|
|
|
|
{
|
|
|
|
//TODO stopRendering();
|
|
|
|
QGLWidget::closeEvent(evt);
|
|
|
|
}
|
2013-02-10 15:36:06 +00:00
|
|
|
|
|
|
|
void QtEmuGL::mouseDoubleClickEvent(QMouseEvent *)
|
|
|
|
{
|
|
|
|
emit doubleClick();
|
|
|
|
}
|