コード例 #1
0
bool CCTextureManager::setTextureIndex(const int handleIndex)
{
    CCTextureHandle *handle = textureHandles.list[handleIndex];
    if( handle != NULL && handle->loadable )
    {
        if( handle->texture == NULL )
        {
            if( totalTexturesLoadedThisFrame >= textureLoadLimit || loadTexture( *handle ) == false )
            {
                setTextureIndex( 0 );
                return false;
            }
            totalTexturesLoadedThisFrame++;
            textureLoadingTimeout = textureLoadTimeOut;

            LAMBDA_EMIT_ONCE( handle->onLoad );
        }

        handle->lastTimeUsed = gEngine->time.lifetime;
        bindTexture( handle->texture->glName );
        return true;
	}
	else
	{
		setTextureIndex( 0 );
		return false;
	}	
}
コード例 #2
0
ファイル: CCTextureManager.cpp プロジェクト: kariem2k/playir
void CCTextureManager::invalidateAllTextureHandles()
{
    currentGLTexture = NULL;
    totalTexturesLoaded = 0;
    totalUsedTextureSpace = 0;

    for( int i=0; i<textureHandles.length; ++i )
    {
        CCTextureHandle *handle = textureHandles.list[i];
        if( handle->texture != NULL )
        {
            totalUsedTextureSpace -= handle->texture->getBytes();
            delete handle->texture;
            handle->texture = NULL;
        }
    }

    // Load in a 1x1 white texture to use for untextured draws
    assignTextureIndex( "transparent.png", Resource_Packaged, false, true, true );
    assignTextureIndex( "white.png", Resource_Packaged, false, true, true );

    setTextureIndex( 0 );

    CCSetTexCoords( NULL );
	CCDefaultTexCoords();
}
コード例 #3
0
const bool CCTextureManager::setTextureIndex(const int handleIndex)
{
    CCTextureHandle *handle = textureHandles.list[handleIndex];
    if( handle != NULL && handle->loadable )
    {
        if( handle->texture == NULL )
        {
            if( totalTexturesLoadedThisFrame >= textureLoadLimit || loadTexture( *handle ) == false )
            {
                setTextureIndex( 0 );
                return false;
            }
            totalTexturesLoadedThisFrame++;
            textureLoadingTimeout = textureLoadTimeOut;

            //LAMBDA_EMIT_ONCE( handle->onLoad )
            if( handle->onLoad.length > 0 )
            {
                for( int i=0; i<handle->onLoad.length; ++i )
                {
                    handle->onLoad.list[i]->run();
                }
                handle->onLoad.deleteObjectsAndList();
            }
        }

        handle->lastTimeUsed = gEngine->gameTime.lifetime;
        bindTexture( handle->texture->glName );
        return true;
	}
	else
	{
		setTextureIndex( 0 );
		return false;
	}	
}
コード例 #4
0
ファイル: CCTextureManager.cpp プロジェクト: Shushman/multi
void CCTextureManager::invalidateAllTextureHandles()
{
    for( int i=0; i<textureHandles.length; ++i )
    {
        CCTextureHandle *handle = textureHandles.list[i];
        if( handle->texture != NULL )
        {
            totalUsedTextureSpace -= handle->texture->getBytes();
            delete handle->texture;
            handle->texture = NULL;
        }
    }

    setTextureIndex( 0 );

    CCSetTexCoords( NULL );
	CCDefaultTexCoords();
}
コード例 #5
0
void CCTextureManager::load()
{
    // Load in a 1x1 white texture to use for untextured draws
    assignTextureIndex( "Resources/Textures/white.png", Resource_Packaged, false, true, true );
    setTextureIndex( 0 );
}