mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Solitaire: Convert Solitaire GUI to a frame
Looks a bit nicer as a frame with inset edges.
This commit is contained in:
parent
0ff4eec8a8
commit
a540ec3519
2 changed files with 9 additions and 7 deletions
|
@ -135,7 +135,7 @@ void Game::keydown_event(GUI::KeyEvent& event)
|
||||||
|
|
||||||
void Game::mousedown_event(GUI::MouseEvent& event)
|
void Game::mousedown_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Widget::mousedown_event(event);
|
GUI::Frame::mousedown_event(event);
|
||||||
|
|
||||||
if (m_new_game_animation || m_game_over_animation)
|
if (m_new_game_animation || m_game_over_animation)
|
||||||
return;
|
return;
|
||||||
|
@ -188,7 +188,7 @@ void Game::mousedown_event(GUI::MouseEvent& event)
|
||||||
|
|
||||||
void Game::mouseup_event(GUI::MouseEvent& event)
|
void Game::mouseup_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Widget::mouseup_event(event);
|
GUI::Frame::mouseup_event(event);
|
||||||
|
|
||||||
if (!m_focused_stack || m_focused_cards.is_empty() || m_game_over_animation || m_new_game_animation)
|
if (!m_focused_stack || m_focused_cards.is_empty() || m_game_over_animation || m_new_game_animation)
|
||||||
return;
|
return;
|
||||||
|
@ -241,7 +241,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
|
||||||
|
|
||||||
void Game::mousemove_event(GUI::MouseEvent& event)
|
void Game::mousemove_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Widget::mousemove_event(event);
|
GUI::Frame::mousemove_event(event);
|
||||||
|
|
||||||
if (!m_mouse_down || m_game_over_animation || m_new_game_animation)
|
if (!m_mouse_down || m_game_over_animation || m_new_game_animation)
|
||||||
return;
|
return;
|
||||||
|
@ -261,7 +261,7 @@ void Game::mousemove_event(GUI::MouseEvent& event)
|
||||||
|
|
||||||
void Game::doubleclick_event(GUI::MouseEvent& event)
|
void Game::doubleclick_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Widget::doubleclick_event(event);
|
GUI::Frame::doubleclick_event(event);
|
||||||
|
|
||||||
if (m_game_over_animation) {
|
if (m_game_over_animation) {
|
||||||
start_game_over_animation();
|
start_game_over_animation();
|
||||||
|
@ -340,13 +340,15 @@ void Game::mark_intersecting_stacks_dirty(Card& intersecting_card)
|
||||||
|
|
||||||
void Game::paint_event(GUI::PaintEvent& event)
|
void Game::paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
GUI::Widget::paint_event(event);
|
GUI::Frame::paint_event(event);
|
||||||
|
|
||||||
m_has_to_repaint = false;
|
m_has_to_repaint = false;
|
||||||
if (m_game_over_animation && m_repaint_all)
|
if (m_game_over_animation && m_repaint_all)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GUI::Painter painter(*this);
|
GUI::Painter painter(*this);
|
||||||
|
painter.add_clip_rect(frame_inner_rect());
|
||||||
|
painter.add_clip_rect(event.rect());
|
||||||
|
|
||||||
if (m_repaint_all) {
|
if (m_repaint_all) {
|
||||||
painter.fill_rect(event.rect(), s_background_color);
|
painter.fill_rect(event.rect(), s_background_color);
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CardStack.h"
|
#include "CardStack.h"
|
||||||
|
#include <LibGUI/Frame.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/Widget.h>
|
|
||||||
|
|
||||||
namespace Solitaire {
|
namespace Solitaire {
|
||||||
|
|
||||||
class Game final : public GUI::Widget {
|
class Game final : public GUI::Frame {
|
||||||
C_OBJECT(Game)
|
C_OBJECT(Game)
|
||||||
public:
|
public:
|
||||||
static constexpr int width = 640;
|
static constexpr int width = 640;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue