Events
These are the event types most mod authors care about first.
Client instance events
| Event | Best for | Example use |
|---|---|---|
ClientInstanceEvent | client access | keep a reference to the active client |
CancelableClientInstanceEvent | blocking an action | stop something before it continues |
ClientInstanceUpdateEvent | startup / init flow | run code after init finishes |
Example
cpp
CampAPI::ModuleScope scope;
scope.AddListener<ClientInstanceUpdateEvent>([](ClientInstanceUpdateEvent& event) {
if (event.mIsInitFinished) {
// start your feature here
}
});Input events
| Event | Best for | Example use |
|---|---|---|
InputEvent | input handling | mark input as consumed |
OnTouchEvent | touch input | react to taps and drags |
OnKeyEvent | keyboard input | react to a specific key |
Example
cpp
CampAPI::ModuleScope scope;
scope.AddListener<OnTouchEvent>([](OnTouchEvent& event) {
if (event.action == 0) {
event.Consume();
}
});Render events
| Event | Best for | Example use |
|---|---|---|
BeforeRenderScreenEvent | pre-render logic | cancel a screen render |
AfterRenderScreenEvent | post-render logic | draw or log after screen output |
GetSplashTextEvent | text replacement | change the startup splash text |
Example
cpp
CampAPI::ModuleScope scope;
scope.AddListener<GetSplashTextEvent>([](GetSplashTextEvent& event) {
event.setText(std::string("CampAPI is running"));
});Resource pack events
| Event | Best for | Example use |
|---|---|---|
RPMConstructor | resource-pack setup | inspect or prepare the manager |
Example
cpp
CampAPI::ModuleScope scope;
scope.AddListener<RPMConstructor>([](RPMConstructor& event) {
if (event.mNeedsToInitialize) {
// prepare your resource-related logic here
}
});