mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Demos: Create demo for VirGL gpu device
This is a simple demo for VirGL, that does the bare minimum required to create and render a spinning cube (with one color per face).
This commit is contained in:
parent
2939f65753
commit
fd5eaf6494
8 changed files with 957 additions and 0 deletions
41
Userland/Demos/VirGLDemo/Widget.h
Normal file
41
Userland/Demos/VirGLDemo/Widget.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Sahan Fernando <sahan.h.fernando@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
void update_frame(RefPtr<Gfx::Bitmap>, unsigned num_cycles);
|
||||
|
||||
constexpr size_t DRAWTARGET_WIDTH = 500;
|
||||
constexpr size_t DRAWTARGET_HEIGHT = 500;
|
||||
|
||||
class Demo final : public GUI::Widget {
|
||||
C_OBJECT(Demo)
|
||||
public:
|
||||
virtual ~Demo() override;
|
||||
bool show_window_frame() const { return m_show_window_frame; }
|
||||
|
||||
Function<void(GUI::ContextMenuEvent&)> on_context_menu_request;
|
||||
|
||||
protected:
|
||||
virtual void context_menu_event(GUI::ContextMenuEvent& event) override
|
||||
{
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(event);
|
||||
}
|
||||
|
||||
private:
|
||||
Demo();
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
virtual void timer_event(Core::TimerEvent&) override;
|
||||
|
||||
int m_cycles;
|
||||
bool m_show_window_frame { true };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue