POSITIVE-MENTAL-ATTITUDE 9 years ago
parent
commit
67235d7c96

+ 60 - 0
CMakeLists.txt

@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 2.8.11)
+
+project(TrianglesReborn)
+
+# Linker options
+set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS}  ")
+
+# Library path
+set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L\".\" -L\"/usr/lib\" ")
+
+# Define the CXX sources
+set ( CXX_SRCS
+    src/main.cpp
+    src/Triangles.cpp
+    src/Input.cpp
+    src/IngameState.cpp
+    src/Assets.cpp
+    src/MenuState.cpp
+    src/Triangle.cpp
+    src/Player.cpp
+    src/Foreground.cpp
+    src/GuiTriangle.cpp
+    src/Camera.cpp
+    src/State.cpp
+    src/TrianglesWindow.cpp
+    src/Bullet.cpp
+    src/Collidable.cpp
+    src/Utility.cpp
+    src/GuiButton.cpp
+    src/Particle.cpp
+    ltbl/tools/Math.cpp
+    ltbl/lighting/LightSystem.cpp
+    ltbl/lighting/LightPointEmission.cpp
+    ltbl/lighting/LightDirectionEmission.cpp
+    ltbl/quadtree/StaticQuadtree.cpp
+    ltbl/quadtree/QuadtreeOccupant.cpp
+    ltbl/quadtree/QuadtreeNode.cpp
+    ltbl/quadtree/Quadtree.cpp
+    ltbl/quadtree/DynamicQuadtree.cpp
+    src/Circle.cpp
+    src/Wormhole.cpp
+    src/Lantern.cpp
+    src/Star.cpp
+)
+
+set_source_files_properties(
+    ${CXX_SRCS} PROPERTIES COMPILE_FLAGS 
+    "-O3 -std=c++11")
+
+add_executable(TrianglesReborn ${CXX_SRCS} ${C_SRCS})
+
+target_link_libraries(TrianglesReborn
+    sfml-system
+    sfml-window
+    sfml-graphics
+    sfml-audio
+    pthread
+    X11
+)
+

BIN
data/background/75pxjitter03.png


+ 1 - 1
ltbl/quadtree/StaticQuadtree.h

@@ -1,6 +1,6 @@
 #pragma once
 
-#include "ltbl/quadtree/Quadtree.h"
+#include "../quadtree/Quadtree.h"
 
 namespace ltbl
 {

+ 5 - 1
src/IngameState.cpp

@@ -136,6 +136,10 @@ void IngameState::coreThink(const sf::Event& event)
 		_status = State::Menu;
 	if(event.type == sf::Event::KeyPressed and event.key.code == sf::Keyboard::P and !_player.isDead())
 		_paused = !_paused;
+	#ifdef DEBUG
+	if(event.type == sf::Event::JoystickButtonPressed)
+		Echo::debug("Joystick button pressed -- ", event.joystickButton.button);
+	#endif
 	_player.think(event);
 }
 void IngameState::coreInput()
@@ -182,7 +186,7 @@ void IngameState::coreUpdate(sf::Time delta)
 	if(_paused)
 		return;
 		
-	if(sf::Joystick::isConnected(0))
+	//if(sf::Joystick::isConnected(0))
 		_context->window->lockMouse();
 
 	const sf::Vector2f pos = _player.getPosition();

+ 1 - 1
src/IngameState.hpp

@@ -23,7 +23,7 @@
 #include "Camera.hpp"
 #include "Wormhole.hpp"
 #include "Star.hpp"
-#include "ltbl/lighting/LightSystem.h"
+#include "../ltbl/lighting/LightSystem.h"
 
 class IngameState: public State
 {

+ 1 - 1
src/Lantern.hpp

@@ -18,7 +18,7 @@
 #pragma once
 
 #include <memory>
-#include "ltbl/lighting/LightPointEmission.h"
+#include "../ltbl/lighting/LightPointEmission.h"
 
 class Lantern
 {

+ 2 - 2
src/MenuState.cpp

@@ -296,7 +296,7 @@ void MenuState::coreUpdate(sf::Time delta)
 	static sf::Clock clock;
 	_waterSine.setParameter("time", clock.getElapsedTime().asSeconds());
 	
-	if(sf::Joystick::isConnected(0))
+	/*if(sf::Joystick::isConnected(0))
 	{
 		sf::Vector2f v;
 		switch(_padSelection)
@@ -316,7 +316,7 @@ void MenuState::coreUpdate(sf::Time delta)
 				
 		}
 		_context->window->lockMouse(sf::Vector2i(v));
-	}
+	}*/
 	
 	_logo.update(_context->window->getMousePosition(), delta);
 	_play.update(_context->window->getMousePosition(), delta);

+ 3 - 2
src/Player.cpp

@@ -51,7 +51,8 @@ Player::Player():
 		_inputMap.map(2, Input(sf::Joystick::Axis::Y, true));
 		_inputMap.map(3, Input(sf::Joystick::Axis::Z, false));
 		_inputMap.map(4, Input(sf::Joystick::Axis::Z, true));
-		_inputMap.map(5, Input(7));
+		_inputMap.map(5, Input(13));
+		_inputMap.map(6, Input(15, Input::Type::Pressed));
 	 }
 	 else
 	 {
@@ -60,9 +61,9 @@ Player::Player():
 		_inputMap.map(3, Input(sf::Keyboard::A));
 		_inputMap.map(4, Input(sf::Keyboard::D));
 		_inputMap.map(5, Input(sf::Keyboard::Space));
+		_inputMap.map(6, Input(sf::Keyboard::LControl, Input::Type::Pressed));
 	 }
 	_inputMap.map(40, Input(sf::Keyboard::F9, Input::Type::Pressed));
-	_inputMap.map(6, Input(sf::Keyboard::LControl, Input::Type::Pressed));
 	
 	/**
 	 *  Input lambdas

+ 2 - 3
src/Triangles.cpp

@@ -256,19 +256,18 @@ void Triangles::load(int stateType)
 	Echo::debug("Done.");
 }
 
-int Triangles::run(unsigned count)
+int Triangles::run()
 {
 	sf::Clock clock;
 	sf::Time delta, epsilon = sf::seconds(1.f / 30.f);
 	
 	if(_context.running)
 	{
-		Echo::out(Echo::Empty, "Triangles version -0.9.5");
+		Echo::out(Echo::Empty, "Triangles version -0.8.9");
 		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");
 		Echo::out(Echo::Empty, "under certain conditions; see LICENSE file");
-		Echo::out(Echo::Info, "This is #", count, " Triangles run on this install.", count >= 666 ? " Thanks for being addicted!" : " I like cookies.");
 	}
 	
 	/**

+ 1 - 1
src/Triangles.hpp

@@ -30,7 +30,7 @@ class Triangles
 	public:
 		Triangles() = delete;
 		Triangles(int argc, char** argv);
-		int run(unsigned count);
+		int run();
 
 	private:
 		/**

+ 2 - 3
src/main.cpp

@@ -16,7 +16,6 @@
  */
 
 #include "Triangles.hpp"
-#include "statCounter.hpp"
 #include <X11/Xlib.h>
 
 /**
@@ -39,7 +38,7 @@ int main(int argc, char** argv)
 	
 	[](){}(); [](){}(); [](){}(); [](){}();
 	
-	std::srand(time(NULL));
+	std::srand(std::time(NULL));
 	
 	[](){}(); [](){}(); [](){}(); [](){}();
 	
@@ -47,5 +46,5 @@ int main(int argc, char** argv)
 	
 	[](){}(); [](){}(); [](){}(); [](){}();
 	
-	return game.run(statCounter());
+	return game.run();
 }

+ 0 - 38
src/statCounter.hpp

@@ -1,38 +0,0 @@
-/**
- *  Triangles
- *  Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, version 3 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <fstream>
-
-/**
- * @brief This will open a file, increase its content (a number) by one, close the file and print the number.
- * AKA how many times was the F9 pressed without errors.
- * @return The current count. 
- */
-unsigned statCounter()
-{
-	std::ifstream ifs;
-	std::ofstream ofs;
-	ifs.open("data/counter");
-	unsigned count;
-	ifs >> count;
-	ifs.close();
-	++count;
-	ofs.open("data/counter");
-	ofs << count;
-	ofs.close();
-	return count;
-}