1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

CatDog: Help the user debug their programs

This adds helpful speech bubbles to CatDog. CatDog just wants to
help, that's all.
This commit is contained in:
Gunnar Beutner 2021-05-09 12:13:51 +02:00 committed by Andreas Kling
parent da5923bc54
commit e0fe38ea25
6 changed files with 132 additions and 0 deletions

View file

@ -18,16 +18,32 @@ public:
virtual void timer_event(Core::TimerEvent&) override;
virtual void paint_event(GUI::PaintEvent& event) override;
virtual void mousemove_event(GUI::MouseEvent& event) override;
virtual void mousedown_event(GUI::MouseEvent& event) override;
void track_cursor_globally();
void start_the_timer() { m_timer.start(); }
Function<void()> on_click;
bool roaming() const { return m_roaming; }
void set_roaming(bool roaming)
{
m_roaming = roaming;
if (!roaming) {
m_sleeping = false;
m_curr_frame = 0;
m_curr_bmp = m_alert;
update();
}
}
private:
Gfx::IntPoint m_temp_pos;
Core::ElapsedTimer m_timer;
int m_curr_frame = 1;
int m_moveX, m_moveY = 0;
bool m_up, m_down, m_left, m_right, m_sleeping = false;
bool m_roaming { true };
AK::NonnullRefPtr<Gfx::Bitmap> m_alert = *Gfx::Bitmap::load_from_file("/res/icons/catdog/alert.png");
AK::NonnullRefPtr<Gfx::Bitmap> m_erun1 = *Gfx::Bitmap::load_from_file("/res/icons/catdog/erun1.png");