2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2013-08-19 14:29:29 +00:00
|
|
|
|
|
|
|
#ifndef GAME_H
|
|
|
|
#define GAME_H
|
|
|
|
|
|
|
|
#include "character.h"
|
|
|
|
#include "level.h"
|
|
|
|
|
2023-02-07 12:52:50 +00:00
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QList>
|
|
|
|
|
2013-08-19 14:29:29 +00:00
|
|
|
//! [0]
|
|
|
|
class Game
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum SaveFormat {
|
|
|
|
Json, Binary
|
|
|
|
};
|
|
|
|
|
2017-08-22 07:52:55 +00:00
|
|
|
Character player() const;
|
2020-06-22 08:12:38 +00:00
|
|
|
QList<Level> levels() const;
|
2013-08-19 14:29:29 +00:00
|
|
|
|
|
|
|
void newGame();
|
|
|
|
bool loadGame(SaveFormat saveFormat);
|
|
|
|
bool saveGame(SaveFormat saveFormat) const;
|
|
|
|
|
|
|
|
void read(const QJsonObject &json);
|
|
|
|
void write(QJsonObject &json) const;
|
2017-08-22 07:52:55 +00:00
|
|
|
|
|
|
|
void print(int indentation = 0) const;
|
2013-08-19 14:29:29 +00:00
|
|
|
private:
|
|
|
|
Character mPlayer;
|
2020-06-22 08:12:38 +00:00
|
|
|
QList<Level> mLevels;
|
2013-08-19 14:29:29 +00:00
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
|
|
|
#endif // GAME_H
|