Beispiel #1
0
void MainScene::setupViewIphone4(){
    PlayScene* play =((PlayScene*)g_pSceneManager->Find("play"));
    CIw2DImage* img = g_pResources->getBlocks(1);
    float xOriginField = play->field.xOrigin;
    
    float x = play->field.xOrigin;
    float y = play->field.yOrigin;
    
    background->SetImage(g_pResources->getMenuBG());
    
    LeftPos = x;
    RightPos = x + img->GetWidth()*coefForIPhone4 + play->field.xBetweenBLock;
    blockStart->m_X = play->playerBlc.xOrigin;
    blockStart->m_Y = play->playerBlc.yOrigin;
    blockStart->m_ScaleX = coefForIPhone4;
    blockStart->m_ScaleY = coefForIPhone4;
    
    buttonStart->setImage(img);
    buttonStart->setPosition(x, y);
    buttonStart->setScale(coefForIPhone4,coefForIPhone4);
    
    img = g_pResources->getBlocks(3);
    x += play->field.xBetweenBLock + img->GetWidth()*coefForIPhone4;
    y = Iw2DGetSurfaceHeight()*8.5/10.0;
    buttonInfo->setImage(img);
    buttonInfo->setPosition(x, y);
    buttonInfo->setScale(coefForIPhone4,coefForIPhone4);
    
    img = g_pResources->getBlocks(2);
    x = x*2 - xOriginField;
    y = Iw2DGetSurfaceHeight()*8.5/10.0;
    buttonApp->setImage(img);
    buttonApp->setPosition(x, y);
    buttonApp->setScale(coefForIPhone4,coefForIPhone4);
};
Beispiel #2
0
int main()
{
	Iw2DInit();
	CIw2DImage* g_AirplayLogo = Iw2DCreateImage("largeAirplayLogo.bmp");
	while (1)
	{
		int64 start = s3eTimerGetMs();
		if	(s3eDeviceCheckQuitRequest())
			break;
		// Clear the screen
		Iw2DSurfaceClear(0xffffffff);
		CIwSVec2 topLeft = CIwSVec2((int16)(Iw2DGetSurfaceWidth() / 2 - g_AirplayLogo->GetWidth() / 2), 
			(int16)(Iw2DGetSurfaceHeight() / 2 - g_AirplayLogo->GetHeight() / 2));
		CIwSVec2 size = CIwSVec2((int16)g_AirplayLogo->GetWidth(), (int16)g_AirplayLogo->GetHeight());
		Iw2DDrawImage(g_AirplayLogo, topLeft, size);
		Iw2DSurfaceShow();

		// Attempt frame rate
		while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
		{
			int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
			if (yield<0)
				break;
			s3eDeviceYield(yield);
		}
	}
	delete g_AirplayLogo;
	Iw2DTerminate();
	return 0;
}
void PatteRunGameEngine::Render2D()
{
	std::list<CGridTile*>::iterator iter = g_pTiles.begin();
	while (iter != g_pTiles.end())
	{
		(*iter)->Render();
		iter++;
	}
	Iw2DFinishDrawing();

	if (g_iCounter < g_iLevel)
	{
	}
	else
	{
		g_pUser->Render();

		if (g_bDisplayCorrect)
		{
			IwGxLightingOn();
			IwGxFontSetFont(g_pFontHuge);
			IwGxFontSetCol(0xffffffff);
			IwGxFontSetAlignmentVer(IW_GX_FONT_ALIGN_MIDDLE);
			IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_CENTRE);
			CIwRect rect(0, 0, Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight());
			IwGxFontSetRect(rect);
			strcpy(g_szStatus, "CORRECT!");
			IwGxFontDrawText(g_szStatus);
		}
	}
}
void CScores::Render()
{
	if (m_loaded)
	{
		Iw2DSetColour(0xffffffff);
		int32 dw = Iw2DGetSurfaceWidth();
		int32 dh = Iw2DGetSurfaceHeight();

		Iw2DFillRect(CIwSVec2(0, 0), CIwSVec2((int16)dw, (int16)dh));
		for (uint32 i = 0; i < m_guicontrols.size(); i++)
			m_guicontrols[i]->Render();
		if (m_closing)
		{
			int32 clr = 255 * (MAX_CLOSETIME - m_closetime) / MAX_CLOSETIME;
			clr = clr << 24;
			//clr += 0xffffff;
			Iw2DSetColour(clr);
			Iw2DFillRect(CIwSVec2(0, 0), CIwSVec2((int16)dw, (int16)dh));
		}
		if (m_showing)
		{
			int32 clr = 255 * (m_showtime) / MAX_SHOWTIME;
			clr = clr << 24;
		//	clr += 0xffffff;
			Iw2DSetColour(clr);
			Iw2DFillRect(CIwSVec2(0, 0), CIwSVec2((int16)dw, (int16)dh));
		}
	}
}
Beispiel #5
0
GameCondition::GameCondition(uint32 complexity)
{
	this->complexity = complexity;
	timeleft = 50000;
	points = 0;
	resolution = new CIwSVec2(Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight());
}
Beispiel #6
0
//-----------------------------------------------------------------------------------------------------GameCondition
GameCondition::GameCondition()
{
	complexity = 1;
	timeleft = 50000;
	points = 0;
	resolution = new CIwSVec2(Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight());
}
Beispiel #7
0
void DrawOnRed()
{
	int w = Iw2DGetSurfaceWidth();
	int h = Iw2DGetSurfaceHeight();
	Iw2DSurfaceClear(0xFF0000FF);
	Iw2DDrawImage(image1, CIwSVec2(w / 2 - image1->GetWidth() / 2, h / 2 - image1->GetHeight() / 2));
}
Beispiel #8
0
void DrawOnBlue()
{
	int w = Iw2DGetSurfaceWidth();
	int h = Iw2DGetSurfaceHeight();
	Iw2DSurfaceClear(0xFFFF0000);
	Iw2DDrawImage(image2, CIwSVec2(w / 2 - image2->GetWidth() / 2, h / 2 - image2->GetHeight() / 2));
}
Beispiel #9
0
Character::Character()
{
	// make character start at center of screen
	m_Target=m_Position=m_ScreenCenter=CIwFVec2(Iw2DGetSurfaceWidth()/2.0f,Iw2DGetSurfaceHeight()/2.0f);
	//m_MOVERANGE=50.0f;
	m_HitRange=false;
}
Beispiel #10
0
Ground::Ground()
{
	Background = Iw2DCreateImage("_ground/grass.jpg");	// Load background
	mWidth = Iw2DGetSurfaceWidth();		// Fetch screen dimensions
	mHeight = Iw2DGetSurfaceHeight();
	Nullify();

}
Beispiel #11
0
void CIwMapGame::ClearTilt()
{
	g_xTiltOffset = g_yTiltOffset = 0;
	g_xTiltVelo = g_yTiltVelo = 0;

	g_xTiltPos = Iw2DGetSurfaceWidth() / 2.0f;
	g_yTiltPos = Iw2DGetSurfaceHeight() / 2.0f;
}
Beispiel #12
0
void GameScreen::Init(std::string name)
{
	Player *p1 = new Player;
	p1->Init(name+".png");

	p1->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-28),(float)(Iw2DGetSurfaceHeight()/2-28));
	p1->SetTarget(p1->GetPosition().x,p1->GetPosition().y);
	p1->SetVelocity(1,1);
	Background *bg = new Background;
	bg->Init("bg.png",(float)Iw2DGetSurfaceWidth(),(float)Iw2DGetSurfaceHeight());

	SetBackGround(bg);
	player = name;
	warpID = name + genRandom();
	AddPlayer(warpID,p1);

	WarpClientRef->connect(warpID);
}
Beispiel #13
0
bool MapBackground::IsTileVisible(MapTile* pTile)
{
	float offset = 1 + (ceil(g_actualZoom) - g_actualZoom);
	int width = Iw2DGetSurfaceWidth() * offset;
	int height = Iw2DGetSurfaceHeight() * offset;

	return true;
	return (pTile->location.x > -_tileWidth) && (pTile->location.y > -_tileWidth) && (pTile->location.x < (width+_tileWidth)) && (pTile->location.y < (_tileWidth+height));
}
Beispiel #14
0
void MatrixManager::Star::DrawStar(int alphaf)
{
    CIwSVec2 texpos = CIwSVec2(star_hue << 5, size_frame << 5);
    if (enabled <= 0)
        return;
    //
    myIwGxDrawStar((Iw2DGetSurfaceWidth() - FIELD_SIZE) / 2 + fx / FIELD_DIV,
        (Iw2DGetSurfaceHeight() - FIELD_SIZE) / 2 + fy / FIELD_DIV,
        texpos, multiplier, rot, alphaf);
}
Beispiel #15
0
void GameScreen::AddRemotePlayer(std::string name,std::string id,float x,float y)
{
	Player *p1 = new Player;
	p1->Init(name+".png");

	p1->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-28),(float)(Iw2DGetSurfaceHeight()/2-28));
	p1->SetTarget(x,y);
	p1->SetVelocity(1,1);

	AddPlayer(id,p1);
}
bool CScores::Load()
{
	if (!m_loaded)
	{
		int32 dw = Iw2DGetSurfaceWidth();
		int32 dh = Iw2DGetSurfaceHeight();
		int16 cx, cy, cw, ch;//, dx, dy;
		CGUIImageButton *btn; 
		//CIw2DImage *img;

		cx = 20;
		cy = 20;
		cw = 100;
		ch = g_font->GetHeight();
		btn = new CGUIImageButton(CIwSVec2(cx, cy), CIwSVec2(cw, ch), 0, false, g_font, false);
		btn->SetCaption("back");
		m_guicontrols.push_back((CGUIControl *)btn);

		cx = 20;
		cy = 20 + g_font->GetHeight() + 20;
		cw = 100;
		ch = g_font->GetHeight();
		btn = new CGUIImageButton(CIwSVec2(cx, cy), CIwSVec2(cw, ch), 0, false, g_font, false);
		btn->SetCaption("profile");
		m_guicontrols.push_back((CGUIControl *)btn);

		cx = 20;
		cy = 20 + g_font->GetHeight() + 20 + g_font->GetHeight() + 20;
		cw = 100;
		ch = g_font->GetHeight();
		btn = new CGUIImageButton(CIwSVec2(cx, cy), CIwSVec2(cw, ch), 0, false, g_font, false);
		btn->SetCaption("local");
		m_guicontrols.push_back((CGUIControl *)btn);

		cx = 20;
		cy = 20 + g_font->GetHeight() + 20 + g_font->GetHeight() + 20 + g_font->GetHeight() + 20;
		cw = 100;
		ch = g_font->GetHeight();
		btn = new CGUIImageButton(CIwSVec2(cx, cy), CIwSVec2(cw, ch), 0, false, g_font, false);
		btn->SetCaption("global");
		m_guicontrols.push_back((CGUIControl *)btn);

		m_listview = new CGUIListView(CIwSVec2(dw / 3, dh / 5), CIwSVec2(dw * 2 / 3, dh * 4 / 5), g_font, false);
		m_listview->set_needselect(false);
		m_listview->set_needimages(false);
		m_listview->set_itemsubtextsize(m_listview->get_itemsize() / 2);

		m_guicontrols.push_back((CGUIControl *)m_listview);

		m_loaded = true;
	}

	return m_loaded;
}
Beispiel #17
0
MenuScreen::MenuScreen()
{
	game = NULL;
	app = NULL;
	
	Player *p1 = new Player;
	Player *p2 = new Player;
	Player *p3 = new Player;
	Player *p4 = new Player;
	Player *p5 = new Player;

	p1->Init("monster1.png");
	p2->Init("monster2.png");
	p3->Init("monster3.png");
	p4->Init("monster4.png");
	p5->Init("monster5.png");

	p1->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-65),(float)(Iw2DGetSurfaceHeight()/2-58));
	p2->SetPosition((float)((Iw2DGetSurfaceWidth()/2)+10),(float)(Iw2DGetSurfaceHeight()/2-58));
	p3->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-92),(float)(Iw2DGetSurfaceHeight()/2+10));
	p4->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-28),(float)(Iw2DGetSurfaceHeight()/2+10));
	p5->SetPosition((float)((Iw2DGetSurfaceWidth()/2)+38),(float)(Iw2DGetSurfaceHeight()/2+10));

	Background *bg = new Background;
	bg->Init("bg2.png",(float)Iw2DGetSurfaceWidth(),(float)Iw2DGetSurfaceHeight(),true);

	SetBackGround(bg);
	AddPlayer("monster1",p1);
	AddPlayer("monster2",p2);
	AddPlayer("monster3",p3);
	AddPlayer("monster4",p4);
	AddPlayer("monster5",p5);
}
Beispiel #18
0
void MapBackground::Init()
{
	g_pThisAndTile = new ThisAndTile;
	((ThisAndTile*)g_pThisAndTile)->pThis = this;

	gError = S3E_RESULT_SUCCESS;
	gResult = NULL;
	gResultLen = 0;
	pImage = 0;
	g_cursorIter = 1;
	g_bInProgress = false;
	g_bInitialLoad = true;
	g_bIsAnimating = false;
	g_latPerPixel = 1;
	g_lonPerPixel = 1;
	g_iTileCacheCount = 0;

	gLocation.m_Latitude = 47.7710083;
	gLocation.m_Longitude = -122.1588533;

	g_bLocationChanged = true;

	g_viewMatrix.SetIdentity();
	g_viewMatrix.t.x = -0x200;

	g_bScaledMode = false;
	g_bShowCursor = true;

	gResult = NULL;

	CIwImage img;
	img.LoadFromFile("cursor.png");
	bool a = img.UsesAlpha();

	gCursor = Iw2DCreateImage(img);

	gScaler = new CoordinateScaler(Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight(), NULL, 0, false);
	gScaledModeScaler = new CoordinateScaler(Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight(), NULL, 0, true);
}
Beispiel #19
0
void MapBackground::ClearScaledCorners()
{
	g_dAlpha = 0xFF;
	g_bScaledMode = false;
	g_viewMatrix.SetIdentity();
	g_viewMatrix.t.z = -0x200;

	IwGxSetViewMatrix(&g_viewMatrix);

	delete gScaledModeScaler;
	gScaledModeScaler = new CoordinateScaler(Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight(), NULL, 0, true);

	Update(true);
}
static void RenderSoftkey(const char* text, s3eDeviceSoftKeyPosition pos, void(*handler)())
{
    int width = 7;
    int height = 10;
    width *= strlen(text);
    int x = 0;
    int y = 0;
    switch (pos)
    {
        case S3E_DEVICE_SOFTKEY_BOTTOM_LEFT:
            y = Iw2DGetSurfaceHeight() - height;
            x = 0;
            break;
        case S3E_DEVICE_SOFTKEY_BOTTOM_RIGHT:
            y = Iw2DGetSurfaceHeight() - height;
            x = Iw2DGetSurfaceWidth() - width;
            break;
        case S3E_DEVICE_SOFTKEY_TOP_RIGHT:
            y = 0;
            x = Iw2DGetSurfaceWidth() - width;
            break;
        case S3E_DEVICE_SOFTKEY_TOP_LEFT:
            x = 0;
            y = 0;
            break;
    }
    char buffer[256] = "`x808080";
    strcat(buffer, text);
    s3eDebugPrint(x, y, buffer, false);
    if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED)
    {
        int pointerx = s3ePointerGetX();
        int pointery = s3ePointerGetY();
        if (pointerx >= x && pointerx <= x+width && pointery >=y && pointery <= y+height)
            handler();
    }
}
Beispiel #21
0
bool Map::CheckMapEdge(CIwFVec2 &pos)
{
	if(pos.x<0)
	{
		pos.x=0;
		return false;
	}
	if(pos.y<0)
	{
		pos.y=0;
		return false;
	}
	if(pos.x+Iw2DGetSurfaceWidth()>_size.x)
	{
		pos.x=(float)_size.x-Iw2DGetSurfaceWidth();
		return false;
	}
	if(pos.y+Iw2DGetSurfaceHeight()>_size.y)
	{
		pos.y=(float)_size.y-Iw2DGetSurfaceHeight();
		return false;
	}
	return true;
}
Beispiel #22
0
bool Map::CheckMapEdge()
{
	if(m_Position.x<0)
	{
		m_Position.x=0;
		return false;
	}
	if(m_Position.y<0)
	{
		m_Position.y=0;
		return false;
	}
	if(m_Position.x+Iw2DGetSurfaceWidth()>_size.x)
	{
		m_Position.x=(float)_size.x-Iw2DGetSurfaceWidth();
		return false;
	}
	if(m_Position.y+Iw2DGetSurfaceHeight()>_size.y)
	{
		m_Position.y=(float)_size.y-Iw2DGetSurfaceHeight();
		return false;
	}
	return true;
}
Beispiel #23
0
void MainScene::setupViewSimulator(){
    PlayScene* play =((PlayScene*)g_pSceneManager->Find("play"));
    CIw2DImage* img = g_pResources->getBlocks(1);
    float xOriginField = play->field.xOrigin;
    float x = xOriginField;
    float y = Iw2DGetSurfaceHeight()*8.5/10.0;
    
    background->SetImage(g_pResources->getMenuBG());
    background->m_ScaleX = 0.5f;
    background->m_ScaleY = 0.5f;
    
    blockStart->m_ScaleX = 0.5f;
    blockStart->m_ScaleY = 0.5f;
    blockStart->m_X = x;
    LeftPos = x;
    RightPos = x + img->GetWidth()*0.5 + play->field.xBetweenBLock;
    blockStart->m_Y = Iw2DGetSurfaceHeight()/10.0;
    
    buttonStart->setScale(0.5, 0.5);
    buttonStart->setImage(img);
    buttonStart->setPosition(x, y);
    
    img = g_pResources->getBlocks(3);
    x += play->field.xBetweenBLock + img->GetWidth()*0.5;
    y = Iw2DGetSurfaceHeight()*8.5/10.0;
    buttonInfo->setImage(img);
    buttonInfo->setPosition(x, y);
    buttonInfo->setScale(0.5, 0.5);
    
    img = g_pResources->getBlocks(2);
    x = x*2 - xOriginField;
    y = Iw2DGetSurfaceHeight()*8.5/10.0;
    buttonApp->setImage(img);
    buttonApp->setPosition(x, y);
    buttonApp->setScale(0.5, 0.5);
};
Beispiel #24
0
//-----------------------------------------------------------------------------
void ExampleInit()
{
    Iw2DInit();
	Iw2DSetColour(0xffffffff);
	g_Image = Iw2DCreateImage("Image.png");

	//
	g_accumulator = 0.0f;
	g_prevTime = s3eTimerGetMs();

	// create a box2d world
	if( !(g_world = new b2World(g_gravity)) )		{ /*error*/	}

	// add a boundary at the edge of the screen
	b2BodyDef bodyDef;
	bodyDef.type = b2_staticBody;
	bodyDef.position.Set(0, 0);
	b2Body* boundaryBody = g_world->CreateBody(&bodyDef);

	const float hw = (float)Iw2DGetSurfaceWidth() * 0.5f / 8;
	const float hh = (float)Iw2DGetSurfaceHeight() * 0.5f / 8;
	b2Vec2 list[] = { b2Vec2(-hw, -hh), b2Vec2(hw, -hh), b2Vec2(hw, hh), b2Vec2(-hw, hh) };

	const int numVerts = sizeof(list) / sizeof(b2Vec2);
	b2ChainShape loopShape;
	loopShape.CreateLoop(list, numVerts);
	boundaryBody->CreateFixture(&loopShape, 0.0f);

	// add a dynamic body
//	b2BodyDef bodyDef;
	bodyDef.type = b2_dynamicBody;
	bodyDef.position.Set(0, 0);
	g_body = g_world->CreateBody(&bodyDef);
	g_body->SetLinearDamping(0.1f);

	b2PolygonShape polygonShape;
	polygonShape.SetAsBox(0.5f * (8/2), 0.5f * (8/2));

	b2FixtureDef fd;
	fd.shape = &polygonShape;
	fd.friction = 0.5f;
	fd.density = 10.0f;
	fd.restitution = 0.5f;

	g_body->CreateFixture(&fd);

	g_body->SetAngularVelocity(2.15f);		// set the dynamic object initially spinning, so that it bounces more interestingly on the 'ground'
}
Beispiel #25
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;
}
Beispiel #26
0
void Brixpath::drawBackgroundPattern(){
    double width = Iw2DGetSurfaceWidth();
    double height = Iw2DGetSurfaceHeight();
    
    double backgroundImageWidth = _backgroundImage->GetWidth();
    double backgroundImageHeight = _backgroundImage->GetHeight();
    
    int timesX = ceil(width / backgroundImageWidth);
    
    int timesY = ceil(height / backgroundImageHeight);
    
    for(int y = 0; y < timesY; y++){
        for(int x = 0; x < timesX; x++){
            Iw2DDrawImage(_backgroundImage, CIwSVec2(x*backgroundImageWidth, y*backgroundImageHeight));
        }
    }
};
Beispiel #27
0
IGDistorter::IGDistorter() {
	IGLog("Distorter init");

	screenWidth = (float)Iw2DGetSurfaceWidth();
	screenHeight = (float)Iw2DGetSurfaceHeight();
	matrix = NULL;
	
	char debugStr[200];
	sprintf(debugStr, "screen width: %i, height: %i", (int)screenWidth, (int)screenHeight);
	IGLog(debugStr);
	
	// colors
	colorBlack.Set(0, 0, 0, 255);
	colorBlackInt = colorBlack.Get();
	colorWhite.Set(255, 255, 255, 255);
	colorWhiteInt = colorWhite.Get();
}
Beispiel #28
0
void CInventory::Init()
{
	inventory_image		= Iw2DCreateImageResource("inventory");

	int screen_width = Iw2DGetSurfaceWidth();
	int screen_height = Iw2DGetSurfaceHeight();

	// Create inventory sprite
	inventory_sprite = new CSprite();
	inventory_sprite->Init();
	inventory_sprite->setPosAngScale(screen_width/2, screen_height - (IMAGE_SIZE_HEIGHT / 2), 0, IW_GEOM_ONE);  // center image vertically on screen
	inventory_sprite->setDestSize(IMAGE_SIZE_WIDTH, IMAGE_SIZE_HEIGHT);
	inventory_sprite->setImage(inventory_image, "inventory");

	// initialize inventory storage
	Clear();
}
Beispiel #29
0
bool MapBackground::CalculateTiles()
{
	if (g_bLocationChanged)
	{
		g_bLocationChanged = false;
		GPSRectangle x;
		std::list<MapTile*> vectorImages;

		int width = Iw2DGetSurfaceWidth();
		int height = Iw2DGetSurfaceHeight();

		float offset = 1 + (ceil(g_tempZoom) - g_tempZoom);
		LiveMaps::GetLocationImages(&vectorImages, &g_rows, &g_cols, &gLocation, (int)(width * offset), (int)(height * offset), &g_corners, &x, ceil(g_tempZoom), &g_latPerPixel, &g_lonPerPixel);

		int count = vectorImages.size();

		if (offset > 1)
		{
			int xOffset = width * (offset - 1) / 2;
			int yOffset = height * (offset - 1) / 2;

			std::list<MapTile*>::iterator iter1 = vectorImages.begin();

			while (iter1 != vectorImages.end())
			{
				MapTile* pTile = *iter1;

				pTile->location.x -= xOffset;
				pTile->location.y -= yOffset;

				iter1++;
			}
		}

		ProcessNewDownloads(&vectorImages);
		gScaler->SetCorners(&g_corners, g_actualZoom, false);

		g_Width = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);
		g_Height = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);
	}

	return true;
}
Beispiel #30
0
void CInventory::Draw()
{
	// Only display inventory in certain game states
	if (g_Game.getGameState() == GS_Playing || g_Game.getGameState() == GS_Paused || g_Game.getGameState() == GS_LevelCompletedFailure || g_Game.getGameState() == GS_LevelCompletedSuccess)
	{
		// Set the current font
		Iw2DSetFont(g_Game.getFont());

		// Reset the visual transform
		Iw2DSetTransformMatrix(CIwMat2D::g_Identity);

		// Set the texts colour to black
		//Iw2DSetColour(0xff000000);
		// HASAN - switched to white since there's a background now
		Iw2DSetColour(0xffffffff);

		// Convert the atom count number to text
		char str[32];
		for (int i = 0; i < inventoryCount; i++)
		{
			// skip to the next if count is zero - and atom is hidden (i.e. - it was originally in the inventory, but now is fully used and no longer available)
			if (atomCount[i] <= 0)
				continue;

			snprintf(str, 32, "%d", atomCount[i]);

			// horizontal center, same as inventory graphic
			int posX = (Iw2DGetSurfaceWidth() / 2) - ( IMAGE_SIZE_WIDTH / 2 ) + 19;
			int posY = Iw2DGetSurfaceHeight() - ( IMAGE_SIZE_HEIGHT / 2);

			// offset inventory vertically to fit in the container
			posX = posX + (10 + (64 / 2));  // NOTE: 64 = atom size, 10 = border + spacing
			if (i > 0)
			{
				posX = posX + (i * (64 + 15));  // NOTE: 64 = atom size, 15 = spacing + border + spacing
			}

			// Draw the atom count in the appropriate location
			Iw2DDrawString(str, CIwSVec2(posX, posY), CIwSVec2(30, 30), IW_2D_FONT_ALIGN_LEFT, IW_2D_FONT_ALIGN_TOP);
		}
	}
}