Game Development Reference
In-Depth Information
Direct3D uses this handle to create a device with which the textures can be loaded.
The following code defines the abstract loader class.
public abstract class AbstractLoader : IAbstractLoader
{
private System.IntPtr _contextHandle;
public System.IntPtr ContextHandle
{
get { return _contextHandle; }
set { _contextHandle = value; }
}
public virtual Bitmap Load(string fileName)
{
return null;
}
public virtual Bitmap Load(MemoryStream stream)
{
return null;
}
protected AbstractLoader(System.IntPtr contextHandle)
{
_contextHandle = contextHandle;
}
}
NOTE
You will need to reference System.IO for the MemoryStream object, as well as System.Drawing
for the Bitmap object.
Windows GDI+ Loader
This is by far the easiest loader to implement, since it only takes a single line of code
to load an image file. Windows GDI+ is available to all .NET applications without
the reliance on any external dependencies, so it is an excellent choice when stan-
dard image formats like JPEG, BMP and GIF will do the job.
 
Search Nedrilad ::




Custom Search