Пример #1
0
static bool _extLoad()
{
    if (!g_GotExt && !g_TriedExt)
    {
        s3eResult res = s3eExtGetHash(0xb2e1d429, &g_Ext, sizeof(g_Ext));
        if (res == S3E_RESULT_SUCCESS)
            g_GotExt = true;
        else
            s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP_IGNORE, "error loading extension: s3eIOSIAd");
        g_TriedExt = true;
        g_TriedNoMsgExt = true;
    }

    return g_GotExt;
}
Пример #2
0
CScores::CScores(): CBaseScene()
{
	m_listview = 0;

	// Creating Scoreloop Controllers
	SC_Error_t retCode = SC_Client_CreateScoresController(g_client, &m_scoresController,
														  ScoresControllerCallback, this);
	if (retCode != SC_OK) {
		m_scoresController = NULL;
		s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoresController");
	}
	SC_Client_CreateScoreController(g_client, &m_scoreController,
											  ScoreControllerCallbackSubmit, this);
	if (retCode != SC_OK) {
		m_scoreController = NULL;
		s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoreController");
	}

	SC_Client_CreateRankingController(g_client, &m_rankingController,
											  RankingControllerCallback, this);
	if (retCode != SC_OK) {
		m_rankingController = NULL;
		s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_RankingController");


	}

	SC_Client_CreateUserController(g_client, &m_userController,
											  UserControllerCallback, this);
	if (retCode != SC_OK) {
		m_userController = NULL;
		s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_UserController");


	}
}
static bool _extLoad()
{
    if (!g_got_ext && !g_tried_ext)
    {
        s3eResult res = s3eExtGetHash(0xcb8b9d07, &ext, sizeof(ext));
        if (res == S3E_RESULT_SUCCESS)
            g_got_ext = true;
        else
            s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP_IGNORE, "error loading extension: s3eTapjoy");
        g_tried_ext = true;
        g_tried_nomsg_ext = true;
    }

    return g_got_ext;
}
uint32 ResourceManager::RegisterImage(std::string imageName)
{
    CIw2DImage *image = Iw2DCreateImageResource(imageName.c_str());

    if(image == null)
    {
        std::string errMsg = "Unknown image resource requested: '";
        errMsg += imageName + "'";
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, errMsg.c_str());
        return 0;
    }

    int handle = images->size();
    images->push_back(image);
    return handle;
}
Пример #5
0
void TextSprite::SetPaddingSource(IIntSource *xSource, IIntSource *ySource)
{
    if((xSource == null) != (ySource == null))
    {
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, "SetPaddingSource: (xSource == null) != (ySource == null)");
        if(xSource != null) delete xSource;
        if(ySource != null) delete ySource;
        xSource = ySource = null;
    }

    if(paddingXSource != null)
    {
        delete paddingXSource;
        delete paddingYSource;
    }

    paddingXSource = xSource;
    paddingYSource = ySource;
}
Пример #6
0
void TextSprite::SetMarginSource(IIntSource *xSource, IIntSource *ySource)
{
    if((xSource == null) != (ySource == null))
    {
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, "SetMarginSource: (xSource == null) != (ySource == null)");
        if(xSource != null) delete xSource;
        if(ySource != null) delete ySource;
        xSource = ySource = null;
    }

    if(marginXSource != null)
    {
        delete marginXSource;
        delete marginYSource;
    }

    marginXSource = xSource;
    marginYSource = ySource;
}
Пример #7
0
void TextSprite::SetBorderThicknessSource(IIntSource *xSource, IIntSource *ySource)
{
    if((xSource == null) != (ySource == null))
    {
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, "SetBorderThickness: (xSource == null) != (ySource == null)");
        if(xSource != null) delete xSource;
        if(ySource != null) delete ySource;
        xSource = ySource = null;
    }

    if(borderXSource != null)
    {
        delete borderXSource;
        delete borderYSource;
    }

    borderXSource = xSource;
    borderYSource = ySource;
}
uint32 ResourceManager::RegisterFont(std::string fontName)
{
    CIw2DFont *font = Iw2DCreateFontResource(fontName.c_str());

    if(font == null)
    {
        std::string errMsg = "Unknown font resource requested: '";
        errMsg += fontName + "'";
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, errMsg.c_str());
        return 0;
    }

    int handle = fonts->size();
    fonts->push_back(font);

    if(!fontInitialized)
    {
        Iw2DSetFont(font);
        fontInitialized = true;
    }

    return handle;
}
uint32 ResourceManager::RegisterAudio(std::string audioName)
{
    s3eFile *fileHandle = s3eFileOpen(audioName.c_str(), "rb");

    if(fileHandle == null)
    {
        std::string errMsg = "Unknown audio resource requested: '";
        errMsg += audioName + "'";
        s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, errMsg.c_str());
        return 0;
    }

    int soundSize = s3eFileGetSize(fileHandle);
    int16 *soundData = (int16*)s3eMallocBase(soundSize);  
    memset(soundData, 0, soundSize);
    s3eFileRead(soundData, soundSize, 1, fileHandle);  
    s3eFileClose(fileHandle);

    int handle = audioData->size();
    audioData->push_back(soundData);
    audioSizes->push_back(soundSize);

    return handle;
}
Пример #10
0
int main(int argc, char* argv[])
{
	g_pointerdown = false;
	FillDefaultLocalScores();
	// Initialisation of Airplay Studio modules
	Iw2DInit();			// Initialise support for rendering with the standard SW renderer
	IwGxLightingOff();
	IwResManagerInit();
	Load();

	int16 sw = (int16)Iw2DGetSurfaceWidth();
	int16 sh = (int16)Iw2DGetSurfaceHeight();

	PAL_InitData_t palInitData;
	SC_Error_t retCode = SC_Client_New(&g_client, &palInitData, SC_TEST_GAME_ID,
			SC_TEST_GAME_SECRET, "AIW");

	if (retCode != SC_OK) 
		s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_Client");
	
	IwGetResManager()->LoadGroup("fonts.group");
	LoadGlobalImages();

	LoadMainControls();
	game = new CGame();
	mainmenu = new CMainMenu();
	profile = new CProfile();
	scores = new CScores();


	mainmenu->Load();
	game->Load();
	profile->Load();
	scores->Load();
	CBaseScene *curscene = (CBaseScene *)mainmenu;
	g_curSceneType = stMainMenu;


	uint32 timer = (uint32)s3eTimerGetMs();

	g_AccelerometerEnabled = (s3eAccelerometerStart() == S3E_RESULT_SUCCESS);

	

	while(curscene)
	{

		s3eDeviceYield(0);


		//// Check for user quit
		if (s3eDeviceCheckQuitRequest())
			break;


		int delta = uint32(s3eTimerGetMs()) - timer;
		timer += delta;

		// Make sure the delta-time value is safe
		if (delta < 0)
			delta = 0;
		if (delta > 100)
			delta = 100;

		if (g_AccelerometerEnabled)
		{

			if (!g_waiting)
			{
				if (g_errorDialog->Get_Visible())
				{
					if (UpdatePointer() == petDown)
						CloseErrorDlg();
					else
						g_errorDialog->Update(delta);
				}
				else
				{
					switch (UpdatePointer())
					{
						case petNone: break;
						case petDown: curscene->PointerDown(g_pointerx, g_pointery); break;
						case petUp: curscene->PointerUp(g_pointerx, g_pointery); break;
						case petMove: curscene->PointerMove(g_pointerx, g_pointery); break;
					}
					curscene->Update(delta);
				}
			}
			curscene->Render();
			if (g_waiting)
			{
				Iw2DSetColour(0xeeffffff);
				Iw2DFillRect(CIwSVec2(0, 0), CIwSVec2(sw, sh));

				Iw2DSetColour(0xff000000);
		
				Iw2DSetFont(g_font);
				Iw2DDrawString(g_waitcaption, CIwSVec2(0, 0), CIwSVec2(sw, sh), IW_2D_FONT_ALIGN_CENTRE, IW_2D_FONT_ALIGN_CENTRE);
			}
			if (g_errorDialog->Get_Visible())
			{
				g_errorDialog->Render();
			}
		}


		Iw2DSurfaceShow();

		switch (g_curSceneType)
		{
			case stNone: curscene = 0; break;
			case stMainMenu: 
			{
				if (curscene != (CBaseScene *)mainmenu)
				{
					curscene = (CBaseScene *)mainmenu; 
					curscene->Show();
				}
			}	break;
			case stGame: 
			{
				if (curscene != (CBaseScene *)game)
				{
					curscene = (CBaseScene *)game;
					curscene->Show();
				}
			}break;

			case stProfile: 
			{
				if (curscene != (CBaseScene *)profile)
				{
					curscene = (CBaseScene *)profile;
					curscene->Show();
				}
			}break;
			case stScores: 
			{
				if (curscene != (CBaseScene *)scores)
				{
					curscene = (CBaseScene *)scores;
					curscene->Show();
				}
			}break;
		}
	}
	Save();
	delete game;
	delete mainmenu;
	delete profile;
	delete scores;

	SC_Client_Release(g_client);
	UnloadGlobalImages();
	UnloadMainControls();
	if (g_AccelerometerEnabled)
		s3eAccelerometerStop();
	// Terminate system modules
	IwResManagerTerminate();
	Iw2DTerminate();

	return 0;
}