public class ResourceLoader extends Object
Add resources to load with add(Enum, Resource)
, and call start()
to begin loading in a separate
process.
Call await()
where resources must be loaded, and access to them with get()
.
Constructor and Description |
---|
ResourceLoader()
Create the resource loader.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Enum<?> key,
Resource resource)
Add a resource to load.
|
void |
await()
Wait for load to finish.
|
Map<Enum<?>,Resource> |
get()
Get the loaded resources.
|
boolean |
isFinished()
Check if loading is finished.
|
void |
start()
Start to load resources in a separate thread.
|
public void add(Enum<?> key, Resource resource)
start()
.key
- The associated key.resource
- The resource to load.LionEngineException
- If loader has already been started.public void start()
LionEngineException
- If loader has already been started.public void await()
start()
where performed somewhere before.LionEngineException
- If loading skipped or loader has not been started.public Map<Enum<?>,Resource> get()
await()
. Else ensure all resources has been loaded.LionEngineException
- If resources are not fully loaded.public boolean isFinished()
true
if finished, false
else.Copyright © 2017 Byron 3D Games Studio. All rights reserved.