32 lines
1.1 KiB
Markdown
32 lines
1.1 KiB
Markdown
|
This library implements the macros required to define Aurora style interfaces. Defines two classes. Implementable by SWIG, CppSharp, and classical OOP override event interface; and implementable by std::function for modern C++ and runtime language bindings respectively. The former is simply defined as a structure containing virtual methods as laid out by AUI_METHODS. Latterly, the interface is extended and mplemented by an array virtual override method defintions.
|
||
|
Example usage:
|
||
|
|
||
|
In your common header:
|
||
|
```
|
||
|
#if defined(MY_LIB_GEN_BINDINGS)
|
||
|
#define LIB_INTERFACE(name, list) AUI_INTERFACE_IMPL(name, list)
|
||
|
#define
|
||
|
#define LIB_INTERFACE(name, list) AUI_INTERFACE_FWD(name, list)
|
||
|
#endif
|
||
|
```
|
||
|
|
||
|
In your public API:
|
||
|
```
|
||
|
LIB_INTERFACE(IInputMouseSubscriber,
|
||
|
AUI_METHODS
|
||
|
(
|
||
|
AUI_METHOD(void, onButtonPress, (AuUInt8, mb)),
|
||
|
AUI_METHOD(void, onButtonTick, (AuUInt8, mb)),
|
||
|
AUI_METHOD(void, onButtonUp, (AuUInt8, mb))
|
||
|
)
|
||
|
);
|
||
|
```
|
||
|
|
||
|
In a dedicated translation unit:
|
||
|
```
|
||
|
#define MY_LIB_GEN_BINDINGS
|
||
|
#include <...>
|
||
|
```
|
||
|
|
||
|
|
||
|
Not recommended for small projects and/or people with a shred of sanity left
|