Esempio n. 1
0
void SimpleMenu::smDrawSimpleMenuScrollbar(const CIwSVec2 & pos,const CIwSVec2 & size,const CIwSVec2 & spos,const CIwSVec2 & ssize)
{
	CIwMaterial* m = IW_GX_ALLOC_MATERIAL();
	CIwColour c;
	c.Set(0xFFFFFFFF);
	m->SetColAmbient(c);
	m->SetAlphaMode(CIwMaterial::ALPHA_BLEND);
	IwGxSetMaterial(m);
	CIwSVec2* points = IW_GX_ALLOC(CIwSVec2,8);
	CIwColour* cols = IW_GX_ALLOC(CIwColour,8);
	points[0] = pos+CIwSVec2(0,0);
	points[1] = pos+CIwSVec2(0,size.y);
	points[2] = pos+CIwSVec2(size.x,size.y);
	points[3] = pos+CIwSVec2(size.x,0);
	c.Set(0x20,0x20,0x20,0x20);
	cols[0] = cols[1] = cols[2] = cols[3] = c;
	points[4] = spos+CIwSVec2(0,0);
	points[5] = spos+CIwSVec2(0,ssize.y);
	points[6] = spos+CIwSVec2(ssize.x,ssize.y);
	points[7] = spos+CIwSVec2(ssize.x,0);
	c.Set(0xFF,0xFF,0xFF,0x80);
	cols[4] = cols[5] = cols[6] = cols[7] = c;
	IwGxSetVertStreamScreenSpace(points,8);
	IwGxSetColStream(cols);
	IwGxDrawPrims(IW_GX_QUAD_LIST,0,8);
}
Esempio n. 2
0
void SimpleMenu::smRenderLoading()
{
	IwGxClear(IW_GX_DEPTH_BUFFER_F);

	iwangle step = IW_GEOM_ONE/32;
	g_toeLoadingAngle = (g_toeLoadingAngle+step) %IW_GEOM_ONE;
	int32 h = (int32)IwGxGetScreenHeight();
	int32 w = (int32)IwGxGetScreenWidth();
	int32 x = w/2;
	int32 y = h/2;
	int r = (x<y)?(x/2):(y/2);
	int r2 = r*8/10;

	//iwfixed c = IwGeomCos(g_toeLoadingAngle);
	//iwfixed s = IwGeomCos(g_toeLoadingAngle);
	int32 vertices = 10*4;
	CIwSVec2* v = IW_GX_ALLOC(CIwSVec2,vertices);
	CIwColour* col = IW_GX_ALLOC(CIwColour,vertices);
	int index = 0;
	CIwColour c; c.Set(0xFFFFFFFF);
	col[index] = c;
	v[index++] = CIwSVec2(0,0);
	col[index] = c;
	v[index++] = CIwSVec2(0,h);
	col[index] = c;
	v[index++] = CIwSVec2(w,h);
	col[index] = c;
	v[index++] = CIwSVec2(w,0);
	iwangle a = g_toeLoadingAngle;
	int colS = 250/(vertices/4);
	for (int i=1; i<(vertices/4);++i)
	{
		iwfixed c1 = IwGeomCos(a);
		iwfixed s1 = IwGeomSin(a);
		a += step;
		iwfixed c2 = IwGeomCos(a);
		iwfixed s2 = IwGeomSin(a);
		c.r = c.g = c.b = 255-i*colS;
		col[index] = c;		v[index++] = CIwSVec2(x+c1*r/IW_GEOM_ONE,y+s1*r/IW_GEOM_ONE);
		col[index] = c;		v[index++] = CIwSVec2(x+c1*r2/IW_GEOM_ONE,y+s1*r2/IW_GEOM_ONE);
		c.r = c.g = c.b = 255-(i+1)*colS;
		col[index] = c;		v[index++] = CIwSVec2(x+c2*r2/IW_GEOM_ONE,y+s2*r2/IW_GEOM_ONE);
		col[index] = c;		v[index++] = CIwSVec2(x+c2*r/IW_GEOM_ONE,y+s2*r/IW_GEOM_ONE);

	}
	CIwMaterial* m = IW_GX_ALLOC_MATERIAL();
	m->SetColAmbient(255,255,255,255);
	IwGxClear(IW_GX_DEPTH_BUFFER_F);
	IwGxSetMaterial(m);
	IwGxLightingOff();
	IwGxSetVertStreamScreenSpace(v,vertices);
	IwGxSetUVStream(0);
	IwGxSetColStream(col);
	IwGxDrawPrims(IW_GX_QUAD_LIST, 0, index);
	IwGxFlush();
	IwGxSwapBuffers();
	IwGxClear(IW_GX_DEPTH_BUFFER_F);
}
Esempio n. 3
0
void myIwGxDoneStars()
{
    IwGxSetScreenSpaceSlot(3);
    IwGxSetVertStreamScreenSpace( svertices, ssend_vertices );
    CIwMaterial *pMat = IW_GX_ALLOC_MATERIAL();
    pMat->SetAlphaMode( CIwMaterial::ALPHA_ADD );
    pMat->SetTexture( star_texture );
    pMat->SetColAmbient( 0xFF, 0xFF, 0xFF, 0xFF );
    IwGxSetMaterial( pMat );
    IwGxSetUVStream( suvdata );
    IwGxSetColStream( scolors, ssend_vertices );
    IwGxDrawPrims( IW_GX_QUAD_LIST, NULL, ssend_vertices );
    IwGxFlush();
}
Esempio n. 4
0
void Transitions2D::Fade(uint8 transitionSpeed, bool skipFirstAndLastFrame)
{
	IwGxSetColClear(0, 0, 0, 0);

	if (mStartTexture == NULL || mEndTexture == NULL)
		return;

	if (transitionSpeed == 0)
		transitionSpeed = 1;

	IwGxScreenOrient orient = IwGxGetScreenOrient();
	if (isUsingPrivateTextures) IwGxSetScreenOrient(IW_GX_ORIENT_NONE);

	int alpha = 0;

	if (skipFirstAndLastFrame)
		alpha += transitionSpeed;

	CIwMaterial* startMat;
	CIwMaterial* endMat;
	while (alpha <= 255)
	{
		IwGxClear();

		startMat = IW_GX_ALLOC_MATERIAL();
		startMat->SetTexture(mStartTexture);
		IwGxSetMaterial(startMat);
		IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight()));

		endMat = IW_GX_ALLOC_MATERIAL();
		endMat->SetTexture(mEndTexture);
		endMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND);
		endMat->SetColAmbient(255, 255, 255, alpha);

		IwGxSetMaterial(endMat);
		IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight()));

		IwGxFlush();
		IwGxSwapBuffers();

		s3eDeviceYield(40);
		alpha += transitionSpeed;
	}

	if (!skipFirstAndLastFrame)
	{
		IwGxClear();
		endMat = IW_GX_ALLOC_MATERIAL();
		endMat->SetTexture(mEndTexture);
		IwGxSetMaterial(endMat);
		IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight()));

		IwGxFlush();
		IwGxSwapBuffers();
	}

	if (isUsingPrivateTextures)
	{
		delete mStartTexture;
		delete mEndTexture;
		mStartTexture = NULL;
		mEndTexture = NULL;
	}

	IwGxSetScreenOrient(orient);
}