@@ -133,8 +133,7 @@ Create the file ``init.h`` in the ``src`` folder, with the following contents:
133
133
134
134
.. code-block :: c
135
135
136
- #ifndef INIT_H
137
- #define INIT_H
136
+ #pragma once
138
137
139
138
#include "defs.h"
140
139
@@ -144,8 +143,6 @@ Create the file ``init.h`` in the ``src`` folder, with the following contents:
144
143
void deinitialize_gdexample_module(void *p_userdata, GDExtensionInitializationLevel p_level);
145
144
GDExtensionBool GDE_EXPORT gdexample_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);
146
145
147
- #endif // INIT_H
148
-
149
146
The functions declared here have the signatures expected by the GDExtension API.
150
147
151
148
Note the inclusion of the ``defs.h `` file. This is one of our helpers to
@@ -158,8 +155,7 @@ Create the ``defs.h`` file in the ``src`` folder with the following contents:
158
155
159
156
.. code-block :: c
160
157
161
- #ifndef DEFS_H
162
- #define DEFS_H
158
+ #pragma once
163
159
164
160
#include <stdbool.h>
165
161
#include <stddef.h>
@@ -175,8 +171,6 @@ Create the ``defs.h`` file in the ``src`` folder with the following contents:
175
171
#endif
176
172
#endif // ! GDE_EXPORT
177
173
178
- #endif // DEFS_H
179
-
180
174
We also include some standard headers to make things easier. Now we only have to
181
175
include ``defs.h `` and those will come as a bonus.
182
176
@@ -224,8 +218,7 @@ contents:
224
218
225
219
.. code-block :: c
226
220
227
- #ifndef GDEXAMPLE_H
228
- #define GDEXAMPLE_H
221
+ #pragma once
229
222
230
223
#include "gdextension_interface.h"
231
224
@@ -247,8 +240,6 @@ contents:
247
240
// Bindings.
248
241
void gdexample_class_bind_methods();
249
242
250
- #endif // GDEXAMPLE_H
251
-
252
243
Noteworthy here is the ``object `` field, which holds a pointer to
253
244
the Godot object, and the ``gdexample_class_bind_methods() `` function, which will
254
245
register the metadata of our custom class (properties, methods, and signals).
@@ -299,8 +290,7 @@ We'll start by creating an ``api.h`` file in the ``src`` folder:
299
290
300
291
.. code-block :: c
301
292
302
- #ifndef API_H
303
- #define API_H
293
+ #pragma once
304
294
305
295
/*
306
296
This file works as a collection of helpers to call the GDExtension API
@@ -333,10 +323,6 @@ We'll start by creating an ``api.h`` file in the ``src`` folder:
333
323
334
324
void load_api(GDExtensionInterfaceGetProcAddress p_get_proc_address);
335
325
336
-
337
-
338
- #endif // API_H
339
-
340
326
This file will include many other helpers as we fill our extension with
341
327
something useful. For now it only has a pointer to a function that creates a
342
328
StringName from a C string (in Latin-1 encoding) and another to destruct a
0 commit comments