This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Graphics.hpp> | |
#include <SFML/Window.hpp> | |
#include <SFML/System.hpp> | |
#include <array> | |
#include <cassert> | |
//dot product calculation | |
//https://relativity.net.au/gaming/java/DotProduct.html | |
float dot(const sf::Vector2f& lv, const sf::Vector2f& rv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Simple program which generates a header file containing a build number. | |
If the header file is found to exist then the number is incremented and file updated. | |
If the file is unparsable in some way then it is discarded and a new file starting | |
with the build number 0 is written. | |
Include the generated binary as part of your build chain - ie execute it in the | |
pre-compile stage - and include the resulting output in your source code. | |
*/ | |
#include <fstream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////// | |
// Source for Pong Collision Test example // | |
// http://trederia.blogspot.com/2016/02/2d-physics-101-pong.html // | |
// Released into the public domain // | |
// Example 2 // | |
/////////////////////////////////////////////////////////////////// | |
#include <SFML/Graphics.hpp> | |
#include <SFML/System.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////// | |
// Source for Pong Collision Test example // | |
// http://trederia.blogspot.com/2016/02/2d-physics-101-pong.html // | |
// Released into the public domain // | |
// Example 1 // | |
/////////////////////////////////////////////////////////////////// | |
#include <SFML/Graphics.hpp> | |
#include <SFML/System.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************* | |
Example code to accompany article at: | |
http://trederia.blogspot.com/2014/02/space-racers-breakdown-part-3-vehicle.html | |
*********************************************************************/ | |
#include <SFML/System.hpp> | |
#include <SFML/Window.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const char sinShader[] = | |
"#version 120\n" | |
"uniform float time = 1.0;" | |
"void main(void)" | |
"{" | |
"const float sinWidth = 0.08;" | |
"const float sinHeight = 0.04;" | |
"const float timeMulti = 10.0;" | |
"const float val = (sin(gl_FragCoord.x * sinWidth + time * timeMulti) + sin(gl_FragCoord.y * sinHeight + time * timeMulti)) * 0.3 + 0.5;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Window.hpp> | |
#include <SFML/Graphics.hpp> | |
int main() | |
{ | |
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!"); | |
sf::RectangleShape shape(sf::Vector2f(70.f, 10.f)); | |
shape.setFillColor(sf::Color::Green); | |
shape.setOrigin(35.f, 5.f); | |
shape.setPosition(400.f, 300.f); |