From 1f82ffa4d3ee8355215d43bf43edf8cecaca0d1d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 16 Oct 2024 17:21:04 +0200 Subject: fix user script implementation --- src/crepe/api/Script.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/crepe/api/Script.h (limited to 'src/crepe/api/Script.h') diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h new file mode 100644 index 0000000..b1e6a95 --- /dev/null +++ b/src/crepe/api/Script.h @@ -0,0 +1,21 @@ +#pragma once + +namespace crepe { +class ScriptSystem; +} + +namespace crepe::api { + +class Script { + friend class crepe::ScriptSystem; +protected: + virtual void init() {} + virtual void update() {} + // NOTE: additional *events* (like unity's OnDisable and OnEnable) should be + // implemented as member methods in derivative user script classes and + // registered in init(), otherwise this class will balloon in size with each + // added event. +}; + +} + -- cgit v1.2.3