Example #1
0
bool InitImg()
{
	// 创建顶点缓存
	if( FAILED(g_pd3dD->CreateVertexBuffer(sizeof(Vertex)*4, 0, VertexFVF, D3DPOOL_MANAGED, &lpVB, NULL)) )
		return false;

	Vertex* pVertices;
	if( FAILED(lpVB->Lock( 0, 0, (void**)&pVertices, 0 )) )
		return false;

	pVertices[0] = Vertex(0.0f, 0.0f		,		0.0f, 0.0f);
	pVertices[1] = Vertex(0.0f, 1.0f		,		0.0f, 1.0f);
	pVertices[2] = Vertex(1.0f, 0.0f		,		1.0f, 0.0f);
	pVertices[3] = Vertex(1.0f, 1.0f		,		1.0f, 1.0f);
	lpVB->Unlock();

	//初始化texlist
	for(int i=0;i<65535;i++)
	{
		texlist_headp[i] = 0;
		texlist_nowp[i] = 0;
	}

	// 初始化着色器
	if(!InitEffect())
		return false;

	return true;
}
Example #2
0
AInventory *APowerup::CreateCopy (AActor *other)
{
	// Get the effective effect time.
	EffectTics = abs (EffectTics);
	// Abuse the Owner field to tell the
	// InitEffect method who started it;
	// this should be cleared afterwards,
	// as this powerup instance is not
	// properly attached to anything yet.
	Owner = other;
	// Actually activate the powerup.
	InitEffect ();
	// Clear the Owner field, unless it was
	// changed by the activation, for example,
	// if this instance is a morph powerup;
	// the flag tells the caller that the
	// ownership has changed so that they
	// can properly handle the situation.
	if (!(ItemFlags & IF_CREATECOPYMOVED))
	{
		Owner = NULL;
	}
	// All done.
	return this;
}
Example #3
0
AInventory *APowerup::CreateCopy (AActor *other)
{
	EffectTics = abs (EffectTics);
	Owner = other;
	InitEffect ();
	Owner = NULL;
	return this;
}
void initintroengine()
{
	//InitEffect( 0, 1.0f-480.0f/1024.0f, 640.0f/1024.0f, 1);
	byte *n=new byte[256*256*4];
	memset(n,0,256*256*4);
	for (int x=0; x<20; x++)
	{
		glGenTextures(1,&shots[x].texture);
		glBindTexture(GL_TEXTURE_2D,shots[x].texture);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexImage2D(GL_TEXTURE_2D,0,4,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,n);
	}
	InitEffect( 0, 1.0f-480.0f/1024.0f, 640.0f/1024.0f, 1);
}
Example #5
0
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
    ALCcontext *Context;
    ALsizei    cur = 0;

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        ALCdevice *device = Context->Device;
        ALenum err;

        CHECK_VALUE(Context, n >= 0);
        for(cur = 0;cur < n;cur++)
        {
            ALeffect *effect = calloc(1, sizeof(ALeffect));
            err = AL_OUT_OF_MEMORY;
            if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR)
            {
                free(effect);
                al_throwerr(Context, err);
            }

            err = NewThunkEntry(&effect->id);
            if(err == AL_NO_ERROR)
                err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect);
            if(err != AL_NO_ERROR)
            {
                FreeThunkEntry(effect->id);
                memset(effect, 0, sizeof(ALeffect));
                free(effect);

                al_throwerr(Context, err);
            }

            effects[cur] = effect->id;
        }
    }
    al_catchany()
    {
        if(cur > 0)
            alDeleteEffects(cur, effects);
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
ParticleSys::ParticleSys(Texture *texture, int newEffect, int width, int height)
{
	effect = newEffect;

	sysWidth = width;
	sysHeight = height;

	hidden = false;

	sysColor = { 255, 255, 255 };

    numParticles = 10;

	InitEffect(texture, effect, sysWidth, sysHeight);

}
Example #7
0
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
    ALCcontext *Context;
    ALsizei i;

    Context = GetContextRef();
    if(!Context) return;

    if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
        alSetError(Context, AL_INVALID_VALUE);
    else
    {
        ALCdevice *device = Context->Device;
        ALenum err;

        for(i = 0;i < n;i++)
        {
            ALeffect *effect = calloc(1, sizeof(ALeffect));
            if(!effect || InitEffect(effect) != AL_NO_ERROR)
            {
                free(effect);
                alSetError(Context, AL_OUT_OF_MEMORY);
                alDeleteEffects(i, effects);
                break;
            }

            err = NewThunkEntry(&effect->effect);
            if(err == AL_NO_ERROR)
                err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect);
            if(err != AL_NO_ERROR)
            {
                FreeThunkEntry(effect->effect);
                memset(effect, 0, sizeof(ALeffect));
                free(effect);

                alSetError(Context, err);
                alDeleteEffects(i, effects);
                break;
            }

            effects[i] = effect->effect;
        }
    }

    ALCcontext_DecRef(Context);
}
Example #8
0
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
    ALCdevice *device;
    ALCcontext *context;
    ALsizei cur;

    context = GetContextRef();
    if(!context) return;

    if(!(n >= 0))
        SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);

    device = context->Device;
    for(cur = 0;cur < n;cur++)
    {
        ALeffect *effect = calloc(1, sizeof(ALeffect));
        ALenum err = AL_OUT_OF_MEMORY;
        if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR)
        {
            free(effect);
            alDeleteEffects(cur, effects);
            SET_ERROR_AND_GOTO(context, err, done);
        }

        err = NewThunkEntry(&effect->id);
        if(err == AL_NO_ERROR)
            err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect);
        if(err != AL_NO_ERROR)
        {
            FreeThunkEntry(effect->id);
            memset(effect, 0, sizeof(ALeffect));
            free(effect);

            alDeleteEffects(cur, effects);
            SET_ERROR_AND_GOTO(context, err, done);
        }

        effects[cur] = effect->id;
    }

done:
    ALCcontext_DecRef(context);
}
Example #9
0
File: map.cpp Project: f3yagi/mysrc
void CreateObject(Map *map)
{
    int i;

    InitEnemy();
    InitItem();
    InitBomb();
    InitEffect();
    for (i = 0; i < map->objectNum; i++) {
        float x = (float)map->object[i].x * BLOCK_WIDTH;
        float y = (float)map->object[i].y * BLOCK_HEIGHT;
        char type = map->object[i].type;
        int r;
        if (type == PLAYER) {
            InitPlayer(x, y);
        }
        r = CreateEnemy(type, x, y);
        if (r) {
            continue;
        }
        CreateItem(type, x, y);
    }
    MoveMap(map);
}    
Example #10
0
void ParticleSys::ChangeEffect(Texture *texture, int newEffect)
{
	effect = newEffect;
	InitEffect(texture, newEffect, sysHeight, sysWidth);
}
Example #11
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void Effect::LoadEffect( char* name, LPDIRECT3DDEVICE9 pd3dDevice )
{
	ResourceItem::SetName( name );
	InitEffect( name, pd3dDevice, &m_pEffect );
}