ksys/act: Implement BaseProcJobHandlerT

This commit is contained in:
Léo Lam 2021-08-05 00:44:30 +02:00
parent 6f7547e0db
commit af2207632e
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <prim/seadDelegate.h>
#include "KingSystem/ActorSystem/actBaseProcJob.h"
#include "KingSystem/Utils/Types.h"
@ -20,4 +21,17 @@ protected:
};
KSYS_CHECK_SIZE_NX150(BaseProcJobHandler, 0x30);
/// For binding actor member functions.
template <typename T>
class BaseProcJobHandlerT : public BaseProcJobHandler {
public:
BaseProcJobHandlerT(BaseProc* proc, void (T::*fn)())
: BaseProcJobHandler(proc), mDelegate(proc, fn) {}
void invoke() override { mDelegate.invoke(); }
private:
sead::Delegate<T> mDelegate;
};
} // namespace ksys::act