njLoadTexture | Japanese
    <-|INDEX|->
Loads a texture.

### FORMAT

      #include <Ninja.h>
      Sint32 njLoadTexture(texlist);
      NJS_TEXLIST *texlist

### PARAMETERS

*texlist
  pointer to the NJS_TEXLIST structure

### RETURN VALUE

Successful
  1
Failed
  -1

### FUNCTION

  Loads the texture set into the texlist structure into texture memory or cache memory.

## Notes on texture creation

### 1. Set texture name structure for textures.

  NJS_TEXNAME

      void       *filename
      Uint16          attr
      Uint32       texaddr

  *filename
  Filename when it is a PVR format texture file.
  The NJS_TEXINFO structure pointer when loaded from memory.

  globalIndex
  The texture global number defined withi the application.
  It will be treated as the same texture if the global index number is the same, even if the texture list is different.
  Valid value: 0 thru 0xFFFFFFFE. 0xFFFFFFFF is prohibited to use.

  attr
  Specifies the origin and the destination of loading textures, and performs OR for each tag.

[the origin of load]
  NJD_TEXATTR_TYPE_FILE
  Loads the PVR format files. Specifies filename with *filename.

  NJD_TEXATTR_TYPE_MEMORY
  Loads from memory. Sets NJS_TEXINFO structure pointer with *filename. Refer to followings for setting NJS_TEXINFO.
[the destination](loads into texture memory if not specified)

  NJD_TEXATTR_CACHE
  Loads into cache memory only.

  NJD_TEXATTR_BOTH
  Loads into both texture memory and cache memory.

[global index specification]
  NJD_TEXATTR_GLOBALINDEX
  This is used if global index within the file is not used.

  texaddr
  Specifies global index at initialization if NJD_TEXATTR_GLOBALINDEX is specified with attr.
  After loading textures, it holds the address of NJS_TEXMEMLIST.

### 2.If textures are loaded from memory, it is necessary to set NJS_TEXINFO structure.

  NJS_TEXINFO structure

      void*           texaddr;
      NJS_TEXSURFACE  texsurface;

  texaddr
  Stores address when cache texture is specified.

  texsurface
  Sets data after loading textures.

  NJS_TEXLIST structure

      NJS_TEXNAME     *textures;
      Uint32          nbTexture;

  textures
  Sets the pointer for NJS_TEXNAME structure that has textures infromation

  nbTexture
  number of textures

### EXAMPLE

      NJS_TEXNAME texname[2];

      NJS_TEXLIST texlist ={texname,2};

      /* Prepare to read in two textures */
      NJS_TEXMEMLIST texmemlist[2];

      njInitTexture(texmemlist,2);

      /* Set the two textures */
      njSetTextureName(&texname[0],"file1.pvr",0,NJD_TEXATTR_TYPE_FILE|
                    NJD_TEXATTR_GLOBALINDEX);
      njSetTextureName(&texname[1],"file2.pvr",1,NJD_TEXATTR_TYPE_FILE|
                    NJD_TEXATTR_GLOBALINDEX);

      /* load texture */
      njLoadTexture(&texlist);

      /* Set texlist as the current texture list */
      njSetTexture(&texlist);

      /* Set current texture to texlist #0 */
      njSetTextureNum(0);

### NOTES

- njInitTexture must be executed prior to executing this function.
- Refer to Texture Guide for more details.

### RELATED TOPICS

  njInitTexture
  njLoadTextureNum

njLoadTexture |
    <-|INDEX|->