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

Snake: Implement image-based skins

Co-authored-by: HawDevelopment <hawdevelopment@gmail.com>
This commit is contained in:
Sam Atkins 2023-03-16 14:00:20 +00:00 committed by Andreas Kling
parent da7c883dfa
commit 5708a47157
20 changed files with 425 additions and 33 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2023, the SerenityOS developers.
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "../Geometry.h"
#include <AK/Error.h>
#include <LibGfx/Painter.h>
namespace Snake {
class SnakeSkin {
public:
static ErrorOr<NonnullOwnPtr<SnakeSkin>> create(StringView skin_name, Color color);
virtual ~SnakeSkin() = default;
virtual void draw_head(Gfx::Painter&, Gfx::IntRect const& rect, Direction facing_direction) = 0;
virtual void draw_body(Gfx::Painter&, Gfx::IntRect const& rect, Direction previous_direction, Direction next_direction) = 0;
virtual void draw_tail(Gfx::Painter&, Gfx::IntRect const& rect, Direction body_direction) = 0;
};
}