-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplate.c++
42 lines (35 loc) · 924 Bytes
/
Template.c++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Diyou;
#include <webgpu/webgpu_cpp.h>
using namespace std;
using namespace wgpu;
constexpr char const *WindowTitle = "WebGPU Window";
constexpr unsigned WindowWidth = 720;
constexpr unsigned WindowHeight = 480;
struct Renderer
: Runtime<Renderer>
, public virtual Window
, public virtual Context
// Interfaces:
, public virtual IUtilities
{
Renderer(unique_ptr<Window> &window, unique_ptr<Context> &context)
: Window(::move(*window))
, Context(::move(*context))
{
// TODO Yourney begins here
}
void Close() override { Runtime::Close(); }
static void CreateFrom(
unique_ptr<Window> &window,
unique_ptr<Context> &context)
{
auto instance = make_unique<Renderer>(window, context);
Runtime::Add(instance);
}
};
void
Init(Application const &app)
{
auto window = make_unique<Window>(WindowTitle, WindowWidth, WindowHeight);
Context::Receive(window, Renderer::CreateFrom);
}