POSITIVE-MENTAL-ATTITUDE 8 years ago
parent
commit
42877b62d5

BIN
data/background/75pxjitter03.png


BIN
data/background/Spikes16px.png


+ 15 - 1
src/Foreground.cpp

@@ -99,7 +99,7 @@ const unsigned Foreground::getTileSize() const
 
 void Foreground::create(sf::Image& foreground, sf::Image& normal, sf::Image& map)
 {
-	_tileSize = 512;
+	_tileSize = 256;
 	_position.x = 0; _position.y = 0;
 	_tileCount.x = std::ceil(static_cast<float>(map.getSize().x) / _tileSize);
 	_tileCount.y = std::ceil(static_cast<float>(map.getSize().y) / _tileSize);
@@ -170,6 +170,20 @@ void Foreground::renderNormals(bool render)
 	_renderNormals = render;
 }
 
+void Foreground::move(sf::Vector2f movement)
+{
+	for(unsigned i = 0; i < _renderCount.x; ++i)
+		for(unsigned j = 0; j < _renderCount.y; ++j)
+			_sprites[i][j].move(movement);
+}
+
+void Foreground::rotate(float rotation)
+{
+	for(unsigned i = 0; i < _renderCount.x; ++i)
+		for(unsigned j = 0; j < _renderCount.y; ++j)
+			_sprites[i][j].rotate(rotation);
+}
+
 void Foreground::draw(sf::RenderTarget& target, sf::RenderStates states) const
 {
 	unsigned x = _position.x / _tileSize, y = _position.y / _tileSize;

+ 2 - 0
src/Foreground.hpp

@@ -43,6 +43,8 @@ class Foreground: public sf::Drawable
 		const unsigned getTileSize() const;
 		unsigned const tileAlpha(unsigned x, unsigned y, unsigned pixelX, unsigned pixelY);
 		void renderNormals(bool render);
+		void move(sf::Vector2f movement);
+		void rotate(float rotation);
 
 	private:
 		void draw(sf::RenderTarget& target, sf::RenderStates states) const;

+ 10 - 2
src/IngameState.cpp

@@ -56,6 +56,10 @@ void IngameState::init()
 	
 	_foreground.create("data/background/Foreground.jpg", "data/background/Foreground_normal.jpg", "data/background/75pxjitter03.png");
 	_context->foreground = &_foreground;
+	_spike.create("data/background/Foreground.jpg", "data/background/Foreground_normal.jpg", "data/background/Spikes16px.png");
+	_spike.setResolution(sf::Vector2u(0, 0));
+	_spike.move(sf::Vector2f(1020, 2310));
+	_spike.rotate(332.f);
 	
 	_background.setTextureRect(sf::IntRect(0, 0, _foreground.getSize().x, _foreground.getSize().y));
 	
@@ -201,8 +205,8 @@ void IngameState::coreUpdate(sf::Time delta)
 		oss.clear();
 		oss << "Hull: " << int(_player.getHullLeft()) << "%";
 		_statsHull.setString(oss.str());
-		_statsTime.setOrigin(_statsTime.getLocalBounds().width / 2.f, _statsTime.getLocalBounds().height / 2.f);
-		_statsHull.setOrigin(_statsTime.getLocalBounds().width / 2.f, _statsTime.getLocalBounds().height + _statsHull.getLocalBounds().height / 2.f + 30.f);
+		_statsTime.setOrigin(_statsTime.getLocalBounds().width / 2.f, _statsTime.getLocalBounds().height / 2.f - 30.f);
+		_statsHull.setOrigin(_statsTime.getLocalBounds().width / 2.f, _statsTime.getLocalBounds().height + _statsHull.getLocalBounds().height / 2.f);
 		_dotaSound.play();
 	}
 	
@@ -263,14 +267,18 @@ void IngameState::coreRender(const bool shaders)
 		
 		
 		_foreground.renderNormals(true);
+		_spike.renderNormals(true);
 		_lightSystem.normalsTargetSetView(*_camera.getView());
 		_lightSystem.normalsTargetClear();
+		_lightSystem.normalsTargetDraw(_spike);
 		_lightSystem.normalsTargetDraw(_foreground);
 		_lightSystem.normalsTargetDisplay();
 		_lightSystem.render(*_camera.getView(), _unshadowShader, _lightOverShapeShader, _normalsShader);
 		
 		
 		_foreground.renderNormals(false);
+		_spike.renderNormals(false);
+		_context->window->draw(_spike);
 		_context->window->draw(_foreground);
 		_context->window->draw(_wormhole);
 		_context->window->draw(_player);

+ 1 - 0
src/IngameState.hpp

@@ -44,6 +44,7 @@ class IngameState: public State
 		Foreground _foreground;
 		Camera _camera;
 		sf::Sprite _background;
+		Foreground _spike;
 		
 		sf::Shader _unshadowShader;
 		sf::Shader _lightOverShapeShader;

+ 1 - 1
src/Triangles.cpp

@@ -263,7 +263,7 @@ int Triangles::run(unsigned count)
 	
 	if(_context.running)
 	{
-		Echo::out(Echo::Empty, "Triangles version -0.9.9");
+		Echo::out(Echo::Empty, "Triangles version -0.9.7");
 		Echo::out(Echo::Empty, "Copyright (C) 2016 POSITIVE MENTAL ATTITUDE");
 		Echo::out(Echo::Empty, "This program comes with ABSOLUTELY NO WARRANTY;");
 		Echo::out(Echo::Empty, "This is free software, and you are welcome to redistribute it");

+ 1 - 1
src/TrianglesWindow.cpp

@@ -159,7 +159,7 @@ void TrianglesWindow::open()
 	if(_context->borderless)
 		_window.setPosition(sf::Vector2i(0, 0));
 	if(_context->vsync)
-		_window.setFramerateLimit(60);//_window.setVerticalSyncEnabled(true);
+		/*_window.setFramerateLimit(60);*/_window.setVerticalSyncEnabled(true);
 	if(_context)
 		_context->needsUpdate = true;
 }