mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
FlappyBug: Convert the main game widget to a GUI::Frame
This commit is contained in:
parent
928364e102
commit
25c53e35e7
2 changed files with 6 additions and 3 deletions
|
@ -53,10 +53,13 @@ void Game::timer_event(Core::TimerEvent&)
|
||||||
|
|
||||||
void Game::paint_event(GUI::PaintEvent& event)
|
void Game::paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
|
GUI::Frame::paint_event(event);
|
||||||
|
|
||||||
GUI::Painter painter(*this);
|
GUI::Painter painter(*this);
|
||||||
|
painter.add_clip_rect(frame_inner_rect());
|
||||||
painter.add_clip_rect(event.rect());
|
painter.add_clip_rect(event.rect());
|
||||||
|
|
||||||
painter.draw_tiled_bitmap(rect(), *m_background_bitmap);
|
painter.draw_tiled_bitmap(frame_inner_rect(), *m_background_bitmap);
|
||||||
|
|
||||||
painter.draw_scaled_bitmap(m_cloud.rect(), *m_cloud.bitmap(), m_cloud.bitmap()->rect(), 0.2f);
|
painter.draw_scaled_bitmap(m_cloud.rect(), *m_cloud.bitmap(), m_cloud.bitmap()->rect(), 0.2f);
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
#include <AK/Random.h>
|
#include <AK/Random.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
|
#include <LibGUI/Frame.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/Widget.h>
|
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
#include <LibGfx/StandardCursor.h>
|
#include <LibGfx/StandardCursor.h>
|
||||||
|
|
||||||
namespace FlappyBug {
|
namespace FlappyBug {
|
||||||
|
|
||||||
class Game final : public GUI::Widget {
|
class Game final : public GUI::Frame {
|
||||||
C_OBJECT(Game);
|
C_OBJECT(Game);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue