ladybird/Userland/Games/Conway/Game.h
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

42 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Widget.h>
class Game : public GUI::Widget {
C_OBJECT(Game)
public:
virtual ~Game() override;
void reset();
int rows() const { return m_rows; };
int columns() const { return m_columns; };
private:
Game();
virtual void paint_event(GUI::PaintEvent&) override;
virtual void timer_event(Core::TimerEvent&) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
Gfx::IntRect first_cell_rect() const;
void seed_universe();
void update_universe();
void interact_at(const Gfx::IntPoint&);
const Gfx::Color m_alive_color { Color::Green };
const Gfx::Color m_dead_color { Color::Black };
const int m_rows { 200 };
const int m_columns { 200 };
const int m_sleep { 100 };
GUI::MouseButton m_last_button { GUI::MouseButton::None };
bool m_universe[200][200];
};