-
Notifications
You must be signed in to change notification settings - Fork 3
/
bobby.cpp
68 lines (58 loc) · 1.83 KB
/
bobby.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// bobby.cpp ///////////////////////////////////////////////////////////////////
// base line tests on Vector Victor2 ///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//#include <std_files>
//#include "Headers.h"
//#include "Headers.hpp"
//#include "Source.cpp"
#include <iostream>
#include "VectorVictor2.hpp"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/OpenGL.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(500, 500), "SFML works!");
sf::CircleShape shape(2);
shape.setFillColor(sf::Color::Green);
VectorVictor::Vector2 fuubar(10, -10);
sf::CircleShape vector(2);
vector.setFillColor(sf::Color::Blue);
vector.setPosition(sf::Vector2f(fuubar.x, -fuubar.y));
sf::Font font;
if (!font.loadFromFile("./Data/Fonts/orbitron-light.ttf"))
{ // I dont care right now
}
sf::Text text;
text.setFont(font);
text.setPosition(sf::Vector2f(0, 470));
while(window.isOpen())
{ sf::Event event;
while (window.pollEvent(event))
{ if(event.type == sf::Event::Closed)
{ window.close();
}
if(event.type == sf::Event::MouseButtonPressed)
{ if(event.mouseButton.button == sf::Mouse::Button::Left)
{ sf::Vector2i input_click = sf::Mouse::getPosition(window);
fuubar.x = input_click.x;
fuubar.y = -input_click.y;
}
if(event.mouseButton.button == sf::Mouse::Button::Right)
{ fuubar.Rotate_vector(-15);
//fuubar = fuubar.Get_rotated_vector(-15);
// okay, that is weird
}
}
}
vector.setPosition(sf::Vector2f(fuubar.x, -fuubar.y));
text.setString(SI::Get_formatted_value(fuubar.Get_vector_magnitude() , 3, "units"));
window.clear();
window.draw(shape);
window.draw(vector);
window.draw(text);
window.display();
}
return 0;
}