Distributions.hpp
Go to the documentation of this file.
1 //
3 // Thor C++ Library
4 // Copyright (c) 2011-2016 Jan Haller
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 // claim that you wrote the original software. If you use this software
16 // in a product, an acknowledgment in the product documentation would be
17 // appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not be
20 // misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source distribution.
23 //
25 
28 
29 #ifndef THOR_DISTRIBUTIONS_HPP
30 #define THOR_DISTRIBUTIONS_HPP
31 
33 #include <Thor/Config.hpp>
34 
35 #include <SFML/System/Vector2.hpp>
36 #include <SFML/System/Time.hpp>
37 
38 
39 namespace thor
40 {
41 
44 
47 namespace Distributions
48 {
49 
52  Distribution<int> THOR_API uniform(int min, int max);
53 
56  Distribution<unsigned int> THOR_API uniform(unsigned int min, unsigned int max);
57 
60  Distribution<float> THOR_API uniform(float min, float max);
61 
64  Distribution<sf::Time> THOR_API uniform(sf::Time min, sf::Time max);
65 
68  Distribution<sf::Vector2f> THOR_API rect(sf::Vector2f center, sf::Vector2f halfSize);
69 
72  Distribution<sf::Vector2f> THOR_API circle(sf::Vector2f center, float radius);
73 
76  Distribution<sf::Vector2f> THOR_API deflect(sf::Vector2f direction, float maxRotation);
77 
78 } // namespace Distributions
79 
81 
82 } // namespace thor
83 
84 #endif // THOR_DISTRIBUTIONS_HPP
Distribution< sf::Vector2f > rect(sf::Vector2f center, sf::Vector2f halfSize)
Uniform random distribution in a rectangle
Distribution< int > uniform(int min, int max)
Uniform random distribution in an int interval
Class holding a rule to create values with predefined properties.
Definition: Distribution.hpp:42
Definition: AnimationMap.hpp:42
Distribution< sf::Vector2f > deflect(sf::Vector2f direction, float maxRotation)
Vector rotation with a random angle.
Configuration header of the library.
Distribution< sf::Vector2f > circle(sf::Vector2f center, float radius)
Uniform random distribution in a circle
Class template thor::Distribution.