diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-12-01 22:35:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-01 22:35:45 +0100 |
commit | e64a663c59141f972345852f0bce613e3f13dd3a (patch) | |
tree | af7b393e1665cba18d373eb67b257f005fbb197b /servers | |
parent | d2858e23713314f286875c45b6bd176daf860171 (diff) | |
parent | 2ef8c5fac5db208e8b2220f67c666cb0934c9020 (diff) |
Merge pull request #33992 from bruvzg/ios_modular_build
iOS modular build and export implementation.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/camera_server.cpp | 2 | ||||
-rw-r--r-- | servers/camera_server.h | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp index 0f93221072..6912a37fc5 100644 --- a/servers/camera_server.cpp +++ b/servers/camera_server.cpp @@ -35,6 +35,8 @@ //////////////////////////////////////////////////////// // CameraServer +CameraServer::CreateFunc CameraServer::create_func = NULL; + void CameraServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_feed", "index"), &CameraServer::get_feed); ClassDB::bind_method(D_METHOD("get_feed_count"), &CameraServer::get_feed_count); diff --git a/servers/camera_server.h b/servers/camera_server.h index c76d046e58..aa10f4dbb9 100644 --- a/servers/camera_server.h +++ b/servers/camera_server.h @@ -59,17 +59,36 @@ public: FEED_IMAGES = 2 }; + typedef CameraServer *(*CreateFunc)(); + private: protected: + static CreateFunc create_func; + Vector<Ref<CameraFeed> > feeds; static CameraServer *singleton; static void _bind_methods(); + template <class T> + static CameraServer *_create_builtin() { + return memnew(T); + } + public: static CameraServer *get_singleton(); + template <class T> + static void make_default() { + create_func = _create_builtin<T>; + } + + static CameraServer *create() { + CameraServer *server = create_func ? create_func() : memnew(CameraServer); + return server; + }; + // Right now we identify our feed by it's ID when it's used in the background. // May see if we can change this to purely relying on CameraFeed objects or by name. int get_free_id(); |