Rename testgame to game/GameWidget
This commit is contained in:
parent
08c264a9b6
commit
abc6356f55
@ -17,7 +17,7 @@
|
|||||||
* Free Software Foundation, Inc., *
|
* Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "testgame.h"
|
#include "game.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
@ -42,7 +42,7 @@ namespace toruschess {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestGame::TestGame(QWidget *parent)
|
GameWidget::GameWidget(QWidget *parent)
|
||||||
: QMainWindow(parent), m_game(new Game()), m_optionDlg(new OptionDlg(m_game, this)), m_viewMode((ViewMode) -1) {
|
: QMainWindow(parent), m_game(new Game()), m_optionDlg(new OptionDlg(m_game, this)), m_viewMode((ViewMode) -1) {
|
||||||
connect(this, SIGNAL(changedViewMode(ViewMode)), m_optionDlg, SLOT(changedViewMode(ViewMode)));
|
connect(this, SIGNAL(changedViewMode(ViewMode)), m_optionDlg, SLOT(changedViewMode(ViewMode)));
|
||||||
connect(m_optionDlg, SIGNAL(setViewMode(ViewMode)), this, SLOT(setViewMode(ViewMode)));
|
connect(m_optionDlg, SIGNAL(setViewMode(ViewMode)), this, SLOT(setViewMode(ViewMode)));
|
||||||
@ -88,19 +88,19 @@ namespace toruschess {
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGame::gameChanged(GameState state) {
|
void GameWidget::gameChanged(GameState state) {
|
||||||
statusBar()->showMessage(state2string(state));
|
statusBar()->showMessage(state2string(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGame::menuRestart() {
|
void GameWidget::menuRestart() {
|
||||||
m_game->restart();
|
m_game->restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGame::menuOptions() {
|
void GameWidget::menuOptions() {
|
||||||
m_optionDlg->exec();
|
m_optionDlg->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGame::setViewMode(ViewMode viewMode) {
|
void GameWidget::setViewMode(ViewMode viewMode) {
|
||||||
if (m_viewMode == viewMode) return;
|
if (m_viewMode == viewMode) return;
|
||||||
m_viewMode = viewMode;
|
m_viewMode = viewMode;
|
||||||
switch (m_viewMode) {
|
switch (m_viewMode) {
|
||||||
@ -122,13 +122,13 @@ namespace toruschess {
|
|||||||
emit changedViewMode(viewMode);
|
emit changedViewMode(viewMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGame::menuView2d() {
|
void GameWidget::menuView2d() {
|
||||||
setViewMode(VIEW_2D);
|
setViewMode(VIEW_2D);
|
||||||
}
|
}
|
||||||
void TestGame::menuView3d() {
|
void GameWidget::menuView3d() {
|
||||||
setViewMode(VIEW_3D);
|
setViewMode(VIEW_3D);
|
||||||
}
|
}
|
||||||
void TestGame::menuViewTorus() {
|
void GameWidget::menuViewTorus() {
|
||||||
setViewMode(VIEW_TORUS);
|
setViewMode(VIEW_TORUS);
|
||||||
}
|
}
|
||||||
|
|
@ -39,10 +39,10 @@
|
|||||||
*/
|
*/
|
||||||
namespace toruschess {
|
namespace toruschess {
|
||||||
|
|
||||||
class TestGame : public QMainWindow {
|
class GameWidget : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TestGame(QWidget *parent = 0);
|
GameWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
ViewMode viewMode() const { return m_viewMode; }
|
ViewMode viewMode() const { return m_viewMode; }
|
||||||
|
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "testgame.h"
|
#include "game.h"
|
||||||
|
|
||||||
using namespace toruschess;
|
using namespace toruschess;
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ int main(int argc, char *argv[]) {
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Q_INIT_RESOURCE(media);
|
Q_INIT_RESOURCE(media);
|
||||||
|
|
||||||
TestGame testGame;
|
GameWidget game;
|
||||||
testGame.show();
|
game.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
src/src.pro
40
src/src.pro
@ -1,38 +1,18 @@
|
|||||||
SOURCES += main.cpp \
|
|
||||||
testgame.cpp \
|
|
||||||
toruschess.cpp \
|
|
||||||
field2d.cpp \
|
|
||||||
piecelibrary.cpp \
|
|
||||||
field3d.cpp \
|
|
||||||
ai.cpp \
|
|
||||||
optiondlg.cpp
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
CONFIG += warn_on \
|
CONFIG += warn_on thread qt opengl debug
|
||||||
thread \
|
CONFIG -= release
|
||||||
qt \
|
QT += svg opengl
|
||||||
opengl \
|
|
||||||
debug
|
|
||||||
TARGET = toruschess
|
|
||||||
DESTDIR = ../bin
|
|
||||||
RESOURCES += media.qrc
|
|
||||||
|
|
||||||
QT += svg \
|
|
||||||
opengl
|
|
||||||
HEADERS += testgame.h \
|
|
||||||
toruschess.h \
|
|
||||||
field2d.h \
|
|
||||||
piecelibrary.h \
|
|
||||||
field3d.h \
|
|
||||||
ai.h \
|
|
||||||
optiondlg.h
|
|
||||||
|
|
||||||
LIBS += -l3ds
|
|
||||||
|
|
||||||
QMAKE_CXXFLAGS_RELEASE += -g
|
QMAKE_CXXFLAGS_RELEASE += -g
|
||||||
|
|
||||||
CONFIG -= release
|
TARGET = toruschess
|
||||||
|
DESTDIR = ../bin
|
||||||
|
|
||||||
|
RESOURCES += media.qrc
|
||||||
|
SOURCES += main.cpp game.cpp toruschess.cpp field2d.cpp piecelibrary.cpp field3d.cpp ai.cpp optiondlg.cpp
|
||||||
|
HEADERS += game.h toruschess.h field2d.h piecelibrary.h field3d.h ai.h optiondlg.h
|
||||||
FORMS += optiondlg.ui
|
FORMS += optiondlg.ui
|
||||||
|
|
||||||
DISTFILES += ../README
|
LIBS += -l3ds
|
||||||
|
|
||||||
|
DISTFILES += ../README
|
||||||
|
Loading…
Reference in New Issue
Block a user