#include "graphic.h"
graphic::graphic()
{
_window = new sf::RenderWindow(sf::VideoMode(200, 200), "R-Type");
}
graphic::~graphic()
{
}
void graphic::run()
{
while (_window->isOpen())
{
update();
display();
}
}
void graphic::update()
{
while (_window->pollEvent(_event))
{
if ((_event.type == sf::Event::Closed)
|| ((_event.type == sf::Event::KeyPressed)
&& (_event.key.code == sf::Keyboard::Escape)))
_window->close();
}
_background.update();
}
void graphic::display()
{
_window->clear();
_background.display(_window);
_window->display();
}
#include "Space.h"
#include <iostream>
Space::Space()
{
_x = 0;
sf::Texture a;
if (!a.loadFromFile("be.png"))
exit(1);
_s_background.setTexture(_t_background);
_s_background.setPosition(0, 0);
}
Space::~Space()
{
}
void Space::update()
{
_x += 2;
_s_background.setTextureRect(sf::IntRect(_x, 0, 1920 + _x, 1080));
}
void Space::display(sf::RenderWindow *w)
{
w->draw(_s_background);
}