Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on September 17, 2013 at 09:13 AM

Section 1 (C++)

#include <SFML/Graphics.hpp>

void viewControls()
{
    sf::RenderWindow window(sf::VideoMode(800, 450), "Lester");

	sf::View gameView;
	gameView.reset(sf::FloatRect(200, 200, 300, 200));

	sf::View minimapView;
	minimapView.setCenter(sf::Vector2f(350, 300));
	minimapView.setSize(sf::Vector2f(200, 200));


	gameView.setViewport(sf::FloatRect(0, 0, 1, 1));

	minimapView.setViewport(sf::FloatRect(0.75f, 0, 0.25f, 0.25f));
}

void gametextures()
{
	//Game Textures
	sf::Texture grass;
	sf::Texture stone;
	sf::Texture flower_Yellow;
	sf::Texture flower_Red;
	sf::Texture sand;

	//Player Textures
	sf::Texture player_left;
	sf::Texture player_right;
	sf::Texture player_down;
	sf::Texture player_up;

	//Load All Textures
	if (grass.loadFromFile("grass.png"))
	if (stone.loadFromFile("stone.png"))
	if (flower_Yellow.loadFromFile("flower_yellow.png"))
	if (sand.loadFromFile("sand.png"))

	//Player Load
	if (player_up.loadFromFile("char_u.png"))
	if (player_right.loadFromFile("char_r.png"))
	if (player_left.loadFromFile("char_l.png"))
	if (player_down.loadFromFile("char_d.png"))

	//Set Textures to a Sprite
	sf::Sprite Grass(grass);
	sf::Sprite Stone(stone);
	sf::Sprite FlowerY(flower_Yellow);
	sf::Sprite Sand(sand);

	//Set Player Sprite
	sf::Sprite Player(player_up);

	grass.setRepeated(true);
}

void playermovement()
{
	float playerSpeed = 2.0f;

	if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
		Player.setTexture(player_left);
		Player.move(playerSpeed - 0.1, 0);
	}

	if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
		Player.setTexture(player_right);
		Player.move(playerSpeed + 0.1, 0);
	}	

	if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
		Player.setTexture(player_up);
		Player.move(0, playerSpeed - 0.1);
	}

	if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
		Player.setTexture(player_down);
		Player.move(0, playerSpeed + 0.1);
	}
}

int main()
{
    while (window.isOpen())
    {
       sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
				window.close();
        }

		viewControls();
		gametexutres();
		playermovment();

        window.clear(sf::Color::Black);
		window.draw(Player);
        window.display();
    }
    return 0;
}