com.triangularpixels.rebirth.resources
Class ResourceHandle<T extends Resource>

java.lang.Object
  extended by com.triangularpixels.rebirth.resources.ResourceHandle<T>
Type Parameters:
T - the Resource subtype of this handle.

public class ResourceHandle<T extends Resource>
extends Object

A handle to a specific Resource object. Game code should hold onto handles rather than references to resources directly, calling get() to retrieve the underlying resource object just before each use. Since the resource system may reparse and update resources on the fly, the object returned from get() should only be considered valid for the rest of the frame.

Author:
John Campbell

Nested Class Summary
static class ResourceHandle.State
           
 
Method Summary
 void forceCreate()
          Forces the resource into a fully created state by doing all remaining loading in the main thread.
 T get()
          Fetches the underlying resource object
 ResourceHandle.State getState()
          Returns the current state of this resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getState

public ResourceHandle.State getState()
Returns the current state of this resource


get

public T get()
Fetches the underlying resource object


forceCreate

public void forceCreate()
Forces the resource into a fully created state by doing all remaining loading in the main thread.



Copyright © 2009 TriangularPixels.com. All Rights Reserved.