|
1 | 1 | /* |
2 | 2 | example_basic_1.c |
3 | 3 | - demonstrates loading APIs |
| 4 | + - demonstrates loading extensions |
4 | 5 | - demonstrates creating a window |
5 | 6 | - demonstrates hot reloading |
6 | 7 | - demonstrates keyboard input |
@@ -48,6 +49,9 @@ Index of this file: |
48 | 49 | #include <string.h> // memset |
49 | 50 | #include "pl.h" |
50 | 51 |
|
| 52 | +// extensions |
| 53 | +#include "pl_platform_ext.h" // plWindowI |
| 54 | + |
51 | 55 | //----------------------------------------------------------------------------- |
52 | 56 | // [SECTION] structs |
53 | 57 | //----------------------------------------------------------------------------- |
@@ -75,6 +79,17 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData) |
75 | 79 | // it will be the value returned from this function's first |
76 | 80 | // call |
77 | 81 |
|
| 82 | + // retrieve extension registry |
| 83 | + const plExtensionRegistryI* ptExtensionRegistry = pl_get_api_latest(ptApiRegistry, plExtensionRegistryI); |
| 84 | + |
| 85 | + // load extensions |
| 86 | + // * first argument is the shared library name WITHOUT the file extension |
| 87 | + // * second & third argument is the load/unload functions names (use NULL for the default of "pl_load_ext" & |
| 88 | + // "pl_unload_ext") |
| 89 | + // * fourth argument indicates if the extension is reloadable (should the runtime check for changes and reload if changed) |
| 90 | + ptExtensionRegistry->load("pl_platform_ext", "pl_load_platform_ext", "pl_unload_platform_ext", false); // provides the file API used by the drawing ext |
| 91 | + |
| 92 | + |
78 | 93 | // load required apis (stored as globals for convience) |
79 | 94 | gptIO = pl_get_api_latest(ptApiRegistry, plIOI); |
80 | 95 | gptWindows = pl_get_api_latest(ptApiRegistry, plWindowI); |
|
0 commit comments