Ninja Library - Texture Function

njLoadTextureReq

Loads texture (immediate return)

FORMAT

Sint32 njLoadTextureReq( *texlist )
NJS_TEXLIST *texlist

PARAMETER

 *texlist  Texture list 

RETURN

 NJD_TEX_STAT_READ  Loading 
 NJD_TEX_STAT_END  Closing 
 NJD_TEX_STAT_ERR  Error 

DESCRIPTION

Loads the texture.

When loading file from GD, the system returns immediately without waiting for the completion of the file loading from the GD. When file load is completed, the file is loaded to the texture memory. When this operation is repeated for the number of textures, and all the textures have been loaded, NJD_TEX_STAT_END is returned. The textures loaded to the texture memory are completion returned. As the njLoadTextureReq() function does not support split reading of texture, a buffer corresponding to the maximum access size of the file to be loaded is required.

For the buffer, use the area specified with the njlnitTextureBuffer() function. Buffer is not used in the case of memory texture. If the function needs to be cancelled, such as soft reset, execute njLoadTextureReqStop() function


EXAMPLE

Sint32 njUserMain(void)
{
        per = pdGetPeripheral(PDD_PORT_A0);
        
        switch(Mode){
        case START:
                GameInit();
                Mode = TEX_LOAD;
                break;
        case TEX_LOAD:
                /* Process of loading */
                DrawLoading();
                /* Load texture */
                if(njLoadTextureReq(&texlist) == NJD_TEX_STAT_END){
                        Mode = GAME_MAIN;
                }

                /* When soft reset */
                if(per&SOFT_RESET){
                        Mode = RESET;
                }       
                break;
        case RESET:
                /* Cancel immediate return function */
                njLoadTextureReqStop();
                /* Re-intialize GD */
                gdFsReinit();
                /* Release texture as loading by njLoadTextureReq() function did not complete */
                njReleaseTexture(&texlist);
                Mode = START;
                break;
        case GAME_MAIN:
                        :
                        :
                break;
        }
}

REFERENCE

njLoadTexture()
njLoadTextureReqStop()

njLoadTextureReq
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999