1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #pragma once |
4 | |
5 | #include "BsCorePrerequisites.h" |
6 | |
7 | namespace bs |
8 | { |
9 | /** @addtogroup Implementation |
10 | * @{ |
11 | */ |
12 | |
13 | /** Interface that allows the implementing class to be notified when the resources it is referencing change. */ |
14 | class BS_CORE_EXPORT IResourceListener |
15 | { |
16 | public: |
17 | IResourceListener(); |
18 | virtual ~IResourceListener(); |
19 | |
20 | protected: |
21 | friend class ResourceListenerManager; |
22 | |
23 | /** |
24 | * Retrieves all the resources that the class depends on. |
25 | * |
26 | * @note Derived implementations must add the resources to the provided @p resources array. |
27 | */ |
28 | virtual void getListenerResources(Vector<HResource>& resources) = 0; |
29 | |
30 | /** Marks the resource dependencies list as dirty and schedules it for rebuild. */ |
31 | virtual void markListenerResourcesDirty(); |
32 | |
33 | /** Called when a resource has been fully loaded. */ |
34 | virtual void notifyResourceLoaded(const HResource& resource) { } |
35 | |
36 | /** Called when the internal resource the resource handle is pointing to changes. */ |
37 | virtual void notifyResourceChanged(const HResource& resource) { } |
38 | }; |
39 | |
40 | /** @} */ |
41 | } |