Commit 72563b83 authored by Ian Wadham's avatar Ian Wadham

Add keyboard entry of values into 3-D Roxdoku puzzles.

svn path=/trunk/KDE/kdegames/ksudoku/; revision=1287217
parent 22b7968d
......@@ -62,7 +62,8 @@ void KsView::createView() {
case TypeCustom: {
#ifdef OPENGL_SUPPORT
if(m_game.puzzle()->graph()->sizeZ() > 1) {
setWidget(new RoxdokuView(m_game, 0, 0));
// TODO - IDW - Add a parent widget. Memory leak?
setWidget(new RoxdokuView(m_game, m_gameActions, 0));
}
else {
setWidget(new View2D(0, m_game, m_gameActions));
......@@ -74,7 +75,8 @@ void KsView::createView() {
}
#ifdef OPENGL_SUPPORT
case TypeRoxdoku: {
setWidget(new RoxdokuView(m_game, 0, 0));
// TODO - IDW - Add a parent widget. Memory leak?
setWidget(new RoxdokuView(m_game, m_gameActions, 0));
break;
}
#endif
......
......@@ -35,6 +35,7 @@
#include "settings.h"
#include "renderer.h"
#include "gameactions.h"
namespace ksudoku{
......@@ -62,10 +63,9 @@ Matrix3fT ThisRot = {{ {1.0f}, {0.0f}, {0.0f}, // NEW: This Rota
{0.0f}, {0.0f}, {1.0f} }};
RoxdokuView::RoxdokuView(ksudoku::Game game, Symbols* symbols, QWidget *parent)
RoxdokuView::RoxdokuView(ksudoku::Game game, GameActions * gameActions,
QWidget * parent)
: QGLWidget(parent)
, m_symbols(symbols)
{
m_game = game;
m_graph = m_game.puzzle()->graph();
......@@ -79,6 +79,7 @@ RoxdokuView::RoxdokuView(ksudoku::Game game, Symbols* symbols, QWidget *parent)
connect(m_game.interface(), SIGNAL(cellChange(int)), this, SLOT(updateGL()));
connect(m_game.interface(), SIGNAL(fullChange()), this, SLOT(updateGL()));
connect(gameActions, SIGNAL(enterValue(int)), SLOT(enterValue(int)));
// IDW test. m_wheelmove = 0.0f;
m_wheelmove = -5.0f; // IDW test. Makes the viewport bigger, can see more.
......@@ -105,6 +106,14 @@ RoxdokuView::~RoxdokuView()
glDeleteTextures(25, m_texture[1]);
}
void RoxdokuView::enterValue(int value)
{
if (m_selection >= 0) {
m_game.setValue(m_selection, value);
updateGL();
}
}
QString RoxdokuView::status() const
{
QString m;
......
......@@ -42,6 +42,7 @@ namespace ksudoku{
class Game;
class Symbols;
class GameActions;
/**
* GUI for a Roxdoku puzzle.
......@@ -50,7 +51,7 @@ class RoxdokuView : public QGLWidget, public ViewInterface
{
Q_OBJECT
public:
RoxdokuView(ksudoku::Game game, Symbols* symbols, QWidget *parent = 0);
RoxdokuView(ksudoku::Game game, GameActions * gameActions, QWidget * parent = 0);
~RoxdokuView();
virtual QString status() const;
......@@ -64,6 +65,7 @@ public:
public slots:
void selectValue(int value);
void settingsChanged();
void enterValue(int value);
signals:
void valueSelected(int value); // Never used but connected to
......@@ -95,7 +97,6 @@ private slots:
private:
void loadSettings();
Symbols * m_symbols;
Game m_game;
SKGraph * m_graph;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment