void PatteRunGameEngine::Init(void* pGameStateVoid)
{
	IGameHandler* pGameState = (IGameHandler*)pGameStateVoid;
	/*
	g_pBall = new CBall(pGameState);
	g_pUserPaddle = new CGPSPaddle(pGameState);
	//g_pUserPaddle = new CCompPaddle(this, g_pBall, false);
	g_pCompPaddle = new CCompPaddle(pGameState, g_pBall, true);

	g_pBall->PushPaddle(g_pUserPaddle);
	g_pBall->PushPaddle(g_pCompPaddle);
	*/
	g_pUser = new CGPSUser(pGameState);
	g_pGameHandler = pGameState;
	g_pFontHuge = (CIwGxFont*)IwGetResManager()->GetResNamed("font_huge", "CIwGxFont");
	g_pFont = (CIwGxFont*)IwGetResManager()->GetResNamed("font_medium", "CIwGxFont");
	g_pFontSmall = (CIwGxFont*)IwGetResManager()->GetResNamed("font_small", "CIwGxFont");
	
	CIwImage imgTile;
	imgTile.LoadFromFile("images/patterun/tile.png");

	g_pTile = new CIwTexture();
	g_pTile->CopyFromImage(&imgTile);
	g_pTile->Upload();
}
Exemplo n.º 2
0
	bool Texture2DLoader::loadFromFile(IResource * outResource, const std::string & fileName)
	{
		Texture2D * texPtr = (Texture2D*)outResource;
		assert(texPtr != nullptr);

		CIwImage image;
		image.LoadFromFile(fileName.c_str());

		return texPtr->uploadToGPU(image);
	}
Exemplo n.º 3
0
/**
* Constructor
* @param pPos the position of the door
* @param pFrames number of frames in the animation
* @param pImageName the image to use for the animation
* @param pScale the render scale
*/
Effect::Effect(CIwSVec2 pPos, int pFrames, const char* pImageName, float pScale):
	mPos(pPos),
	mFrameCount(pFrames),
	mCurFrame(0),
	mFrameDelay(0),
	mMaxFrameDelay(3),
	mFinished(false),
	mScale(pScale) {

		CIwImage img;
		img.LoadFromFile(pImageName);
		mImage = Iw2DCreateImage(img);
}
Exemplo n.º 4
0
void MapBackground::CreateMapTileImage2(MapTile* pMapTile, char* szPath, bool isJpg)
{
	if (!IsTileVisible(pMapTile))
	{
		return;
	}
	CIwImage image;
	if (!isJpg)
	{
		image.LoadFromFile(szPath);
		if (image.GetWidth())
		{
			pMapTile->pTexture = new CIwTexture;
			pMapTile->pTexture->CopyFromImage(&image);
			pMapTile->pTexture->Upload();
		}
	}
	else
	{
		s3eFile* pFile = s3eFileOpen(szPath, "r");

		if (pFile)
		{
			uint32 gResultLen = s3eFileGetSize(pFile);
			void* gResult = (void*)s3eMalloc(gResultLen + 1);

			uint32 test = s3eFileRead(gResult, sizeof(char), gResultLen, pFile);
			gResultLen = test;
			s3eFileClose(pFile);

			JPEGImage(gResult, gResultLen, image);
			pMapTile->pTexture = new CIwTexture;
			pMapTile->pTexture->CopyFromImage(&image);
			pMapTile->pTexture->Upload();

			delete gResult;
		}
	}
}
Exemplo n.º 5
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);
}