Exemple #1
0
void Button::Render()
{
	if(btn_type==IMAGE)
		Iw2DDrawImage(_image, m_ImgPos);
	else
	{
		Iw2DSetColour(bg_color);
		if(btn_type==RECT||btn_type==TEXT)
			Iw2DFillRect(m_BGPos,m_BGSize);
		else if(btn_type==SPHERE)
			Iw2DFillArc(m_BGPos+CIwSVec2(m_BGSize.x/2,m_BGSize.y/2), m_BGSize, iwangle(0), iwangle(0x1600), 40);
		if(btn_type==TEXT)
		{
			uint8 rgb[4];
			rgb[0]=(text_color & 0x000000ff);//A
			rgb[1]=(text_color & 0x0000ff00) >>8;//B
			rgb[2]=(text_color & 0x00ff0000) >>16;//G
			rgb[3]=(text_color & 0xff000000) >>24;//R
			IwGxPrintSetColour(rgb[3], rgb[2], rgb[1]);
			IwGxPrintSetScale(2);
			IwGxPrintString(m_TextPos.x, m_TextPos.y, m_text);
			
		}
		Iw2DSetColour(C_WHITE);
	}
Exemple #2
0
// Main entry point for the application
int main()
{
	// Initialise Iw2D
	Iw2DInit();

	// Get surface width and height
	int surface_width = Iw2DGetSurfaceWidth();
	int surface_height = Iw2DGetSurfaceHeight();

	// Rotation angle of rectangle
	float angle = 0;
	
	// Wait for a quit request from the host OS
	while (!s3eDeviceCheckQuitRequest())
	{
		// Clear background to blue
		Iw2DSurfaceClear(0xff8080);

		// Set up a transform
		CIwFMat2D mat;
		mat.SetRot(angle);
		mat.ScaleRot(2.0f);
		mat.SetTrans(CIwFVec2((float)surface_width / 2, (float)surface_height / 2));
		Iw2DSetTransformMatrix(mat);
		angle += 0.01f;

		// Render filled rectangle
		Iw2DSetColour(0xff00ffff);
		Iw2DFillRect(CIwFVec2(-50.0f, -100.0f), CIwFVec2(100.0f, 200.0f));

		// Render filled arc
		Iw2DSetColour(0xffff00ff);
		Iw2DFillArc(CIwFVec2(0, 0), CIwFVec2(100.0f, 100.0f), 0, 1.8 * PI);
		
		// Flip the surface buffer to screen
		Iw2DSurfaceShow();

		// Sleep to allow the OS to process events etc.
		s3eDeviceYield(0);
	}
	
	// Shut down Iw2D
	Iw2DTerminate();
	
	return 0;
}