예제 #1
0
파일: button.cpp 프로젝트: felixiao/Demos
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);
	}
예제 #2
0
파일: game.cpp 프로젝트: felixiao/Demos
void CGame::Render()
{
    // for example, clear to black (the order of components is ABGR)
    Iw2DSurfaceClear(0x00ecdeff);
	Iw2DSetColour(0xffffffff);
	std::string s;

	if(_currentLevel==0)
		s.append("Lobby");
	else
	{	
		s.append("Level ");
		std::ostringstream ss;
		ss << _currentLevel;
		s.append(ss.str());
	}

	IwGxPrintSetScale(2);
	IwGxPrintString(630, 10, (char*)s.c_str());
    
	currentMap->Render(_Character->m_CollisionBox);
	_Character->Render(currentMap->m_Position);
	_UI->Render();
	if(_firstLaunch)
		Iw2DDrawImage(_imageTut[0],CIwSVec2(300,300));
	if(_currentLevel==1&&_firstLaunchLevel1)
		Iw2DDrawImage(_imageTut[1],CIwSVec2(300,300));
	if(_enterDoor)
		Iw2DDrawImage(_imageTut[2],CIwSVec2(300,300));
	if(_mazeFinish)
		Iw2DDrawImage(_imageTut[3],CIwSVec2(300,300));
    // show the surface
    Iw2DSurfaceShow();
}
예제 #3
0
//-----------------------------------------------------------------------------
void HexMapTest::Render()
{
//	if (mouse_mode == MOUSE_MODE_CHECKING) 
	{
//		int32 px = IwGxGetScreenWidth() - s3ePointerGetX();
//		int32 py = IwGxGetScreenHeight() - s3ePointerGetY();
		int32 closestX = -1, closestY = -1;

		CIwVec3 vect = getWorldCoords(s3ePointerGetX(), s3ePointerGetY());
//		hexGrid->findClosestArray(origin, dir, closestX, closestY);
		//WORKING!!!
		hexGrid->findClosestSimple(vect.x, vect.y, closestX, closestY);
		DebugPrint(closestX, closestY);
	}
//		s_PickSurface->MakeCurrent();
    // Clear the screen
    IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);
	// Set the model matrix
    IwGxSetModelMatrix(&s_ModelMatrix);
	hexGrid->render();


    // End drawing
    IwGxFlush();

	IwGxPrintSetScale(2);
	IwGxPrintFrameRate(0, 0); 
	// Swap buffers
	IwGxSwapBuffers();
}
예제 #4
0
int main()
{
	IwGxInit();
	Iw2DInit();

	AppWarp::Client* WarpClientRef;
	AppWarp::Client::initialize("b29f4030aba3b2bc7002c4eae6815a4130c862c386e43ae2a0a092b27de1c5af","bf45f27e826039754f8dda659166d59ffb7b9dce830ac51d6e6b576ae4b26f7e");
	WarpClientRef = AppWarp::Client::getInstance();

	MenuScreen *menu = new MenuScreen;
	GameScreen *game = new GameScreen(WarpClientRef);

	Game *gm = new Game;
	gm->AddScene("game",game);
	gm->AddScene("menu",menu);

	menu->game = game;
	menu->app = gm;

	Listener listener(WarpClientRef,game);
	WarpClientRef->setConnectionRequestListener(&listener);
	WarpClientRef->setRoomRequestListener(&listener);
	WarpClientRef->setNotificationListener(&listener);

	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB,gm);

	while(!s3eDeviceCheckQuitRequest())
	{
		s3eKeyboardUpdate();
		if(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN)
			break;

		WarpClientRef->update();
		s3ePointerUpdate();
		IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

		IwGxPrintSetScale(2);
		IwGxPrintString(0,0,game->msg.c_str());

		gm->Move();
		gm->Render();

		Iw2DSurfaceShow();
		s3eDeviceYield();
	}

	s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB);

	gm->CleanUp();
	delete menu;
	delete game;
	delete gm;

	WarpClientRef->terminate();

	Iw2DTerminate();
	IwGxTerminate();
}
예제 #5
0
파일: panel.cpp 프로젝트: felixiao/Demos
void Panel::Render()
{
	if(isDisplay){
		if(m_images.size()>0)
		{
			Iw2DDrawImage(m_images[m_images.size()-1], m_BGPos);
		}
		else
		{
			Iw2DSetColour(bg_color);
			Iw2DFillRect(m_BGPos,m_BGSize);
			Iw2DSetColour(0xffffffff);
		}
		if(m_text!="")
		{
			IwGxPrintSetColour(text_color[3], text_color[2], text_color[1]);
			IwGxPrintSetScale(m_TextScale);
			IwGxPrintString(m_TextPos.x, m_TextPos.y, m_text);
		}
		for(int i=m_btns.size()-1;i!=-1;i--)
			m_btns[i]->Render();
	}
}