1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5// Contains forward declares used as a convenience
6
7namespace bs
8{
9// Script binding defines
10
11/**
12 * @page scriptBindingMacro Script binding exports
13 *
14 * Marks the specific type or a method to be exported to the scripting API. Supports a variety of options which can
15 * be specified in the "option:value" format, where multiple options are separated by commas, with no whitespace.
16 *
17 * Supported options:
18 * - n - Specify a different name for the type in the scripting API (e.g. "n:MyName"). Usable on types and methods.
19 * - v - Specify a different visibility (default is public). Supported values are "public", "internal" and "private".
20 * Usable on types and methods.
21 * - f - Specify the name of the output file(s) for the script object and its potential wrappers. If not specified
22 * the name of the type will be used for the file. Usable on types only.
23 * - pl - Specify whether the type is plain or not (default is false). Supported values are "true" or "false". Plain
24 * types don't have script interop objects generated, instead they are generated in script code as plain data
25 * types. No methods are exposed, but all data members and constructors are copied. Usable on types only.
26 * - e - Specify that a method is external and is to be appended to some script class. Such methods must be static
27 * and as the first parameter accept the instance of the class they operate on. Value of this option should be
28 * the name of the class to attach this method to. Methods with this parameter must also be part of a class
29 * with this option. Usable on types and methods.
30 * - ec - Similar to "e", but specifies an external constructor. Such method must have a return value that returns
31 * an instance of the class its registered for. Value of this option should be the name of the class to attach
32 * this method to. Methods with this parameter must also be part of a class with the "e" option. Usable on methods
33 * only.
34 * - pr - Specify the method should be exported as a property in script code. Supported values are "getter" or "setter".
35 * Getter methods must return a single value and accept no parameters, while setter methods must accept one
36 * parameter and return no values. Usable on methods only.
37 * - ed - Specify that a type should be exported for use in the editor only. Supported values are "true" or "false".
38 * Usable on types only.
39 * - ex - Excludes an enum or struct member from being generated in script code. Supported values are "true" or "false".
40 * By default all struct & enum members are exported.
41 * - in - When enabled ensures only the interop C# method is generated, but not a public one. It is instead expected
42 * the user will manually implement the public method. Supported values are "true" or "false". Default is "false".
43 * Only supported on methods.
44 * - m - Specifies the name of the module to place the entry in. This determines the documentation group, and may also
45 * determine namespace and/or module (e.g. m:Animation to place it in the Animation module). Usable on types.
46 */
47
48#if BS_COMPILER == BS_COMPILER_CLANG
49 /** @ref scriptBindingMacro */
50 #define BS_SCRIPT_EXPORT(...) __attribute__((annotate("se," #__VA_ARGS__)))
51
52 /**
53 * When applied to a parameter, makes it a variable argument parameter in the scripting interface (if supported
54 * by the scripting language.
55 */
56 #define BS_PARAMS __attribute__((annotate("params")))
57
58 /**
59 * When applied to a parameter or a field of ResourceHandle type, makes that element be exported as a raw resource in
60 * script code.
61 */
62 #define BS_NORREF __attribute__((annotate("norref")))
63#else
64 /** @ref scriptBindingMacro */
65 #define BS_SCRIPT_EXPORT(...)
66
67 /**
68 * When applied to a parameter, makes it a variable argument parameter in the scripting interface (if supported
69 * by the scripting language).
70 */
71 #define BS_PARAMS
72
73 /**
74 * When applied to a parameter or a field of ResourceHandle type, makes that element be exported as a raw resource in
75 * script code.
76 */
77 #define BS_NORREF
78#endif
79
80 /** @addtogroup Math
81 * @{
82 */
83
84 /** Values that represent in which order are euler angles applied when used in transformations. */
85 enum class BS_SCRIPT_EXPORT() EulerAngleOrder
86 {
87 XYZ,
88 XZY,
89 YXZ,
90 YZX,
91 ZXY,
92 ZYX
93 };
94
95 /** Enum used for object construction specifying the object should be zero initialized. */
96 enum BS_ZERO { BsZero };
97
98 /** Enum used for matrix/quaternion constructor specifying it should be initialized with an identity value. */
99 enum BS_IDENTITY { BsIdentity };
100
101 /** @} */
102
103 /** @addtogroup Platform-Utility
104 * @{
105 */
106
107 /** Enum that defines possible window border styles. */
108 enum class WindowBorder
109 {
110 Normal,
111 None,
112 Fixed
113 };
114
115 /** @} */
116
117 class Angle;
118 class AABox;
119 class Degree;
120 class Math;
121 class Matrix3;
122 class Matrix4;
123 class Plane;
124 class Quaternion;
125 class Radian;
126 class Ray;
127 class Capsule;
128 class Sphere;
129 class Vector2;
130 class Vector3;
131 class Vector4;
132 struct Vector2I;
133 class Rect2I;
134 class Rect2;
135 class Rect3;
136 class Color;
137 class DynLib;
138 class DynLibManager;
139 class DataStream;
140 class MemoryDataStream;
141 class FileDataStream;
142 class MeshData;
143 class FileSystem;
144 class Timer;
145 class Task;
146 class GpuResourceData;
147 class PixelData;
148 class HString;
149 class StringTable;
150 struct LocalizedStringData;
151 class Path;
152 class HThread;
153 class TestSuite;
154 class TestOutput;
155 class AsyncOpSyncData;
156 struct RTTIField;
157 struct RTTIReflectablePtrFieldBase;
158 struct SerializedObject;
159 struct SerializedInstance;
160 class FrameAlloc;
161 class LogEntry;
162 // Reflection
163 class IReflectable;
164 class RTTITypeBase;
165 // Serialization
166 class ISerializable;
167 class SerializableType;
168
169 enum TypeID_Utility
170 {
171 TID_Abstract = 50, // Special type ID used for Abstract classes. Only type ID that may be used by more than one class.
172 TID_WString = 51,
173 TID_Path = 52,
174 TID_Vector = 53,
175 TID_Map = 54,
176 TID_UnorderedMap = 55,
177 TID_Pair = 56,
178 TID_Set = 57,
179 TID_StringID = 58,
180 TID_SerializedInstance = 59,
181 TID_SerializedField = 60,
182 TID_SerializedObject = 61,
183 TID_SerializedArray = 62,
184 TID_SerializedEntry = 63,
185 TID_SerializedArrayEntry = 64,
186 TID_SerializedSubObject = 65,
187 TID_UnorderedSet = 66,
188 TID_SerializedDataBlock = 67,
189 TID_Flags = 68,
190 TID_IReflectable = 69,
191 TID_DataBlob = 70,
192 TID_ColorGradient = 71,
193 TID_SerializationContext = 72,
194 TID_List = 73,
195 TID_SmallVector = 74
196 };
197}
198