mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 02:44:58 +00:00
Demos: Rename GradientScreensaver to Gradient
This brings the name in-line with the naming convention used by the other screensavers 'Starfield' and 'Tubes'.
This commit is contained in:
parent
97dc2d1dd5
commit
c6af248909
6 changed files with 30 additions and 30 deletions
5
Base/res/apps/Gradient.af
Normal file
5
Base/res/apps/Gradient.af
Normal file
|
@ -0,0 +1,5 @@
|
|||
[App]
|
||||
Name=Gradient
|
||||
Executable=/bin/Gradient
|
||||
Category=Demos/Screensaver
|
||||
ExcludeFromSystemMenu=true
|
|
@ -1,5 +0,0 @@
|
|||
[App]
|
||||
Name=Gradient Screensaver
|
||||
Executable=/bin/GradientScreensaver
|
||||
Category=Demos/Screensaver
|
||||
ExcludeFromSystemMenu=true
|
|
@ -1,6 +1,6 @@
|
|||
add_subdirectory(CatDog)
|
||||
add_subdirectory(Eyes)
|
||||
add_subdirectory(GradientScreensaver)
|
||||
add_subdirectory(Gradient)
|
||||
add_subdirectory(LibGfxDemo)
|
||||
add_subdirectory(LibGfxScaleDemo)
|
||||
add_subdirectory(Mandelbrot)
|
||||
|
|
11
Userland/Demos/Gradient/CMakeLists.txt
Normal file
11
Userland/Demos/Gradient/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
serenity_component(
|
||||
Gradient
|
||||
TARGETS Gradient
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
Gradient.cpp
|
||||
)
|
||||
|
||||
serenity_app(Gradient ICON app-screensaver)
|
||||
target_link_libraries(Gradient PRIVATE LibDesktop LibGUI LibCore LibGfx LibMain)
|
|
@ -17,13 +17,13 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class Screensaver final : public Desktop::Screensaver {
|
||||
C_OBJECT(Screensaver)
|
||||
class Gradient final : public Desktop::Screensaver {
|
||||
C_OBJECT(Gradient)
|
||||
public:
|
||||
virtual ~Screensaver() override = default;
|
||||
virtual ~Gradient() override = default;
|
||||
|
||||
private:
|
||||
Screensaver(int width = 64, int height = 48, int interval = 10000);
|
||||
Gradient(int width = 64, int height = 48, int interval = 10000);
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
|
||||
void draw();
|
||||
|
@ -31,7 +31,7 @@ private:
|
|||
virtual void timer_event(Core::TimerEvent&) override;
|
||||
};
|
||||
|
||||
Screensaver::Screensaver(int width, int height, int interval)
|
||||
Gradient::Gradient(int width, int height, int interval)
|
||||
{
|
||||
on_screensaver_exit = []() { GUI::Application::the()->quit(); };
|
||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { width, height }).release_value_but_fixme_should_propagate_errors();
|
||||
|
@ -41,20 +41,20 @@ Screensaver::Screensaver(int width, int height, int interval)
|
|||
draw();
|
||||
}
|
||||
|
||||
void Screensaver::paint_event(GUI::PaintEvent& event)
|
||||
void Gradient::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
|
||||
}
|
||||
|
||||
void Screensaver::timer_event(Core::TimerEvent&)
|
||||
void Gradient::timer_event(Core::TimerEvent&)
|
||||
{
|
||||
draw();
|
||||
update();
|
||||
}
|
||||
|
||||
void Screensaver::draw()
|
||||
void Gradient::draw()
|
||||
{
|
||||
const Color colors[] {
|
||||
Color::Blue,
|
||||
|
@ -95,12 +95,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto window = TRY(Desktop::Screensaver::create_window("Screensaver"sv, "app-screensaver"sv));
|
||||
auto window = TRY(Desktop::Screensaver::create_window("Gradient"sv, "app-screensaver"sv));
|
||||
|
||||
auto screensaver_window = TRY(window->set_main_widget<Screensaver>(64, 48, 10000));
|
||||
screensaver_window->set_fill_with_background_color(false);
|
||||
screensaver_window->set_override_cursor(Gfx::StandardCursor::Hidden);
|
||||
screensaver_window->update();
|
||||
auto gradient_widget = TRY(window->set_main_widget<Gradient>(64, 48, 10000));
|
||||
gradient_widget->set_fill_with_background_color(false);
|
||||
gradient_widget->set_override_cursor(Gfx::StandardCursor::Hidden);
|
||||
gradient_widget->update();
|
||||
|
||||
window->show();
|
||||
window->move_to_front();
|
|
@ -1,11 +0,0 @@
|
|||
serenity_component(
|
||||
GradientScreensaver
|
||||
TARGETS GradientScreensaver
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
GradientScreensaver.cpp
|
||||
)
|
||||
|
||||
serenity_app(GradientScreensaver ICON app-screensaver)
|
||||
target_link_libraries(GradientScreensaver PRIVATE LibDesktop LibGUI LibCore LibGfx LibMain)
|
Loading…
Add table
Add a link
Reference in a new issue