-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
87 lines (72 loc) · 1.65 KB
/
main.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <AppCore/App.h>
#include <AppCore/Window.h>
#include <AppCore/Overlay.h>
using namespace ultralight;
class MyApp : public WindowListener
{
RefPtr<App> app_;
RefPtr<Window> window_;
RefPtr<Overlay> overlay_;
public:
MyApp()
{
///
/// Create our main App instance.
///
app_ = App::Create();
///
/// Create our Window with the Resizable window flag.
///
window_ = Window::Create(app_->main_monitor(), 1280, 800, false,
kWindowFlags_Titled | kWindowFlags_Resizable);
///
/// Set our window title.
///
window_->SetTitle("Definitive Database Manager");
///
/// Bind our App's main window.
///
/// @note This MUST be done before creating any overlays or calling App::Run
///
app_->set_window(*window_.get());
///
/// Create our Overlay, use the same dimensions as our Window.
///
overlay_ = Overlay::Create(*window_.get(), window_->width(),
window_->height(), 0, 0);
///
/// Load a string of HTML into our overlay's View
///
overlay_->view()->LoadURL("file:///index.html");
///
/// Register our MyApp instance as a WindowListener so we can handle the
/// Window's OnResize event below.
///
window_->set_listener(this);
}
virtual ~MyApp() {}
///
/// Inherited from WindowListener, not used.
///
virtual void OnClose() override {}
///
/// Inherited from WindowListener, called when the Window is resized.
///
virtual void OnResize(uint32_t width, uint32_t height) override
{
///
/// Resize our Overlay to match the new Window dimensions.
///
overlay_->Resize(width, height);
}
void Run()
{
app_->Run();
}
};
int main()
{
MyApp app;
app.Run();
return 0;
}