Exemplo n.º 1
0
HexagonGame::HexagonGame(GameWindow& mGameWindow) :
    window(mGameWindow)
{
    pm = new PatternManager(this);

    recreateTextures();

    game.addUpdateFunc(	 [&](float frameTime) {
        update(frameTime);
    });
    game.addDrawFunc(	 [&]() {
        gameTexture.clear(Color::Black);
    }, -2);

    if(!getNoBackground())
        game.addDrawFunc([&]() {
        drawBackground();
    }, 			   -1);

    game.addDrawFunc(	 [&]() {
        manager.draw();
    }, 					0);
    game.addDrawFunc(	 [&]() {
        gameTexture.display();
    }, 			1);
    game.addDrawFunc(	 [&]() {
        drawOnWindow(gameSprite);
    }, 		2);
    game.addDrawFunc(	 [&]() {
        drawText();
    }, 				3);
}
Exemplo n.º 2
0
	void HexagonGame::draw()
	{
		styleData.computeColors();

		window.clear(Color::Black);
		if(!getNoBackground()) { backgroundCamera.apply(); styleData.drawBackground(window.getRenderWindow(), {0, 0}, getSides()); }
		if(get3D())
		{
			status.drawing3D = true;

			float effect{styleData.get3DSkew() * get3DMultiplier() * status.pulse3D};
			Vector2f skew{1.f, 1.f + effect};
			backgroundCamera.setSkew(skew);

			for(unsigned int i{0}; i < depthCameras.size(); ++i)
			{
				Camera& depthCamera(depthCameras[i]);
				depthCamera.setView(backgroundCamera.getView());
				depthCamera.setSkew(skew);
				depthCamera.setOffset({0, styleData.get3DSpacing() * (i * styleData.get3DPerspectiveMultiplier()) * (effect * 3.6f)});
			}

			for(unsigned int i{0}; i < depthCameras.size(); ++i)
			{
				status.overrideColor = getColorDarkened(styleData.get3DOverrideColor(), styleData.get3DDarkenMultiplier());
				status.overrideColor.a /= styleData.get3DAlphaMultiplier();
				status.overrideColor.a -= i * styleData.get3DAlphaFalloff();

				depthCameras[i].apply();
				manager.draw();
			}
			status.drawing3D = false;
		}
		backgroundCamera.apply(); manager.draw();
		overlayCamera.apply(); drawText();

		if(getFlash()) render(flashPolygon);
		if(mustTakeScreenshot) { window.getRenderWindow().capture().saveToFile("screenshot.png"); mustTakeScreenshot = false; }
	}