Skip to content

Instantly share code, notes, and snippets.

@senapk
Created August 18, 2016 13:02
Show Gist options
  • Save senapk/484239ad037ba0c5a58ea3072e44183f to your computer and use it in GitHub Desktop.
Save senapk/484239ad037ba0c5a58ea3072e44183f to your computer and use it in GitHub Desktop.
FUP: Pulo da Pokebola
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
LIBS += -lsfml-graphics -lsfml-window -lsfml-system
SOURCES += main.cpp
#include <iostream>
#include <SFML/Graphics.hpp>
#include <cstdlib>
using namespace std;
int main()
{
//lvalue = rvalue
sf::CircleShape pokebola(50);
float x = 350.0, y = 0.0;
float vy = 0.2;
float grav = 0.001;
pokebola.setPosition(sf::Vector2f(x, y));
pokebola.setFillColor(sf::Color::Magenta);
sf::RenderWindow janela(sf::VideoMode(800, 600), "Super");
while(janela.isOpen()){
sf::Event evento;
while(janela.pollEvent(evento)){
if(evento.type == sf::Event::Closed){
janela.close();
}
}
vy = vy + grav;
y = y + vy;
if(y > 500){
vy = vy * -0.7;
y = 500;
}
pokebola.setPosition(sf::Vector2f(x, y));
janela.clear();
janela.draw(pokebola);
janela.display();
}
return 0;
}
//criar a janela
//enquanto a janela estiver aberta{
// enquanto tiver eventos na fila
// pegar um evento
// processa o evento
// se evento for de fechar a tela
// fecha a tela
// limpa a tela
// desenha os objetos
// mostra os objetos
//}
//fecha a janela
@senapk
Copy link
Author

senapk commented Aug 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment