moved velocityInDirection() to util.h/.cpp
This commit is contained in:
parent
1da27bd621
commit
e8df8f761c
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
sf::Vector2f getOverlap(const sf::FloatRect first, const sf::FloatRect second);
|
sf::Vector2f getOverlap(const sf::FloatRect first, const sf::FloatRect second);
|
||||||
|
sf::Vector2f velocityInDirection(const float speed_in, const sf::Angle angle_in);
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,9 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
sf::Vector2f velocityInDirection(const float speed_in, const sf::Angle angle_in)
|
|
||||||
{
|
|
||||||
return sf::Vector2f{speed_in * std::cos(angle_in.asRadians()), speed_in * std::sin(angle_in.asRadians())};
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::init()
|
void Game::init()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,8 @@ sf::Vector2f getOverlap(const sf::FloatRect first, const sf::FloatRect second)
|
||||||
const float resultY = (first.size.y + second.size.y) - deltaY;
|
const float resultY = (first.size.y + second.size.y) - deltaY;
|
||||||
return {resultX, resultY};
|
return {resultX, resultY};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sf::Vector2f velocityInDirection(const float speed_in, const sf::Angle angle_in)
|
||||||
|
{
|
||||||
|
return sf::Vector2f{speed_in * std::cos(angle_in.asRadians()), speed_in * std::sin(angle_in.asRadians())};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue