Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Resource.hpp
1/*
2Copyright (C) 2021,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_RESOURCE_H
17#define AEONGAMES_RESOURCE_H
18
19#include <string>
21
22namespace AeonGames
23{
26 DLL size_t GetNextConsecutiveId();
33 {
34 public:
36 virtual ~Resource() {}
40 virtual void LoadFromMemory ( const void* aBuffer, size_t aBufferSize ) = 0;
42 virtual void Unload () = 0;
45 DLL void LoadFromId ( uint32_t aId );
48 DLL void LoadFromFile ( const std::string& aFilename );
60 DLL size_t GetConsecutiveId() const;
61 private:
62 size_t mConsecutiveId{ GetNextConsecutiveId() };
63 };
64}
65
66#endif
Platform-specific macros, includes, and DLL export/import definitions.
Base class for loadable engine resources.
Definition Resource.hpp:33
DLL void LoadFromFile(const std::string &aFilename)
Load the resource from a file on disk.
Definition Resource.cpp:37
virtual ~Resource()
Virtual destructor.
Definition Resource.hpp:36
DLL void LoadFromId(uint32_t aId)
Load the resource identified by a numeric id.
Definition Resource.cpp:30
virtual void LoadFromMemory(const void *aBuffer, size_t aBufferSize)=0
Load the resource from a raw memory buffer.
virtual void Unload()=0
Release all data held by this resource.
DLL size_t GetConsecutiveId() const
Get the Consecutive Id for the resource object.
Definition Resource.cpp:42
<- This is here just for the literals
Definition AABB.hpp:31
DLL size_t GetNextConsecutiveId()
Returns the next available consecutive resource identifier.
Definition Resource.cpp:24