Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <time.h>
- using namespace sf;
- int main()
- {
- RenderWindow window(VideoMode(320, 480), "The Game!"); // window config
- Texture t;
- t.loadFromFile("/Users/alleyuan/code-snippets/16_games/01 Tetris/images/tiles.png"); // load sprite. replace my absolute path
- Sprite s(t);
- s.setTextureRect(IntRect(0,0,18,18));
- while (window.isOpen()) // game loop
- {
- Event e;
- while (window.pollEvent(e)) // close window
- {
- if (e.type == Event::Closed)
- window.close();
- }
- window.clear(Color::White); // draw tiles
- window.draw(s);
- window.display();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment