From: Shamus Hammons Date: Thu, 21 Jan 2010 04:20:21 +0000 (+0000) Subject: Added some icons, reconnected settings, added start of GUI control over X-Git-Tag: 2.0.0~34^2~49 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=5e11cea96160bd958c1b271940bf97ecfa257b15;p=virtualjaguar Added some icons, reconnected settings, added start of GUI control over some settings --- diff --git a/res/generic.png b/res/generic.png new file mode 100644 index 0000000..2b9c7fd Binary files /dev/null and b/res/generic.png differ diff --git a/res/power.png b/res/power.png new file mode 100644 index 0000000..903b60d Binary files /dev/null and b/res/power.png differ diff --git a/res/zoom100.png b/res/zoom100.png new file mode 100644 index 0000000..1c34227 Binary files /dev/null and b/res/zoom100.png differ diff --git a/res/zoom200.png b/res/zoom200.png new file mode 100644 index 0000000..20821da Binary files /dev/null and b/res/zoom200.png differ diff --git a/res/zoom300.png b/res/zoom300.png new file mode 100644 index 0000000..3567764 Binary files /dev/null and b/res/zoom300.png differ diff --git a/src/gui/glwidget.cpp b/src/gui/glwidget.cpp index 109c1c9..d4a65ec 100644 --- a/src/gui/glwidget.cpp +++ b/src/gui/glwidget.cpp @@ -53,10 +53,8 @@ void GLWidget::paintGL() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (smoothGLOutput ? GL_LINEAR : GL_NEAREST)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (smoothGLOutput ? GL_LINEAR : GL_NEAREST)); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST /*GL_LINEAR*/); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST /*GL_LINEAR*/); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST)); // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer); diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index e083446..deef6b4 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -8,6 +8,7 @@ // Who When What // --- ---------- ------------------------------------------------------------- // JLH 12/23/2009 Created this file +// JLH 12/20/2010 Added settings, menus & toolbars // // FIXED: @@ -22,42 +23,78 @@ //#define DEBUGFOO // Various tool debugging... //#define DEBUGTP // Toolpalette debugging... -//#include #include "mainwin.h" +//#include //#include #include "glwidget.h" -//#include "editwindow.h" -//#include "charwindow.h" -//#include "ttedit.h" +#include "settings.h" -MainWin::MainWin(): running(true) -{ - // The way BSNES controls things is by setting a timer with a zero - // timeout, sleeping if not emulating anything. Seems there has to be a - // better way. +// The way BSNES controls things is by setting a timer with a zero +// timeout, sleeping if not emulating anything. Seems there has to be a +// better way. - // It has a novel approach to plugging-in/using different video/audio/input - // methods, can we do something similar or should we just use the built-in - // QOpenGL? +// It has a novel approach to plugging-in/using different video/audio/input +// methods, can we do something similar or should we just use the built-in +// QOpenGL? - // We're going to try to use the built-in OpenGL support and see how it goes. - // We'll make the VJ core modular so that it doesn't matter what GUI is in - // use, we can drop it in anywhere and use it as-is. +// We're going to try to use the built-in OpenGL support and see how it goes. +// We'll make the VJ core modular so that it doesn't matter what GUI is in +// use, we can drop it in anywhere and use it as-is. -// ((TTEdit *)qApp)->charWnd = new CharWindow(this); +MainWin::MainWin() +{ videoWidget = new GLWidget(this); setCentralWidget(videoWidget); setWindowIcon(QIcon(":/res/vj.xpm")); setWindowTitle("Virtual Jaguar v2.0.0"); - QMenu * menu = menuBar()->addMenu(tr("&File")); - QToolBar * toolbar = addToolBar(tr("x1")); - /*QAction */ action = new QAction(tr("Toggle"), this); + // Create actions + + quitAppAct = new QAction(tr("E&xit"), this); + quitAppAct->setShortcuts(QKeySequence::Quit); + quitAppAct->setStatusTip(tr("Quit Virtual Jaguar")); + connect(quitAppAct, SIGNAL(triggered()), this, SLOT(close())); + + action = new QAction(QIcon(":/res/power.png"), tr("&Power"), this); action->setStatusTip(tr("Toggle running state")); action->setCheckable(true); - toolbar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(ToggleRunState())); + + zoomActs = new QActionGroup(this); + + x1Act = new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs); + x1Act->setStatusTip(tr("Set window zoom to 100%")); + x1Act->setCheckable(true); +// connect(x1Act, SIGNAL(triggered()), this, SLOT(???())); + + x2Act = new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs); + x2Act->setStatusTip(tr("Set window zoom to 200%")); + x2Act->setCheckable(true); +// connect(x2Act, SIGNAL(triggered()), this, SLOT(???())); + + x3Act = new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs); + x3Act->setStatusTip(tr("Set window zoom to 300%")); + x3Act->setCheckable(true); +// connect(x3Act, SIGNAL(triggered()), this, SLOT(???())); + + blurAct = new QAction(QIcon(":/res/generic.png"), tr("Blur"), this); + blurAct->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST")); + blurAct->setCheckable(true); + connect(blurAct, SIGNAL(triggered()), this, SLOT(ToggleBlur())); + + // Create menus & toolbars + + QMenu * fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->addAction(action); + fileMenu->addAction(quitAppAct); + + QToolBar * toolbar = addToolBar(tr("Stuff")); + toolbar->addAction(action); + toolbar->addAction(x1Act); + toolbar->addAction(x2Act); + toolbar->addAction(x3Act); + toolbar->addAction(blurAct); #if 0 // createActions(); newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); @@ -110,13 +147,13 @@ MainWin::MainWin(): running(true) statusBar()->showMessage(tr("Ready")); ReadSettings(); - -// connect(textEdit->document(), SIGNAL(contentsChanged()), -// this, SLOT(documentWasModified())); - -// setCurrentFile(""); setUnifiedTitleAndToolBarOnMac(true); + // Set toolbar button based on setting read in (sync the UI)... + blurAct->setChecked(vjs.glFilter); + x1Act->setChecked(true); + running = action->isChecked(); + // Set up timer based loop for animation... timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(Timer())); @@ -140,9 +177,9 @@ void MainWin::Timer(void) // Random hash & trash // We try to simulate an untuned tank circuit here... :-) - for(int x=0; xrasterWidth; x++) + for(uint32_t x=0; xrasterWidth; x++) { - for(int y=0; yrasterHeight; y++) + for(uint32_t y=0; yrasterHeight; y++) { videoWidget->buffer[(y * videoWidget->textureWidth) + x] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;// | (rand() & 0xFF);//0x000000FF; // buffer[(y * textureWidth) + x] = x*y; @@ -155,6 +192,32 @@ void MainWin::Timer(void) void MainWin::ToggleRunState(void) { running = !running; + + if (!running) + { + for(uint32_t x=0; xrasterWidth; x++) + for(uint32_t y=0; yrasterHeight; y++) + videoWidget->buffer[(y * videoWidget->textureWidth) + x] = 0x00000000; + + videoWidget->updateGL(); + } +} + +void MainWin::SetZoom100(void) +{ +} + +void MainWin::SetZoom200(void) +{ +} + +void MainWin::SetZoom300(void) +{ +} + +void MainWin::ToggleBlur(void) +{ + vjs.glFilter = !vjs.glFilter; } void MainWin::ReadSettings(void) @@ -164,11 +227,18 @@ void MainWin::ReadSettings(void) QSize size = settings.value("size", QSize(400, 400)).toSize(); resize(size); move(pos); -//videoWidget->updateGL(); -// pos = settings.value("charWndPos", QPoint(0, 0)).toPoint(); -// size = settings.value("charWndSize", QSize(200, 200)).toSize(); -// ((TTEdit *)qApp)->charWnd->resize(size); -// ((TTEdit *)qApp)->charWnd->move(pos); + + vjs.useJoystick = settings.value("useJoystick", false).toBool(); + vjs.joyport = settings.value("joyport", 0).toInt(); + vjs.hardwareTypeNTSC = settings.value("hardwareTypeNTSC", true).toBool(); + vjs.frameSkip = settings.value("frameSkip", 0).toInt(); + vjs.useJaguarBIOS = settings.value("useJaguarBIOS", false).toBool(); + vjs.DSPEnabled = settings.value("DSPEnabled", false).toBool(); + vjs.usePipelinedDSP = settings.value("usePipelinedDSP", false).toBool(); + vjs.fullscreen = settings.value("fullscreen", false).toBool(); + vjs.useOpenGL = settings.value("useOpenGL", true).toBool(); + vjs.glFilter = settings.value("glFilterType", 0).toInt(); + vjs.renderType = settings.value("renderType", 0).toInt(); } void MainWin::WriteSettings(void) @@ -176,7 +246,17 @@ void MainWin::WriteSettings(void) QSettings settings("Underground Software", "Virtual Jaguar"); settings.setValue("pos", pos()); settings.setValue("size", size()); -// settings.setValue("charWndPos", ((TTEdit *)qApp)->charWnd->pos()); -// settings.setValue("charWndSize", ((TTEdit *)qApp)->charWnd->size()); + + settings.setValue("useJoystick", vjs.useJoystick); + settings.setValue("joyport", vjs.joyport); + settings.setValue("hardwareTypeNTSC", vjs.hardwareTypeNTSC); + settings.setValue("frameSkip", vjs.frameSkip); + settings.setValue("useJaguarBIOS", vjs.useJaguarBIOS); + settings.setValue("DSPEnabled", vjs.DSPEnabled); + settings.setValue("usePipelinedDSP", vjs.usePipelinedDSP); + settings.setValue("fullscreen", vjs.fullscreen); + settings.setValue("useOpenGL", vjs.useOpenGL); + settings.setValue("glFilterType", vjs.glFilter); + settings.setValue("renderType", vjs.renderType); } diff --git a/src/gui/mainwin.h b/src/gui/mainwin.h index 5f170db..781ac29 100644 --- a/src/gui/mainwin.h +++ b/src/gui/mainwin.h @@ -32,6 +32,10 @@ class MainWin: public QMainWindow void Open(void); void Timer(void); void ToggleRunState(void); + void SetZoom100(void); + void SetZoom200(void); + void SetZoom300(void); + void ToggleBlur(void); private: void ReadSettings(void); @@ -43,7 +47,14 @@ class MainWin: public QMainWindow bool running; // EditWindow * editWnd; // CharWindow * charWnd; + QActionGroup * zoomActs; + QAction * action; + QAction * quitAppAct; + QAction * x1Act; + QAction * x2Act; + QAction * x3Act; + QAction * blurAct; }; #endif // __MAINWIN_H__ diff --git a/src/gui/vj.pro b/src/gui/vj.pro index a14781c..106f79b 100644 --- a/src/gui/vj.pro +++ b/src/gui/vj.pro @@ -20,3 +20,5 @@ OBJECTS_DIR = ../../obj MOC_DIR = ../../obj RCC_DIR = ../../obj UI_DIR = ../../obj +#Nope, don't do dookey +#INCLUDES_DIR = .. diff --git a/src/gui/vj.qrc b/src/gui/vj.qrc index 65b1eab..159f890 100644 --- a/src/gui/vj.qrc +++ b/src/gui/vj.qrc @@ -1,5 +1,10 @@ ../../res/vj.xpm + ../../res/power.png + ../../res/zoom100.png + ../../res/zoom200.png + ../../res/zoom300.png + ../../res/generic.png diff --git a/src/settings.cpp b/src/settings.cpp index b273cf6..0ddf070 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -19,9 +19,6 @@ #include "sdlemu_config.h" #include "log.h" -// Temporary vars... -bool smoothGLOutput = false; - using namespace std; // Global variables diff --git a/src/settings.h b/src/settings.h index f998b8b..acc8c91 100644 --- a/src/settings.h +++ b/src/settings.h @@ -57,7 +57,4 @@ void SaveVJSettings(void); extern VJSettings vjs; -// Temporary vars... -extern bool smoothGLOutput; - #endif // __SETTINGS_H__