mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
CatDog: Enhance the speech bubble artificial intelligence
Enable cat dog to greet you, and help you with yak shave sessions.
This commit is contained in:
parent
c3a60a5dcd
commit
06ea31d0d5
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/06ea31d0d5c Pull-request: https://github.com/SerenityOS/serenity/pull/7872 Reviewed-by: https://github.com/gunnarbeutner ✅ Reviewed-by: https://github.com/linusg
1 changed files with 11 additions and 1 deletions
|
@ -5,9 +5,18 @@
|
|||
*/
|
||||
|
||||
#include "SpeechBubble.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Random.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
static Array<StringView, 3> messages = {
|
||||
"It looks like you're trying to debug\na program. Would you like some help?"sv,
|
||||
"It looks like you're trying to shave\na yak. Would you like some help?"sv,
|
||||
"Well Hello Friend!"sv,
|
||||
};
|
||||
|
||||
void SpeechBubble::paint_event(GUI::PaintEvent&)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
|
@ -28,7 +37,8 @@ void SpeechBubble::paint_event(GUI::PaintEvent&)
|
|||
painter.draw_line(connector_top_left, Gfx::IntPoint { connector_bottom.x() - 1, connector_bottom.y() }, palette().active_window_border1());
|
||||
painter.draw_line(connector_top_right, connector_bottom, palette().active_window_border1());
|
||||
|
||||
painter.draw_text(text_area, "It looks like you're trying to debug\na program. Would you like some help?", Gfx::TextAlignment::Center);
|
||||
auto message = messages[get_random<u8>() % messages.size()];
|
||||
painter.draw_text(text_area, message, Gfx::TextAlignment::Center);
|
||||
}
|
||||
|
||||
void SpeechBubble::mousedown_event(GUI::MouseEvent& event)
|
||||
|
|
Loading…
Reference in a new issue