Vuo 2.4.4
Loading...
Searching...
No Matches
VuoScreen.h
Go to the documentation of this file.
1
10#ifndef VuoScreen_h
11#define VuoScreen_h
12
21#include "VuoBoolean.h"
22#include "VuoInteger.h"
23#include "VuoPoint2d.h"
24#include "VuoText.h"
25
26#ifdef __cplusplus
27extern "C"
28{
29#endif
30
34typedef enum
35{
36 VuoScreenType_Active,
37 VuoScreenType_Primary,
38 VuoScreenType_Secondary,
39 VuoScreenType_MatchId,
40 VuoScreenType_MatchName
42
46typedef struct
47{
48 VuoScreenType type;
52
54
55 VuoPoint2d topLeft; // In points (not pixels).
56
57 VuoInteger width; // In points (not pixels).
58 VuoInteger height;
59
60 VuoInteger dpiHorizontal; // Pixels per inch horizontally — e.g., 72 for typical displays, 144 for retina
61 VuoInteger dpiVertical;
62
63 VuoBoolean isMirrored; // True if this screen shows the same content as another screen.
64} VuoScreen;
65
66#define VuoScreen_SUPPORTS_COMPARISON
67
68VuoScreen VuoScreen_makeFromJson(struct json_object * js);
69struct json_object * VuoScreen_getJson(const VuoScreen value);
70char *VuoScreen_getSummary(const VuoScreen value);
71
72bool VuoScreen_areEqual(VuoScreen value1, VuoScreen value2);
73bool VuoScreen_isLessThan(const VuoScreen a, const VuoScreen b);
74
75bool VuoScreen_realize(VuoScreen screen, VuoScreen *realizedScreen);
76
81char * VuoScreen_getString(const VuoScreen value);
85
89static inline VuoScreen VuoScreen_makeFromName(VuoText name) __attribute__((const));
91{
92 VuoScreen s = {VuoScreenType_MatchName, -1, -1, name, false, {0, 0}, 0, 0, 0, 0, false};
93 return s;
94}
95
99static inline const char * VuoScreen_cStringForType(VuoScreenType type)
100{
101 switch (type)
102 {
103 case VuoScreenType_Active:
104 return "active";
105 case VuoScreenType_Primary:
106 return "primary";
107 case VuoScreenType_Secondary:
108 return "secondary";
109 case VuoScreenType_MatchId:
110 return "match-id";
111 case VuoScreenType_MatchName:
112 return "match-name";
113 // -Wunreachable-code doesn't like it if we cover all possible enum values *and* specify a default.
114 //default:
115 // return "primary";
116 }
117}
118
122static inline VuoScreenType VuoScreen_typeFromCString(const char *typeString)
123{
124 if (strcmp(typeString,"active")==0)
125 return VuoScreenType_Active;
126 else if (strcmp(typeString,"primary")==0)
127 return VuoScreenType_Primary;
128 else if (strcmp(typeString,"secondary")==0)
129 return VuoScreenType_Secondary;
130 else if (strcmp(typeString,"match-id")==0)
131 return VuoScreenType_MatchId;
132 else if (strcmp(typeString,"match-name")==0)
133 return VuoScreenType_MatchName;
134
135 return VuoScreenType_Active;
136}
137
138#ifdef __cplusplus
139}
140#endif
141
146#endif