update
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
#include <SFML/Audio.hpp>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/Graphics/Font.hpp>
|
||||
#include <SFML/Graphics/Rect.hpp>
|
||||
#include <SFML/Graphics/RectangleShape.hpp>
|
||||
#include <SFML/Graphics/Text.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
#include <SFML/System/Angle.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/Window/Keyboard.hpp>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "globals.hpp"
|
||||
#include "elements.hpp"
|
||||
#include "maps.hpp"
|
||||
@@ -72,8 +77,14 @@ int main() {
|
||||
sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default);
|
||||
window.setFramerateLimit(60);
|
||||
|
||||
sf::Font font("pixel.ttf");
|
||||
sf::Text text(font, "0, 0", 16);
|
||||
text.setPosition({ WIDTH - (TILESIZE * 11.5), HEIGHT - (int)(TILESIZE / 1.5)});
|
||||
|
||||
float f = -1;
|
||||
while (window.isOpen()) {
|
||||
window.clear(sf::Color::Black);
|
||||
text.setString(std::to_string((int)player.rect.getPosition().x) + ", " + std::to_string((int)player.rect.getPosition().y));
|
||||
while (const std::optional event = window.pollEvent()) {
|
||||
if (event->is<sf::Event::Closed>())
|
||||
window.close();
|
||||
@@ -91,6 +102,7 @@ int main() {
|
||||
// test_square.set_velocity({ -20, 0 });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
player.handle_movment();
|
||||
player.set_velocity_y(player.get_velocity().y + player.m_acceleration);
|
||||
player.rect.move({0, player.get_velocity().y});
|
||||
@@ -182,6 +194,7 @@ int main() {
|
||||
window.draw(player.rect);
|
||||
// window.draw(test_square.rect);
|
||||
window.draw(line.rect);
|
||||
window.draw(text);
|
||||
window.display();
|
||||
}
|
||||
for(int i = 0; i < MAX_ROWS; i++) {
|
||||
|
||||
Reference in New Issue
Block a user