-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.inl
86 lines (57 loc) · 2.17 KB
/
app.inl
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
#pragma once
#include <cassert>
#include <iostream>
#include "app.hpp"
//------------------------------------------------------------------------------
namespace app {
int main(int argc, char* argv[]);
//--------------------------------------------------------------------------
void window::fillscreen() { fullscreen(true); }
bool window::hidden() const { return !visible(); }
void window::hidden(bool hidden) { visible(!hidden); }
void window::hide() { hidden(true); }
void window::maximize() { maximized(true); }
void window::minimize() { minimized(true); }
void
window::restore() {
if (fullscreen()) return fullscreen(false);
if (maximized()) return maximized(false);
if (minimized()) return minimized(false);
if (hidden()) return hidden(false);
}
void window::show() { visible(true); }
//--------------------------------------------------------------------------
static window::delegate window__delegate__null {};
decltype(window::delegate::null)
window::delegate::null { &window__delegate__null };
} // namespace app
//------------------------------------------------------------------------------
std::ostream& operator <<(std::ostream& out, const app::point& p) {
return out<<"{x:"<<p.x<<",y:"<<p.y<<'}';
}
std::ostream& operator <<(std::ostream& out, const app::size& s) {
return out<<"{w:"<<s.w<<",h:"<<s.h<<'}';
}
std::ostream& operator <<(std::ostream& out, const app::rect& r) {
return out<<"{x:"<<r.x<<",y:"<<r.y<<",w:"<<r.w<<",h:"<<r.h<<'}';
}
std::ostream& operator <<(std::ostream& out, const app::display& d) {
return out
<<'{'
<<"boundary:"<<d.boundary<<','
<<"viewport:"<<d.viewport
<<'}';
}
//------------------------------------------------------------------------------
#include "internal/cxx/push.h"
#include "internal/cxx/cxx.h"
#if CXX_OS_IOS
#include "internal/ios/app.inl"
#elif CXX_OS_MACOS
#include "internal/macos/app.inl"
#elif CXX_OS_WINDOWS
#include "internal/windows/app.inl"
#else // CXX_OS_?
#error "unsupported platform"
#endif // CXX_OS_*
#include "internal/cxx/pop.h"