mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
Games: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
This commit is contained in:
parent
9521f71944
commit
27c30ca063
26 changed files with 41 additions and 82 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,10 +16,6 @@ BoardView::BoardView(Game::Board const* board)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardView::~BoardView()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void BoardView::set_board(Game::Board const* board)
|
void BoardView::set_board(Game::Board const* board)
|
||||||
{
|
{
|
||||||
if (has_timer())
|
if (has_timer())
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +14,7 @@ class BoardView final : public GUI::Frame {
|
||||||
C_OBJECT(BoardView);
|
C_OBJECT(BoardView);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BoardView() override;
|
virtual ~BoardView() override = default;
|
||||||
void set_board(Game::Board const* board);
|
void set_board(Game::Board const* board);
|
||||||
|
|
||||||
Function<void(Game::Direction)> on_move;
|
Function<void(Game::Direction)> on_move;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -26,10 +27,6 @@ Game::Game()
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::reset_paddle()
|
void Game::reset_paddle()
|
||||||
{
|
{
|
||||||
update(enclosing_int_rect(m_paddle.rect));
|
update(enclosing_int_rect(m_paddle.rect));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +19,7 @@ public:
|
||||||
static const int game_width = 480;
|
static const int game_width = 480;
|
||||||
static const int game_height = 500;
|
static const int game_height = 500;
|
||||||
|
|
||||||
virtual ~Game() override;
|
virtual ~Game() override = default;
|
||||||
|
|
||||||
void set_paused(bool paused);
|
void set_paused(bool paused);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -20,10 +20,6 @@ LevelSelectDialog::LevelSelectDialog(Window* parent_window)
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelSelectDialog::~LevelSelectDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int LevelSelectDialog::show(int& board_number, Window* parent_window)
|
int LevelSelectDialog::show(int& board_number, Window* parent_window)
|
||||||
{
|
{
|
||||||
auto box = LevelSelectDialog::construct(parent_window);
|
auto box = LevelSelectDialog::construct(parent_window);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ namespace Breakout {
|
||||||
class LevelSelectDialog : public GUI::Dialog {
|
class LevelSelectDialog : public GUI::Dialog {
|
||||||
C_OBJECT(LevelSelectDialog)
|
C_OBJECT(LevelSelectDialog)
|
||||||
public:
|
public:
|
||||||
virtual ~LevelSelectDialog() override;
|
virtual ~LevelSelectDialog() override = default;
|
||||||
static int show(int& board_number, Window* parent_window);
|
static int show(int& board_number, Window* parent_window);
|
||||||
int level() const { return m_level; }
|
int level() const { return m_level; }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -22,10 +22,6 @@ ChessWidget::ChessWidget()
|
||||||
set_piece_set("stelar7");
|
set_piece_set("stelar7");
|
||||||
}
|
}
|
||||||
|
|
||||||
ChessWidget::~ChessWidget()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChessWidget::paint_event(GUI::PaintEvent& event)
|
void ChessWidget::paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
const int min_size = min(width(), height());
|
const int min_size = min(width(), height());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,7 @@ class ChessWidget final : public GUI::Frame {
|
||||||
C_OBJECT(ChessWidget);
|
C_OBJECT(ChessWidget);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ChessWidget() override;
|
virtual ~ChessWidget() override = default;
|
||||||
|
|
||||||
virtual void paint_event(GUI::PaintEvent&) override;
|
virtual void paint_event(GUI::PaintEvent&) override;
|
||||||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com>
|
* Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com>
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,10 +15,6 @@ Board::Board(size_t rows, size_t columns)
|
||||||
resize(rows, columns);
|
resize(rows, columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
Board::~Board()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Board::run_generation()
|
void Board::run_generation()
|
||||||
{
|
{
|
||||||
m_stalled = true;
|
m_stalled = true;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com>
|
* Copyright (c) 2021, Andres Crucitti <dasc495@gmail.com>
|
||||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
class Board {
|
class Board {
|
||||||
public:
|
public:
|
||||||
Board(size_t rows, size_t columns);
|
Board(size_t rows, size_t columns);
|
||||||
~Board();
|
~Board() = default;
|
||||||
|
|
||||||
size_t columns() const { return m_columns; }
|
size_t columns() const { return m_columns; }
|
||||||
size_t rows() const { return m_rows; }
|
size_t rows() const { return m_rows; }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz>
|
* Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,10 +17,6 @@ Pattern::Pattern(Vector<String> pattern)
|
||||||
m_pattern = move(pattern);
|
m_pattern = move(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern::~Pattern()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pattern::set_action(GUI::Action* action)
|
void Pattern::set_action(GUI::Action* action)
|
||||||
{
|
{
|
||||||
m_action = action;
|
m_action = action;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz>
|
* Copyright (c) 2021, Ryan Wilson <ryan@rdwilson.xyz>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -11,10 +12,9 @@
|
||||||
#include <LibGUI/Event.h>
|
#include <LibGUI/Event.h>
|
||||||
#include <LibGUI/Forward.h>
|
#include <LibGUI/Forward.h>
|
||||||
|
|
||||||
class Pattern {
|
class Pattern final {
|
||||||
public:
|
public:
|
||||||
Pattern(Vector<String>);
|
Pattern(Vector<String>);
|
||||||
virtual ~Pattern();
|
|
||||||
Vector<String> pattern() { return m_pattern; };
|
Vector<String> pattern() { return m_pattern; };
|
||||||
GUI::Action* action() { return m_action; }
|
GUI::Action* action() { return m_action; }
|
||||||
void set_action(GUI::Action*);
|
void set_action(GUI::Action*);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
||||||
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -92,10 +93,6 @@ Game::Game()
|
||||||
reset();
|
reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
Game::~Game()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::reset()
|
void Game::reset()
|
||||||
{
|
{
|
||||||
dbgln_if(HEARTS_DEBUG, "=====");
|
dbgln_if(HEARTS_DEBUG, "=====");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
||||||
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +23,7 @@ public:
|
||||||
static constexpr int width = 640;
|
static constexpr int width = 640;
|
||||||
static constexpr int height = 480;
|
static constexpr int height = 480;
|
||||||
|
|
||||||
virtual ~Game() override;
|
virtual ~Game() override = default;
|
||||||
|
|
||||||
void setup(String player_name, int hand_number = 0);
|
void setup(String player_name, int hand_number = 0);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +75,3 @@ CustomGameDialog::CustomGameDialog(Window* parent_window)
|
||||||
|
|
||||||
set_max_mines();
|
set_max_mines();
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomGameDialog::~CustomGameDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +21,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CustomGameDialog(GUI::Window* parent_window);
|
CustomGameDialog(GUI::Window* parent_window);
|
||||||
virtual ~CustomGameDialog() override;
|
virtual ~CustomGameDialog() override = default;
|
||||||
|
|
||||||
void set_max_mines();
|
void set_max_mines();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -155,10 +156,6 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Field::~Field()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Field::set_face(Face face)
|
void Field::set_face(Face face)
|
||||||
{
|
{
|
||||||
switch (face) {
|
switch (face) {
|
||||||
|
@ -530,14 +527,6 @@ void Field::set_single_chording(bool enabled)
|
||||||
Config::write_bool("Minesweeper", "Game", "SingleChording", m_single_chording);
|
Config::write_bool("Minesweeper", "Game", "SingleChording", m_single_chording);
|
||||||
}
|
}
|
||||||
|
|
||||||
Square::Square()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Square::~Square()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void Field::for_each_square(Callback callback)
|
void Field::for_each_square(Callback callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -19,8 +20,8 @@ class Square {
|
||||||
AK_MAKE_NONCOPYABLE(Square);
|
AK_MAKE_NONCOPYABLE(Square);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Square();
|
Square() = default;
|
||||||
~Square();
|
~Square() = default;
|
||||||
|
|
||||||
Field* field { nullptr };
|
Field* field { nullptr };
|
||||||
bool is_swept { false };
|
bool is_swept { false };
|
||||||
|
@ -43,7 +44,7 @@ class Field final : public GUI::Frame {
|
||||||
friend class SquareLabel;
|
friend class SquareLabel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Field() override;
|
virtual ~Field() override = default;
|
||||||
|
|
||||||
enum class Difficulty {
|
enum class Difficulty {
|
||||||
Beginner,
|
Beginner,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,10 +15,6 @@ Game::Game()
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::reset_paddles()
|
void Game::reset_paddles()
|
||||||
{
|
{
|
||||||
if (m_cursor_paddle_target_y.has_value())
|
if (m_cursor_paddle_target_y.has_value())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ public:
|
||||||
static const int game_width = 560;
|
static const int game_width = 560;
|
||||||
static const int game_height = 480;
|
static const int game_height = 480;
|
||||||
|
|
||||||
virtual ~Game() override;
|
virtual ~Game() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Game();
|
Game();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, Mustafa Quraish <mustafa@serenityos.org>
|
* Copyright (c) 2021, Mustafa Quraish <mustafa@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -26,10 +27,6 @@ SnakeGame::SnakeGame()
|
||||||
m_high_score_text = String::formatted("Best: {}", m_high_score);
|
m_high_score_text = String::formatted("Best: {}", m_high_score);
|
||||||
}
|
}
|
||||||
|
|
||||||
SnakeGame::~SnakeGame()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SnakeGame::reset()
|
void SnakeGame::reset()
|
||||||
{
|
{
|
||||||
m_head = { m_rows / 2, m_columns / 2 };
|
m_head = { m_rows / 2, m_columns / 2 };
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +15,7 @@ class SnakeGame : public GUI::Frame {
|
||||||
C_OBJECT(SnakeGame);
|
C_OBJECT(SnakeGame);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~SnakeGame() override;
|
virtual ~SnakeGame() override = default;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
||||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -36,10 +37,6 @@ Game::Game()
|
||||||
m_stacks.append(adopt_ref(*new CardStack({ 10 + 6 * Card::width + 60, 10 + Card::height + 10 }, CardStack::Type::Normal)));
|
m_stacks.append(adopt_ref(*new CardStack({ 10 + 6 * Card::width + 60, 10 + Card::height + 10 }, CardStack::Type::Normal)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static float rand_float()
|
static float rand_float()
|
||||||
{
|
{
|
||||||
return get_random_uniform(RAND_MAX) / static_cast<float>(RAND_MAX);
|
return get_random_uniform(RAND_MAX) / static_cast<float>(RAND_MAX);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
|
||||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +35,7 @@ public:
|
||||||
static constexpr int width = 640;
|
static constexpr int width = 640;
|
||||||
static constexpr int height = 480;
|
static constexpr int height = 480;
|
||||||
|
|
||||||
virtual ~Game() override;
|
virtual ~Game() override = default;
|
||||||
|
|
||||||
Mode mode() const { return m_mode; }
|
Mode mode() const { return m_mode; }
|
||||||
void setup(Mode);
|
void setup(Mode);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
* Copyright (c) 2022, Jonas Höpner <me@jonashoepner.de>
|
* Copyright (c) 2022, Jonas Höpner <me@jonashoepner.de>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -29,10 +30,6 @@ Game::Game()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::setup(Mode mode)
|
void Game::setup(Mode mode)
|
||||||
{
|
{
|
||||||
if (m_new_game_animation)
|
if (m_new_game_animation)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,7 @@ public:
|
||||||
static constexpr int width = 10 + 10 * Card::width + 90 + 10;
|
static constexpr int width = 10 + 10 * Card::width + 90 + 10;
|
||||||
static constexpr int height = 480;
|
static constexpr int height = 480;
|
||||||
|
|
||||||
~Game() override;
|
~Game() override = default;
|
||||||
|
|
||||||
Mode mode() const { return m_mode; }
|
Mode mode() const { return m_mode; }
|
||||||
void setup(Mode);
|
void setup(Mode);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue