• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GP_ERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GP_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ GP_ERROR函数的具体用法?C++ GP_ERROR怎么用?C++ GP_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GP_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GP_ERROR

Text* Text::create(Properties* properties)
{
    // Check if the Properties is valid and has a valid namespace.
    if (!properties || strcmp(properties->getNamespace(), "text") != 0)
    {
        GP_ERROR("Properties object must be non-null and have namespace equal to 'text'.");
        return NULL;
    }

    // Get font path.
    const char* fontPath = properties->getString("font");
    if (fontPath == NULL || strlen(fontPath) == 0)
    {
        GP_ERROR("Text is missing required font file path.");
        return NULL;
    }

    // Get text
    const char* text = properties->getString("text");
    if (text == NULL || strlen(text) == 0)
    {
        GP_ERROR("Text is missing required 'text' value.");
        return NULL;
    }

    // Get size
    int size = properties->getInt("size"); // Default return is 0 if a value doesn't exist
    if (size < 0)
    {
        GP_WARN("Text size must be a positive value, with zero being default font size. Using default font size.");
        size = 0;
    }

    // Get text color
    kmVec4 color = { 1.0f, 1.0f ,1.0f, 1.0f };
    if (properties->exists("color"))
    {
        switch (properties->getType("color"))
        {
        case Properties::VECTOR3:
            color.w = 1.0f;
            properties->getVector3("color", (kmVec3*)&color);
            break;
        case Properties::VECTOR4:
            properties->getVector4("color", &color);
            break;
        case Properties::STRING:
        default:
            properties->getColor("color", &color);
            break;
        }
    }

    // Create
    return Text::create(fontPath, text, color, size);
}
开发者ID:dtbinh,项目名称:Game3D,代码行数:56,代码来源:Text.cpp


示例2: GP_ASSERT

Effect* Effect::createFromFile(const char* vshPath, const char* fshPath, const char* defines)
{
    GP_ASSERT(vshPath);
    GP_ASSERT(fshPath);

    // Search the effect cache for an identical effect that is already loaded.
    std::string uniqueId = vshPath;
    uniqueId += ';';
    uniqueId += fshPath;
    uniqueId += ';';
    if (defines)
    {
        uniqueId += defines;
    }
    std::map<std::string, Effect*>::const_iterator itr = __effectCache.find(uniqueId);
    if (itr != __effectCache.end())
    {
        // Found an exiting effect with this id, so increase its ref count and return it.
        GP_ASSERT(itr->second);
        itr->second->addRef();
        return itr->second;
    }

    // Read source from file.
    char* vshSource = FileSystem::readAll(vshPath);
    if (vshSource == NULL)
    {
        GP_ERROR("Failed to read vertex shader from file '%s'.", vshPath);
        return NULL;
    }
    char* fshSource = FileSystem::readAll(fshPath);
    if (fshSource == NULL)
    {
        GP_ERROR("Failed to read fragment shader from file '%s'.", fshPath);
        SAFE_DELETE_ARRAY(vshSource);
        return NULL;
    }

    Effect* effect = createFromSource(vshPath, vshSource, fshPath, fshSource, defines);
    
    SAFE_DELETE_ARRAY(vshSource);
    SAFE_DELETE_ARRAY(fshSource);

    if (effect == NULL)
    {
        GP_ERROR("Failed to create effect from shaders '%s', '%s'.", vshPath, fshPath);
    }
    else
    {
        // Store this effect in the cache.
        effect->_id = uniqueId;
        __effectCache[uniqueId] = effect;
    }

    return effect;
}
开发者ID:BernardsRegards,项目名称:GamePlay,代码行数:56,代码来源:Effect.cpp


示例3: GP_ERROR

void Label::addListener(Control::Listener* listener, int eventFlags)
{
    if ((eventFlags & Control::Listener::TEXT_CHANGED) == Control::Listener::TEXT_CHANGED)
    {
        GP_ERROR("TEXT_CHANGED event is not applicable to this control.");
    }
    if ((eventFlags & Control::Listener::VALUE_CHANGED) == Control::Listener::VALUE_CHANGED)
    {
        GP_ERROR("VALUE_CHANGED event is not applicable to this control.");
    }

    Control::addListener(listener, eventFlags);
}
开发者ID:reven86,项目名称:GamePlay,代码行数:13,代码来源:Label.cpp


示例4: GP_ASSERT

void FileSystem::createFileFromAsset(const char* path)
{
#ifdef __ANDROID__
    static std::set<std::string> upToDateAssets;

    GP_ASSERT(path);
    std::string fullPath(__resourcePath);
    std::string resolvedPath = FileSystem::resolvePath(path);
    fullPath += resolvedPath;

    std::string directoryPath = fullPath.substr(0, fullPath.rfind('/'));
    struct stat s;
    if (stat(directoryPath.c_str(), &s) != 0)
        makepath(directoryPath, 0777);

    // To ensure that the files on the file system corresponding to the assets in the APK bundle
    // are always up to date (and in sync), we copy them from the APK to the file system once
    // for each time the process (game) runs.
    if (upToDateAssets.find(fullPath) == upToDateAssets.end())
    {
        AAsset* asset = AAssetManager_open(__assetManager, resolvedPath.c_str(), AASSET_MODE_RANDOM);
        if (asset)
        {
            const void* data = AAsset_getBuffer(asset);
            int length = AAsset_getLength(asset);
            FILE* file = fopen(fullPath.c_str(), "wb");
            if (file != NULL)
            {
                int ret = fwrite(data, sizeof(unsigned char), length, file);
                if (fclose(file) != 0)
                {
                    GP_ERROR("Failed to close file on file system created from APK asset '%s'.", path);
                    return;
                }
                if (ret != length)
                {
                    GP_ERROR("Failed to write all data from APK asset '%s' to file on file system.", path);
                    return;
                }
            }
            else
            {
                GP_ERROR("Failed to create file on file system from APK asset '%s'.", path);
                return;
            }

            upToDateAssets.insert(fullPath);
        }
    }
#endif
}
开发者ID:adh38,项目名称:T4TAppV3,代码行数:51,代码来源:FileSystem.cpp


示例5: GP_ASSERT

char* FileSystem::readAll(const char* filePath, int* fileSize)
{
    GP_ASSERT(filePath);

    // Open file for reading.
    FILE* file = openFile(filePath, "rb");
    if (file == NULL)
    {
        GP_ERROR("Failed to load file: %s", filePath);
        return NULL;
    }

    // Obtain file length.
    if (fseek(file, 0, SEEK_END) != 0)
    {
        GP_ERROR("Failed to seek to the end of the file '%s' to obtain the file length.", filePath);
        return NULL;
    }
    int size = (int)ftell(file);
    if (fseek(file, 0, SEEK_SET) != 0)
    {
        GP_ERROR("Failed to seek to beginning of the file '%s' to begin reading in the entire file.", filePath);
        return NULL;
    }

    // Read entire file contents.
    char* buffer = new char[size + 1];
    int read = (int)fread(buffer, 1, size, file);
    if (read != size)
    {
        GP_ERROR("Failed to read complete contents of file '%s' (amount read vs. file size: %d < %d).", filePath, (int)read, (int)size);
        SAFE_DELETE_ARRAY(buffer);
        return NULL;
    }

    // Force the character buffer to be NULL-terminated.
    buffer[size] = '\0';

    // Close file and return.
    if (fclose(file) != 0)
    {
        GP_ERROR("Failed to close file '%s'.", filePath);
    }

    if (fileSize)
    {
        *fileSize = size; 
    }
    return buffer;
}
开发者ID:brobits,项目名称:GamePlay,代码行数:50,代码来源:FileSystem.cpp


示例6: GP_ASSERT

AudioSource* AudioSource::clone(NodeCloneContext &context) const
{
    GP_ASSERT(_buffer);

    ALuint alSource = 0;
    AL_CHECK( alGenSources(1, &alSource) );
    if (AL_LAST_ERROR())
    {
        GP_ERROR("Error generating audio source.");
        return NULL;
    }
    AudioSource* audioClone = new AudioSource(_buffer, alSource);

    _buffer->addRef();
    audioClone->setLooped(isLooped());
    audioClone->setGain(getGain());
    audioClone->setPitch(getPitch());
    audioClone->setVelocity(getVelocity());
    if (Node* node = getNode())
    {
        Node* clonedNode = context.findClonedNode(node);
        if (clonedNode)
        {
            audioClone->setNode(clonedNode);
        }
    }
    return audioClone;
}
开发者ID:sharkpp,项目名称:openhsp,代码行数:28,代码来源:AudioSource.cpp


示例7: makepath

static void makepath(std::string path, int mode)
{
    std::vector<std::string> dirs;
    while (path.length() > 0)
    {
        int index = path.find('/');
        std::string dir = (index == -1 ) ? path : path.substr(0, index);
        if (dir.length() > 0)
            dirs.push_back(dir);
        
        if (index + 1 >= path.length() || index == -1)
            break;
            
        path = path.substr(index + 1);
    }
    
    struct stat s;
    std::string dirPath;
    for (unsigned int i = 0; i < dirs.size(); i++)
    {
        dirPath += "/";
        dirPath += dirs[i];
        if (stat(dirPath.c_str(), &s) != 0)
        {
            // Directory does not exist.
            if (mkdir(dirPath.c_str(), 0777) != 0)
            {
                GP_ERROR("Failed to create directory: '%s'", dirPath.c_str());
                return;
            }
        }
    }
    return;
}
开发者ID:adh38,项目名称:T4TAppV3,代码行数:34,代码来源:FileSystem.cpp


示例8: GP_ASSERT

void ParticleEmitter::setTextureBlending(TextureBlending textureBlending)
{
    GP_ASSERT(_spriteBatch);
    GP_ASSERT(_spriteBatch->getStateBlock());

    switch (textureBlending)
    {
        case BLEND_OPAQUE:
            _spriteBatch->getStateBlock()->setBlend(false);
            break;
        case BLEND_TRANSPARENT:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);
            break;
        case BLEND_ADDITIVE:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE);
            break;
        case BLEND_MULTIPLIED:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_ZERO);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_SRC_COLOR);
            break;
        default:
            GP_ERROR("Unsupported texture blending mode (%d).", textureBlending);
            break;
    }
}
开发者ID:AllenPestaluky,项目名称:GamePlay,代码行数:30,代码来源:ParticleEmitter.cpp


示例9: createTriangleMesh

/**
 * Creates a triangle mesh with vertex colors.
 */
static Mesh* createTriangleMesh()
{
    // Calculate the vertices of the equilateral triangle.
    float a = 0.5f;     // length of the side
    Vector2 p1(0.0f,       a / sqrtf(3.0f));
    Vector2 p2(-a / 2.0f, -a / (2.0f * sqrtf(3.0f)));
    Vector2 p3( a / 2.0f, -a / (2.0f * sqrtf(3.0f)));

    // Create 3 vertices. Each vertex has position (x, y, z) and color (red, green, blue)
    float vertices[] =
    {
        p1.x, p1.y, 0.0f,     1.0f, 0.0f, 0.0f,
        p2.x, p2.y, 0.0f,     0.0f, 1.0f, 0.0f,
        p3.x, p3.y, 0.0f,     0.0f, 0.0f, 1.0f,
    };
    unsigned int vertexCount = 3;
    VertexFormat::Element elements[] =
    {
        VertexFormat::Element(VertexFormat::POSITION, 3),
        VertexFormat::Element(VertexFormat::COLOR, 3)
    };
    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), vertexCount, false);
    if (mesh == NULL)
    {
        GP_ERROR("Failed to create mesh.");
        return NULL;
    }
    mesh->setPrimitiveType(Mesh::TRIANGLES);
    mesh->setVertexData(vertices, 0, vertexCount);
    return mesh;
}
开发者ID:1timmy,项目名称:GamePlay,代码行数:34,代码来源:TriangleSample.cpp


示例10: createLineStripMesh

static Mesh* createLineStripMesh()
{
    float a = 0.1f;
    float vertices[] = 
    {
        0,  0,  0,    1, 0, 0,
        a,  0, -a,    0, 1, 0,
        0, -a,  a,    0, 0, 1,
       -a,  0, -a,    1, 0, 1,
        0,  a,  a,    0, 1, 1,
    };

    unsigned int vertexCount = 5;
    VertexFormat::Element elements[] =
    {
        VertexFormat::Element(VertexFormat::POSITION, 3),
        VertexFormat::Element(VertexFormat::COLOR, 3)
    };
    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), vertexCount, false);
    if (mesh == NULL)
    {
        GP_ERROR("Failed to create mesh.");
        return NULL;
    }
    mesh->setPrimitiveType(Mesh::LINE_STRIP);
    mesh->setVertexData(vertices, 0, vertexCount);
    return mesh;
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:28,代码来源:MeshPrimitiveTest.cpp


示例11: GP_ASSERT

void ParticleEmitter::setBlendMode(BlendMode blendMode)
{
    GP_ASSERT(_spriteBatch);
    GP_ASSERT(_spriteBatch->getStateBlock());

    switch (blendMode)
    {
        case BLEND_NONE:
            _spriteBatch->getStateBlock()->setBlend(false);
            break;
        case BLEND_ALPHA:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);
            break;
        case BLEND_ADDITIVE:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE);
            break;
        case BLEND_MULTIPLIED:
            _spriteBatch->getStateBlock()->setBlend(true);
            _spriteBatch->getStateBlock()->setBlendSrc(RenderState::BLEND_ZERO);
            _spriteBatch->getStateBlock()->setBlendDst(RenderState::BLEND_SRC_COLOR);
            break;
        default:
            GP_ERROR("Unsupported blend mode (%d).", blendMode);
            break;
    }

    _spriteBlendMode = blendMode;
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:32,代码来源:ParticleEmitter.cpp


示例12: GP_ERROR

Mesh* Mesh::createQuadFullscreen()
{
    float x = -1.0f;
    float y = -1.0f;
    float x2 = 1.0f;
    float y2 = 1.0f;

    float vertices[] =
    {
        x, y2,   0, 1,
        x, y,    0, 0,
        x2, y2,  1, 1,
        x2, y,   1, 0
    };

    VertexFormat::Element elements[] =
    {
        VertexFormat::Element(VertexFormat::POSITION, 2),
        VertexFormat::Element(VertexFormat::TEXCOORD0, 2)
    };
    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), 4, false);
    if (mesh == NULL)
    {
        GP_ERROR("Failed to create mesh.");
        return NULL;
    }

    mesh->_primitiveType = TRIANGLE_STRIP;
    mesh->setVertexData(vertices, 0, 4);

    return mesh;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:32,代码来源:Mesh.cpp


示例13: GP_ASSERT

Mesh* Mesh::createLines(Vector3* points, unsigned int pointCount)
{
    GP_ASSERT(points);
    GP_ASSERT(pointCount);

    float* vertices = new float[pointCount*3];
    memcpy(vertices, points, pointCount*3*sizeof(float));

    VertexFormat::Element elements[] =
    {
        VertexFormat::Element(VertexFormat::POSITION, 3)
    };
    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 1), pointCount, false);
    if (mesh == NULL)
    {
        GP_ERROR("Failed to create mesh.");
        SAFE_DELETE_ARRAY(vertices);
        return NULL;
    }

    mesh->_primitiveType = LINE_STRIP;
    mesh->setVertexData(vertices, 0, pointCount);

    SAFE_DELETE_ARRAY(vertices);
    return mesh;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:26,代码来源:Mesh.cpp


示例14: createPointsMesh

static Mesh* createPointsMesh()
{
    float scale = 0.2f;
    unsigned int vertexCount = 100;

    std::vector<float> vertices;
    vertices.reserve(vertexCount * 6);
    for (unsigned int i = 0; i < vertexCount; ++i)
    {
        // x, y, z, r, g, b
        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
        vertices.push_back(MATH_RANDOM_0_1());
        vertices.push_back(MATH_RANDOM_0_1());
        vertices.push_back(MATH_RANDOM_0_1()); 
    }
    
    VertexFormat::Element elements[] =
    {
        VertexFormat::Element(VertexFormat::POSITION, 3),
        VertexFormat::Element(VertexFormat::COLOR, 3)
    };
    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), vertexCount, false);
    if (mesh == NULL)
    {
        GP_ERROR("Failed to create mesh.");
        return NULL;
    }
    mesh->setPrimitiveType(Mesh::POINTS);
    mesh->setVertexData(&vertices[0], 0, vertexCount);
    return mesh;
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:33,代码来源:MeshPrimitiveTest.cpp


示例15: GP_ASSERT

bool Material::loadTechnique(Material* material, Properties* techniqueProperties)
{
    GP_ASSERT(material);
    GP_ASSERT(techniqueProperties);

    // Create a new technique.
    Technique* technique = new Technique(techniqueProperties->getId(), material);

    // Go through all the properties and create passes under this technique.
    techniqueProperties->rewind();
    Properties* passProperties = NULL;
    while ((passProperties = techniqueProperties->getNextNamespace()))
    {
        if (strcmp(passProperties->getNamespace(), "pass") == 0)
        {
            // Create and load passes.
            if (!loadPass(technique, passProperties))
            {
                GP_ERROR("Failed to create pass for technique.");
                SAFE_RELEASE(technique);
                return false;
            }
        }
    }

    // Load uniform value parameters for this technique.
    loadRenderState(technique, techniqueProperties);

    // Add the new technique to the material.
    material->_techniques.push_back(technique);

    return true;
}
开发者ID:AllenPestaluky,项目名称:GamePlay,代码行数:33,代码来源:Material.cpp


示例16: GP_ASSERT

void Matrix::createPerspective(float fieldOfView, float aspectRatio,
                                     float zNearPlane, float zFarPlane, Matrix* dst)
{
    GP_ASSERT(dst);
    GP_ASSERT(zFarPlane != zNearPlane);

    float f_n = 1.0f / (zFarPlane - zNearPlane);
    float theta = MATH_DEG_TO_RAD(fieldOfView) * 0.5f;
    if (fabs(fmod(theta, MATH_PIOVER2)) < MATH_EPSILON)
    {
        GP_ERROR("Invalid field of view value (%d) causes attempted calculation tan(%d), which is undefined.", fieldOfView, theta);
        return;
    }
    float divisor = tan(theta);
    GP_ASSERT(divisor);
    float factor = 1.0f / divisor;

    memset(dst, 0, MATRIX_SIZE);

    GP_ASSERT(aspectRatio);
    dst->m[0] = (1.0f / aspectRatio) * factor;
    dst->m[5] = factor;
    dst->m[10] = (-(zFarPlane + zNearPlane)) * f_n;
    dst->m[11] = -1.0f;
    dst->m[14] = -2.0f * zFarPlane * zNearPlane * f_n;
}
开发者ID:ArtProgrammer,项目名称:game-play,代码行数:26,代码来源:Matrix.cpp


示例17: GL_ASSERT

void MeshPart::setIndexData(void* indexData, unsigned int indexStart, unsigned int indexCount)
{
    GL_ASSERT( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer) );

    unsigned int indexSize = 0;
    switch (_indexFormat)
    {
    case Mesh::INDEX8:
        indexSize = 1;
        break;
    case Mesh::INDEX16:
        indexSize = 2;
        break;
    case Mesh::INDEX32:
        indexSize = 4;
        break;
    default:
        GP_ERROR("Unsupported index format (%d).", _indexFormat);
        return;
    }

    if (indexStart == 0 && indexCount == 0)
    {
        GL_ASSERT( glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _indexCount, indexData, _dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW) );
    }
    else
    {
        if (indexCount == 0)
        {
            indexCount = _indexCount - indexStart;
        }

        GL_ASSERT( glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, indexStart * indexSize, indexCount * indexSize, indexData) );
    }
}
开发者ID:AllenPestaluky,项目名称:GamePlay,代码行数:35,代码来源:MeshPart.cpp


示例18: parseFlipFlags

static bool parseFlipFlags(const char* str, Sprite::FlipFlags* flip)
{
    GP_ASSERT(flip);

    if (!str)
    {
        *flip = Sprite::FLIP_NONE;
        return false;
    }

    if (strcmp(str, "FLIP_VERTICAL") == 0)
    {
        *flip = Sprite::FLIP_VERTICAL;
    }
    else if (strcmp(str, "FLIP_HORIZONTAL") == 0)
    {
        *flip = Sprite::FLIP_HORIZONTAL;
    }
    else if (strcmp(str, "FLIP_VERTICAL_HORIZONTAL") == 0)
    {
        *flip = (Sprite::FlipFlags)(Sprite::FLIP_VERTICAL | Sprite::FLIP_HORIZONTAL);
    }
    else if (strcmp(str, "FLIP_NONE") != 0)
    {
        GP_ERROR("Failed to get corresponding sprite flip flag for unsupported value '%s'.", str);
        *flip = Sprite::FLIP_NONE;
        return false;
    }
    else
    {
        *flip = Sprite::FLIP_NONE;
    }

    return true;
}
开发者ID:faustgames-ru,项目名称:AndroidWallpapers,代码行数:35,代码来源:Sprite.cpp


示例19: switch

void Sprite::setBlendMode(BlendMode mode)
{
    switch (mode)
    {
    case BLEND_NONE:
        _batch->getStateBlock()->setBlend(false);
        break;
    case BLEND_ALPHA:
        _batch->getStateBlock()->setBlend(true);
        _batch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
        _batch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);
        break;
    case BLEND_ADDITIVE:
        _batch->getStateBlock()->setBlend(true);
        _batch->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
        _batch->getStateBlock()->setBlendDst(RenderState::BLEND_ONE);
        break;
    case BLEND_MULTIPLIED:
        _batch->getStateBlock()->setBlend(true);
        _batch->getStateBlock()->setBlendSrc(RenderState::BLEND_ZERO);
        _batch->getStateBlock()->setBlendDst(RenderState::BLEND_SRC_COLOR);
        break;
    default:
        GP_ERROR("Unsupported blend mode (%d).", mode);
        break;
    }
}
开发者ID:faustgames-ru,项目名称:AndroidWallpapers,代码行数:27,代码来源:Sprite.cpp


示例20: GP_ERROR

ParticleEmitter* ParticleEmitter::create(const char* textureFile, TextureBlending textureBlending, unsigned int particleCountMax)
{
    Texture* texture = NULL;
    texture = Texture::create(textureFile, false);

    if (!texture)
    {
        GP_ERROR("Failed to create texture for particle emitter.");
        return NULL;
    }
    GP_ASSERT(texture->getWidth());
    GP_ASSERT(texture->getHeight());

    // Use default SpriteBatch material.
    SpriteBatch* batch =  SpriteBatch::create(texture, NULL, particleCountMax);
    texture->release(); // batch owns the texture.
    GP_ASSERT(batch);

    ParticleEmitter* emitter = new ParticleEmitter(batch, particleCountMax);
    GP_ASSERT(emitter);

    // By default assume only one frame which uses the entire texture.
    emitter->setTextureBlending(textureBlending);
    emitter->_spriteTextureWidth = texture->getWidth();
    emitter->_spriteTextureHeight = texture->getHeight();
    emitter->_spriteTextureWidthRatio = 1.0f / (float)texture->getWidth();
    emitter->_spriteTextureHeightRatio = 1.0f / (float)texture->getHeight();

    Rectangle texCoord((float)texture->getWidth(), (float)texture->getHeight());
    emitter->setSpriteFrameCoords(1, &texCoord);

    return emitter;
}
开发者ID:AllenPestaluky,项目名称:GamePlay,代码行数:33,代码来源:ParticleEmitter.cpp



注:本文中的GP_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GREEN函数代码示例发布时间:2022-05-30
下一篇:
C++ GP_DEBUG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap