Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) MazeCreator

 

MazeCreator is a tool to demonstrate my simple maze generation algorithm.

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolMazeCreator/ToolMazeCreatorConsole.pro

 

# Go ahead and use Qt.Core: it is about as platform-independent as
# the STL and Boost
QT += core

# Go ahead and use Qt.Gui: it is about as platform-independent as
# the STL and Boost. It is needed for QImage
QT += gui

# Don't define widgets: it would defy the purpose of this console
# application to work non-GUI
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

include(ToolMazeCreatorConsole.pri)
include(../../Classes/CppAbout/CppAbout.pri)
include(../../Classes/CppHelp/CppHelp.pri)
include(../../Classes/CppMenuDialog/CppMenuDialog.pri)
include(../../Classes/CppRichelBilderbeekProgram/CppRichelBilderbeekProgram.pri)
include(../../Classes/CppTrace/CppTrace.pri)

#
#
# Type of compile
#
#

CONFIG(release, debug|release) {
  DEFINES += NDEBUG NTRACE_BILDERBIKKEL
}

QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++

unix {
  QMAKE_CXXFLAGS += -Werror
}

#
#
# Boost
#
#

win32 {
  INCLUDEPATH += \
    ../../Libraries/boost_1_54_0
}

 

 

 

 

 

Qt project file: ./ToolMazeCreator/ToolMazeCreatorDesktop.pro

 

include(../../DesktopApplication.pri)
include(../../Libraries/Boost.pri)
include(../../Libraries/GeneralConsole.pri)
include(../../Libraries/GeneralDesktop.pri)

include(ToolMazeCreatorDesktop.pri)

SOURCES += qtmain.cpp

 

 

 

 

 

./ToolMazeCreator/ToolMazeCreatorConsole.pri

 

INCLUDEPATH += \
    ../../Tools/ToolMazeCreator

SOURCES += \
    ../../Tools/ToolMazeCreator/mazecreatormenudialog.cpp

HEADERS += \
    ../../Tools/ToolMazeCreator/mazecreatormenudialog.h

OTHER_FILES += \
    ../../Tools/ToolMazeCreator/Licence.txt

RESOURCES += \
    ../../Tools/ToolMazeCreator/ToolMazeCreator.qrc

 

 

 

 

 

./ToolMazeCreator/ToolMazeCreatorDesktop.pri

 

include(../../Tools/ToolMazeCreator/ToolMazeCreatorConsole.pri)

SOURCES += \
    ../../Tools/ToolMazeCreator/qtmazecreatormenudialog.cpp \
    ../../Tools/ToolMazeCreator/qtmazecreatormaindialog.cpp

HEADERS += \
    ../../Tools/ToolMazeCreator/qtmazecreatormenudialog.h \
    ../../Tools/ToolMazeCreator/qtmazecreatormaindialog.h \

FORMS    += \
    ../../Tools/ToolMazeCreator/qtmazecreatormaindialog.ui \
    ../../Tools/ToolMazeCreator/qtmazecreatormenudialog.ui

 

 

 

 

 

./ToolMazeCreator/ToolMazeCreatorWebsite.pri

 

include(../../Tools/ToolMazeCreator/ToolMazeCreatorConsole.pri)
SOURCES +=
HEADERS +=

 

 

 

 

 

./ToolMazeCreator/main.cpp

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2012 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "mazecreatormenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  const std::vector<std::string> args { ribi::MenuDialog::ConvertArguments(argc,argv) };
  ribi::MazeCreatorMenuDialog d;
  return d.Execute(args);
}

 

 

 

 

 

./ToolMazeCreator/mazecreatormenudialog.h

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#ifndef MAZECREATORMENUDIALOG_H
#define MAZECREATORMENUDIALOG_H

#include <string>
#include <vector>

#include "about.h"
#include "menudialog.h"

namespace ribi {

///MazeCreatorMenuDialog contains the MazeCreator menu dialog
struct MazeCreatorMenuDialog final : public MenuDialog
{
  About GetAbout() const noexcept override;
  Help GetHelp() const noexcept override;
  boost::shared_ptr<const Program> GetProgram() const noexcept override;

  std::string GetVersion() const noexcept override;
  std::vector<std::string> GetVersionHistory() const noexcept override;

  private:
  int ExecuteSpecific(const std::vector<std::string>& argv) noexcept override;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

} //~namespace ribi

#endif // MAZECREATORMENUDIALOG_H

 

 

 

 

 

./ToolMazeCreator/mazecreatormenudialog.cpp

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#include "mazecreatormenudialog.h"

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stdexcept>

#include "richelbilderbeekprogram.h"
#include "testtimer.h"
#include "trace.h"

int ribi::MazeCreatorMenuDialog::ExecuteSpecific(const std::vector<std::string>& argv) noexcept
{
  #ifndef NDEBUG
  Test();
  #endif
  const int argc = static_cast<int>(argv.size());
  if (argc == 1)
  {
    std::cout << GetHelp() << '\n';
    return 1;
  }
  assert(!"TODO");
  return 1;
}

ribi::About ribi::MazeCreatorMenuDialog::GetAbout() const noexcept
{
  About a(
    "Richel Bilderbeek",
    "MazeCreator",
    "creates a maze and displays it on screen",
    "the 6th of March 2012",
    "2007-2015",
    "http://www.richelbilderbeek.nl/ToolMazeCreator.htm",
    GetVersion(),
    GetVersionHistory()
  );
  a.AddLibrary("TestTimer version: " + TestTimer::GetVersion());
  a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}

ribi::Help ribi::MazeCreatorMenuDialog::GetHelp() const noexcept
{
  return ribi::Help(
    this->GetAbout().GetFileTitle(),
    this->GetAbout().GetFileDescription(),
    {

    },
    {

    }
  );
}

boost::shared_ptr<const ribi::Program> ribi::MazeCreatorMenuDialog::GetProgram() const noexcept
{
  const boost::shared_ptr<const Program> p {
    new ProgramMazeCreator
  };
  assert(p);
  return p;
}

std::string ribi::MazeCreatorMenuDialog::GetVersion() const noexcept
{
  return "1.1";
}

std::vector<std::string> ribi::MazeCreatorMenuDialog::GetVersionHistory() const noexcept
{
  return {
    "2007-xx-xx: version 1.0: initial version.",
    "2012-03-06: version 1.1: added versioning. Added menu screen."
  };
}


#ifndef NDEBUG
void ribi::MazeCreatorMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolMazeCreator/qtmain.cpp

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#include <QApplication>
#include "qtmazecreatormenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  ribi::QtMazeCreatorMenuDialog w;
  w.show();
  return a.exec();
}

 

 

 

 

 

./ToolMazeCreator/qtmazecreatormaindialog.h

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#ifndef QTMAZECREATORMAINDIALOG_H
#define QTMAZECREATORMAINDIALOG_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <boost/shared_ptr.hpp>
#include "qthideandshowdialog.h"
#pragma GCC diagnostic pop

struct QGraphicsPixmapItem;
struct QGraphicsScene;
struct QTimer;

namespace Ui {
  class QtMazeCreatorMainDialog;
}

namespace ribi {

class QtMazeCreatorMainDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtMazeCreatorMainDialog(QWidget *parent = 0);
  QtMazeCreatorMainDialog(const QtMazeCreatorMainDialog&) = delete;
  QtMazeCreatorMainDialog& operator=(const QtMazeCreatorMainDialog&) = delete;
  ~QtMazeCreatorMainDialog() noexcept;

  //From http://www.richelbilderbeek.nl/CppCreateMaze.htm
  static const std::vector<std::vector<int> > CreateMaze(const int size);

private:
  Ui::QtMazeCreatorMainDialog *ui;
  boost::shared_ptr<QGraphicsScene> m_scene;
  boost::shared_ptr<QGraphicsPixmapItem> m_background;
  boost::shared_ptr<QTimer> m_timer;

  std::size_t m_maze_sz;
  double m_rotation;


  void resizeEvent(QResizeEvent*);
  void keyPressEvent(QKeyEvent* event);
  void drawMaze();

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif

private slots:
  void onTimer();

};

} //~namespace ribi


#endif // QTMAZECREATORMAINDIALOG_H

 

 

 

 

 

./ToolMazeCreator/qtmazecreatormaindialog.cpp

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qtmazecreatormaindialog.h"

#include <cassert>
#include <cmath>
#include <cstdlib>
#include <iostream>

#include <QDesktopWidget>
#include <QGraphicsPixmapItem>
#include <QGraphicsScene>
#include <QKeyEvent>
#include <QTimer>

#include "trace.h"
#include "testtimer.h"
#include "ui_qtmazecreatormaindialog.h"
#pragma GCC diagnostic pop

ribi::QtMazeCreatorMainDialog::QtMazeCreatorMainDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtMazeCreatorMainDialog),
    m_scene(new QGraphicsScene),
    m_background(new QGraphicsPixmapItem),
    m_timer(new QTimer),
    m_maze_sz(7),
    m_rotation(0.0)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
  ui->graphicsView->setScene(m_scene.get());
  m_scene->addItem(m_background.get());

  this->drawMaze();

  //Set all connections
  QObject::connect(m_timer.get(),&QTimer::timeout,
    this,&ribi::QtMazeCreatorMainDialog::onTimer
  );

  //Set the rotation timer to work
  m_timer->start(50);

  //Put the dialog to its proper size and spot
  this->setGeometry(0,0,
    static_cast<int>(640),
    static_cast<int>(640));
  const QRect screen = QApplication::desktop()->screenGeometry();
  this->move( screen.center() - this->rect().center() );
}

ribi::QtMazeCreatorMainDialog::~QtMazeCreatorMainDialog() noexcept
{
  delete ui;
}

//Sets the scale of the maze
void ribi::QtMazeCreatorMainDialog::resizeEvent(QResizeEvent*)
{
  const double scale
    = 0.9 * std::min(ui->graphicsView->width(),ui->graphicsView->height())
    / (static_cast<double>(this->m_maze_sz) * std::sqrt(2.0));
  m_background->setScale(scale);
}

void ribi::QtMazeCreatorMainDialog::keyPressEvent(QKeyEvent* event)
{
  if (event->type() == QEvent::KeyPress)
  {
    //std::clog << "Key pressed\n";
    switch (event->key())
    {
      case Qt::Key_Plus:
          //std::clog << "Key plus pressed\n";
          m_maze_sz+=4;
          drawMaze();
          resizeEvent(0);
        break;
      case Qt::Key_Minus:
          //std::clog << "Key minus pressed\n";
          if (m_maze_sz == 7) return;
          m_maze_sz-=4;
          drawMaze();
          resizeEvent(0);
        break;
    }
  }
}

void ribi::QtMazeCreatorMainDialog::drawMaze()
{
  const int size = static_cast<int>(m_maze_sz);
  //Prepare a pixmap of right size
  //and set the rotation origin
  {
    QPixmap pixmap(size,size);
    m_background->setPixmap(pixmap);
    m_background->setTransformOriginPoint(
      static_cast<double>(size) / 2.0,
      static_cast<double>(size) / 2.0);
  }

  const std::vector<std::vector<int> > maze = CreateMaze(size);
  assert(maze.size() == m_maze_sz);
  assert(maze[0].size() == m_maze_sz);

  QImage i = m_background->pixmap().toImage();

  for (int y=0; y!=size; ++y)
  {
    for (int x=0; x!=size; ++x)
    {
      switch(maze[x][y])
      {
        case 0: //Road
          i.setPixel(QPoint(x,y),QColor(255,255,255).rgb());
          break;
        case 1: //Wall
          i.setPixel(QPoint(x,y),QColor(0,0,0).rgb());
          break;
        case 2: //Unexplorer
          i.setPixel(QPoint(x,y),QColor(255,0,0).rgb());
          break;
        default:
          std::cerr << maze[x][y] << '\n';
          assert(!"Should not get here");
          break;
      }
    }
  }
  m_background->setPixmap(m_background->pixmap().fromImage(i));
}

void ribi::QtMazeCreatorMainDialog::onTimer()
{
  m_rotation+=1.0;
  m_background->setRotation(m_rotation);
}

//Creates a maze
// 0 : path
// 1 : wall
//From http://www.richelbilderbeek.nl/CppCreateMaze.htm
const std::vector<std::vector<int> > ribi::QtMazeCreatorMainDialog::CreateMaze(const int sz)
{
  //Assume correct size dimensions
  assert( sz > 4 && sz % 4 == 3
    && "Size must be 3 + (n * 4) for n > 0");

  //Start with a wall-only maze
  std::vector<std::vector<int> > maze(sz, std::vector<int>(sz,1));

  //Prepare maze, remove paths
  // XXXXXXX    1111111
  // X X X X    1212121
  // XXXXXXX    1111111
  // X XOX X -> 1210121
  // XXXXXXX    1111111
  // X X X X    1212121
  // XXXXXXX    1111111

  //Draw open spaces
  for (int y=1; y<sz; y+=2)
  {
    for (int x=1; x<sz; x+=2)
    {
      maze[y][x] = 2; //2: unexplored
    }
  }

  const int mid = sz/2;

  maze[mid][mid] = 0;

  std::vector<std::pair<int,int> > v;
  v.push_back(std::make_pair(mid,mid));
  while (!v.empty())
  {
    //Set a random explorer square at the back
    std::swap(v.back(),v[ std::rand() % static_cast<int>(v.size())]);
    //Check possible adjacent squares
    const int x = v.back().first;
    const int y = v.back().second;
    std::vector<std::pair<int,int> > next;
    if (x > 0 + 2 && maze[y][x-2] == 2) next.push_back(std::make_pair(x-2,y));
    if (y > 0 + 2 && maze[y-2][x] == 2) next.push_back(std::make_pair(x,y-2));
    if (x < sz - 2 && maze[y][x+2] == 2) next.push_back(std::make_pair(x+2,y));
    if (y < sz - 2 && maze[y+2][x] == 2) next.push_back(std::make_pair(x,y+2));
    //Dead end?
    if (next.empty())
    {
      v.pop_back();
      continue;
    }
    //Select a random next adjacent square
    const int nextIndex = (std::rand() >> 4) % static_cast<int>(next.size());
    const int nextX = next[nextIndex].first;
    const int nextY = next[nextIndex].second;
    //Clear next square
    maze[nextY][nextX] = 0;
    //Clear path towards next square
    maze[(y + nextY)/2][(x + nextX)/2] = 0;
    //Add next square to stack
    v.push_back(std::make_pair(nextX,nextY));
  }
  return maze;
}

#ifndef NDEBUG
void ribi::QtMazeCreatorMainDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolMazeCreator/qtmazecreatormenudialog.h

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#ifndef QTMAZECREATORMENUDIALOG_H
#define QTMAZECREATORMENUDIALOG_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qthideandshowdialog.h"
#pragma GCC diagnostic pop

namespace Ui {
  class QtMazeCreatorMenuDialog;
}

namespace ribi {

class QtMazeCreatorMenuDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtMazeCreatorMenuDialog(QWidget *parent = 0);
  QtMazeCreatorMenuDialog(const QtMazeCreatorMenuDialog&) = delete;
  QtMazeCreatorMenuDialog& operator=(const QtMazeCreatorMenuDialog&) = delete;
  ~QtMazeCreatorMenuDialog() noexcept;

private slots:

  void on_button_start_clicked();
  void on_button_about_clicked();
  void on_button_quit_clicked();

private:
  Ui::QtMazeCreatorMenuDialog *ui;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

} //~namespace ribi

#endif // QTMAZECREATORMENUDIALOG_H

 

 

 

 

 

./ToolMazeCreator/qtmazecreatormenudialog.cpp

 

//---------------------------------------------------------------------------
/*
MazeCreator, creates a maze and displays it on screen.
Copyright (C) 2007-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From hhtp://www.richelbilderbeek.nl/ToolMazeCreator.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qtmazecreatormenudialog.h"

#include "mazecreatormenudialog.h"
#include "qtaboutdialog.h"
#include "qtmazecreatormaindialog.h"
#include "testtimer.h"
#include "trace.h"
#include "ui_qtmazecreatormenudialog.h"
#pragma GCC diagnostic pop

ribi::QtMazeCreatorMenuDialog::QtMazeCreatorMenuDialog(QWidget *parent) :
  QtHideAndShowDialog(parent),
  ui(new Ui::QtMazeCreatorMenuDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
}

ribi::QtMazeCreatorMenuDialog::~QtMazeCreatorMenuDialog() noexcept
{
  delete ui;
}

void ribi::QtMazeCreatorMenuDialog::on_button_start_clicked()
{
  QtMazeCreatorMainDialog d;
  this->ShowChild(&d);
}

void ribi::QtMazeCreatorMenuDialog::on_button_about_clicked()
{
  this->hide();
  About a = MazeCreatorMenuDialog().GetAbout();
  //a.AddLibrary("QtDialWidget version: " + QtDialWidget::GetVersion());
  QtAboutDialog d(a);
  this->ShowChild(&d);
}

void ribi::QtMazeCreatorMenuDialog::on_button_quit_clicked()
{
  close();
}

#ifndef NDEBUG
void ribi::QtMazeCreatorMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml