Ejemplo n.º 1
0
int main()
{
	sfw::initContext(SCREEN_WIDTH, SCREEN_HEIGHT, "NSFW Draw");
		

	loadTexture("Background","./Textures/background.png", 1, 1);

	loadTexture("Start",   "./Textures/GameButton.png", 1, 1);
	loadTexture("Credits", "./Textures/CreditsButton.png", 1, 1);
	loadTexture("Quit",    "./Textures/QuitButton.png", 1, 1);
	loadTexture("Mouse",   "./Textures/mouse.jpg", 1, 1);

	loadTexture("Fireball", "./Textures/Player/newFireball.png", 5, 1);

	loadTexture("playerIDLE", "./Textures/Player/playerIDLE.png", 6, 1);
	loadTexture("playerHIT", "./Textures/Player/playerHIT.png", 6, 1);
	loadTexture("playerRUN", "./Textures/Player/playerRUN.png", 8, 1);
	loadTexture("playerSHOOT", "./Textures/Player/playerShoot.png", 6, 1);

	loadTexture("enemyIDLE", "./Textures/Enemy/enemyIDLE.png", 6, 1);
	loadTexture("enemyHIT", "./Textures/Enemy/enemyHIT.png", 8, 1);
	loadTexture("enemyWALK", "./Textures/Enemy/enemyWALK.png", 8, 1);
	loadTexture("enemySPAWN", "./Textures/Enemy/enemySPAWN.png", 10, 1);
	loadTexture("enemyDIE", "./Textures/Enemy/enemyDIE.png", 8, 1);

	addAnimation("Fireball", "bAni", { 0,1,2,3,4 }, 12);

	addAnimation("playerIDLE", "pIDLE", { 0,1,2,3,4,5}, 12);
	addAnimation("playerHIT", "pHIT", { 0,1,2,3,4,5 }, 12);
	addAnimation("playerRUN", "pRUN", { 0,1,2,3,4,5,6,7 }, 12);
	addAnimation("playerSHOOT", "pSHOOT", { 0,1,2,3,4,5 }, 12);

	addAnimation("enemyIDLE", "eIDLE", { 0,1,2,3,4,5 }, 12);
	addAnimation("enemyHIT", "eHIT", { 0,1,2,3,4,5,6,7 }, 12);
	addAnimation("enemyWALK", "eWALK", { 0,1,2,3,4,5,6,7 }, 12);
	addAnimation("enemySPAWN", "eSPAWN", { 0,1,2,3,4,5,6,7,8,9 }, 12);
	addAnimation("enemyDIE", "eDIE", { 0,1,2,3,4,5,6,7 }, 12);

	GameState game;
	MenuState menu;

	STATE current = MENU;

	while (sfw::stepContext())
	{
		
		switch (current)
		{
		case MENU:
			current = menu.update();
			menu.draw();
			break;
		case GAME:
			current = game.update();
			game.draw(); 
			break;
		case CREDITS:
			break;
		case QUIT:
			return 0;
		}
		
		
		//dinosaur.CollisionBox(CLEAR);
 
	}

	sfw::termContext();
}
Ejemplo n.º 2
0
void main()
{
	sfw::initContext(800, 600, "Saving Bob");
	sfw::setBackgroundColor(BLACK);

	loadTexture("Space", "../res/space800x600.jpg", 1, 1);
	loadTexture("Asteroid Belt", "../res/asteroidbelt.png", 1, 1);
	loadTexture("Nebula", "../res/nebula.png", 1, 1);
	loadTexture("Nebula2", "../res/nebula2.png", 1, 1);
	loadTexture("Player", "../res/playership.png", 8, 1);
	loadTexture("Bullet", "../res/bullet.png", 1, 1);
	loadTexture("eBullet", "../res/enemyBullet.png", 1, 1);
	loadTexture("Enemy", "../res/enemyship.png", 9, 1);
	loadTexture("Explosion", "../res/explosion.png", 4, 4);
	loadTexture("Play", "../res/PlayBlue.png", 1, 1);
	loadTexture("Exit", "../res/ExitBlue.png", 1, 1);
	loadTexture("Credits", "../res/CreditsBlue.png", 1, 1);
	loadTexture("GameOver", "../res/GameOver.jpg", 1, 1);
	loadTexture("Options", "../res/OptionsBlue.png", 1, 1);
	loadTexture("Crosshair", "../res/crosshair.png", 1, 1);
	loadTexture("SavingTitle", "../res/savingTitle.png", 1, 1);
	loadTexture("BobTitle", "../res/bobTitle.png", 1, 1);
	loadTexture("PlanetBob", "../res/planetBob.png", 5, 4);
	loadTexture("Back", "../res/backButton.png", 1, 1);
	loadTexture("CreditsPage", "../res/Credits.jpg", 1, 1);
	addAnimation("Player", "Thrusters", { 0,1,2,3,4,5,6,7 });
	addAnimation("Enemy", "eThrusters", { 0,1,2,3,4,5,6,7,8 });
	addAnimation("Explosion", "Boom", { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 });
	addAnimation("PlanetBob", "Rotation", { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 });

	GameState game;
	MenuState menu;
	CreditsPage creditsPage;
	GameOverBG gameOverPage;
	menu.menuLayout();
	game.start();
	creditsPage.creditsPG();
	//gameOverPage.gameOverPG();
	


	while (sfw::stepContext())
	{
		
		
		switch (menuSelection)
		{
		case 1:
			menu.update();
			menu.draw();
			break;
		case 2:
			game.update();
			game.draw();
			break;
		case 3:
			creditsPage.update();
			creditsPage.draw();
			break;
		case 4:
			sfw::termContext();
			break;
		case 5:
			gameOverPage.update();
			gameOverPage.draw();
		}

		
	}
	sfw::termContext();
}