예제 #1
0
CIw2DFont* IGResourceManager::getFont(std::string name) {
	// see if the resource has been loaded already
	CIw2DFont* ret = (CIw2DFont*)this->getResource(name);
	if(ret != NULL)
		return (CIw2DFont*)ret;
	
	// resource doesn't exist, so load it
	IGResourceManager::Resource* r = new IGResourceManager::Resource;
	r->name = name;
	r->data = (void*)Iw2DCreateFontResource(name.c_str());
	r->count = 1;
	r->type = IGResourceManagerTypeFont;
	resources.push_back(r);
	return (CIw2DFont*)r->data;
}
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;
}
예제 #3
0
/**
* Constructor
*/
Game::Game():

	physicsHz(60),
	timeStep(1.0f/physicsHz),
	velocityIterations(10),
	positionIterations(8),
	g_accumulator(0.0f),
	g_prevTime(s3eTimerGetMs()),
	loadCheckpoint(false), 
	mPaused(false),
	mMultiplayer(false),
	mBytesRecieved(-1),
	timeSinceLastSend(0),
	mRDXVel(0),
	mRecRDXVel(0),
	mDiff(1),
	mTimeSinceLastRequest(0),
	mSelectedLevel("1"),
	mPlayersFinished(0),
	FACEBOOK_APP_ID("160040267492274"),
	FACEBOOK_APP_SECRET("b7d69cf0ef9e50a344d892df3c8c7fe6") {

		mRequestBuffer = NULL;
		mHost = true;
		mSock = NULL;
		mPlayerFound = false;
		mPlayersInLobby = 0;
		mStage = Constants::MAINMENU;
		ServerUrl = "http://10.40.3.237:28003";
		g_GetUID = NULL;
		g_AddScore = NULL;
		mLevel = NULL;
		g_SelectedLvlScore = 0;
		g_Selectedlvl = "tutorial";
		PostScoreRequest = NULL;
		mTimeTaken = 0.0f;
		mPlayerDeaths = 0;
		g_CurrentSession = NULL;

		crateSpawned = true;
		maxCrates = 1;

		moveLeftBtn = Iw2DCreateImage("Images/ArrowLeft.png");
		moveRightBtn = Iw2DCreateImage("Images/ArrowRight.png");
		jumpBtn = Iw2DCreateImage("Images/ArrowJump.png");
		kickBtn = Iw2DCreateImage("Images/kick.png");
		punchBtn = Iw2DCreateImage("Images/punch.png");

		mMenuSystem = new MenuSystem();
		mMenuSystem->init(this);

		mCollListener = new MyContactListener();
		mCollListener->setGame(this);

		// Prepare the iwgxfont resource for rendering using Iw2D
		mFont = Iw2DCreateFontResource("font_large");

		if (s3eAudioIsCodecSupported(S3E_AUDIO_CODEC_MP3)) {
			s3eAudioPlay("Audio/MainMenu.mp3", 0);
		}

		mMusic.push_back("Audio/gameMusic1.mp3");
		mMusic.push_back("Audio/gameMusic2.mp3");

		srand((unsigned)time(0));
}