Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<SFML/Window.hpp>
- #include<SFML/Graphics.hpp>
- #include<iostream>
- #include<fstream>
- #include<string>
- static const int WIDTH = 100;
- static const int HEIGHT = 25;
- int main()
- {
- sf::RenderWindow Window(sf::VideoMode(1920,1080, 32), "NHTV Assignment", sf::Style::Close);
- //Black tile
- sf::Sprite black;
- sf::Texture blackTex;
- blackTex.loadFromFile("Load/black.png");
- black.setTexture(blackTex);
- //White tile
- sf::Sprite white;
- sf::Texture whiteTex;
- whiteTex.loadFromFile("Load/black.png");
- white.setTexture(whiteTex);
- int level[WIDTH][HEIGHT];
- for(int i = 0; i < WIDTH; i++)
- {
- for(int j = 0; j < HEIGHT; j++)
- {
- level[i][j] = 0;
- //std::cout << level[i][j] << " ";
- }
- std::cout << std::endl;
- }
- std::ifstream file;
- file.open("Load/Level.txt");
- if(file.is_open())
- {
- std::cout << "File Opened successfully!!!. Reading data from file into array" << std::endl;
- while(!file.eof())
- {
- for(int i = 0; i < HEIGHT; i++)
- {
- for(int j = 0; j < WIDTH; j++)
- {
- //level[i][j] = ???
- std::cout << level[i][j] << " ";
- }
- std::cout << std::endl;
- }
- }
- }
- while(Window.isOpen())
- {
- sf::Event event;
- while(Window.pollEvent(event))
- {
- if(event.type == sf::Event::Closed || event.key.code == sf::Keyboard::Escape)
- Window.close();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement