diff --git a/README.md b/README.md index b84e370..72fbfe8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This library implements the macros required to define Aurora style interfaces. D ## Example usage: #### In your common header: -``` +```c #if defined(MY_LIB_GEN_BINDINGS) #define LIB_INTERFACE(name, list) AUI_INTERFACE_IMPL(name, list) #define @@ -14,7 +14,7 @@ This library implements the macros required to define Aurora style interfaces. D ``` #### In your public API: -``` +```c LIB_INTERFACE(IInputMouseSubscriber, AUI_METHOD(void, onButtonPress, (AuUInt8, mb)), AUI_METHOD(void, onButtonTick, (AuUInt8, mb)), @@ -23,26 +23,19 @@ LIB_INTERFACE(IInputMouseSubscriber, ``` #### In a dedicated translation unit: -``` +```c++ #define MY_LIB_GEN_BINDINGS -#include <...> +#include +#include +#include <[MyPublicAPI].hpp> ``` -#### Usage Runtime Binding and Modern C++ +#### Usage: C++ inheritance (covers SWIG and CppSharp) ``` -// My language binding -IInputMouseSubscriberFunctional test; -test.onButtonPress = [](AuUInt8 btn) -{ +#include +#include +#include <[MyPublicAPI].hpp> -}; - -AuSPtr handle = AuUnsafeRaiiToShared(&test); -// use handle with an Aurora API -``` - -#### Usage C++ Native, SWIG, and CppSharp -``` struct MyEventHandler : public IInputMouseSubscriber { void onButtonPress(AuUInt8 mb) override; @@ -50,8 +43,24 @@ struct MyEventHandler : public IInputMouseSubscriber void onButtonUp(AuUInt8 mb) override; }; -auto handle = AuMakeShared(); +static AuSPtr MyMouseSubscriber() +{ + return AuMakeShared(); +} ``` +#### Usage: Runtime bindings and modern C++ +``` c++ +// My language binding +auto test = AuMakeShared(); +test->onButtonPress = [](AuUInt8 btn) +{ + +}; +``` + +## Dependencies +* [AuroraForEach](https://git.reece.sx/AuroraSupport/AuroraForEach) [header only] + ##### Not recommended for small projects and/or people with a shred of sanity left -##### Possibly useful for API developers \ No newline at end of file +##### Possibly useful for API developers \ No newline at end of file