Game Development Reference
In-Depth Information
and navigate to the assembly of the library. An entry called TextureBrowser will be
selected in the list. You should now be able to click OK and see the control appear
in your toolbox.
You can now drag the texture browser control from the toolbox onto your form.
Resize the control to your liking and then go to its properties. Aside from the normal
properties that are available for all Windows Forms controls, there is a new section
called Texture Browser Settings that are control-specific settings. These settings are
shown in Figure 26.3.
Figure 26.3 Properties for the texture browser control.
Change these settings to your liking, and then you can move onto the code for
adding textures to the control.
Loading Textures from a Directory
Early in the chapter, I mentioned that the loaders support three different sources for
image data. The most common source will be from files located in the file system,
and the following code shows how to iterate through a directory and load the image
files into the texture browser control. Be sure to reference the System.IO namespace.
DirectoryInfo directoryInfo = new DirectoryInfo(path);
if (directoryInfo.Exists)
{
FileInfo[] files = directoryInfo.GetFiles();
foreach (FileInfo file in files)
TextureBrowserInstance.AddTexture(new TextureHandle(file));
}
Search Nedrilad ::




Custom Search