mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +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)
|
||||
{
|
||||
GUI::Frame::paint_event(event);
|
||||
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(frame_inner_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);
|
||||
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
#include <AK/Random.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
|
||||
namespace FlappyBug {
|
||||
|
||||
class Game final : public GUI::Widget {
|
||||
class Game final : public GUI::Frame {
|
||||
C_OBJECT(Game);
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue