MCPcopy Create free account
hub / github.com/Hopson97/MineCraft-One-Week-Challenge / Player

Method Player

Source/Player/Player.cpp:15–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13sf::Font f;
14
15Player::Player()
16 : Entity({2500, 125, 2500}, {0.f, 0.f, 0.f}, {0.3f, 1.f, 0.3f})
17 , m_itemDown(sf::Keyboard::Down)
18 , m_itemUp(sf::Keyboard::Up)
19 , m_flyKey(sf::Keyboard::F)
20 , m_num1(sf::Keyboard::Num1)
21 , m_num2(sf::Keyboard::Num2)
22 , m_num3(sf::Keyboard::Num3)
23 , m_num4(sf::Keyboard::Num4)
24 , m_num5(sf::Keyboard::Num5)
25 , m_acceleration(glm::vec3(0.f))
26
27{
28 f.loadFromFile("Res/Fonts/rs.ttf");
29
30 for (int i = 0; i < 5; i++) {
31 m_items.emplace_back(Material::NOTHING, 0);
32 }
33
34 for (float i = 0; i < 5; i++) {
35 sf::Text t;
36 t.setFont(f);
37 t.setOutlineColor(sf::Color::Black);
38 t.setCharacterSize(25);
39 t.setPosition({20.0f, 20.0f * i + 100.0f});
40 m_itemText.push_back(t);
41 }
42 m_posPrint.setFont(f);
43 m_posPrint.setOutlineColor(sf::Color::Black);
44 m_posPrint.setCharacterSize(25);
45 m_posPrint.setPosition(20.0f, 20.0f * 6.0f + 100.0f);
46}
47
48void Player::addItem(const Material &material)
49{

Callers

nothing calls this directly

Calls 1

loadFromFileMethod · 0.80

Tested by

no test coverage detected