void MainMenu::draw(sf::RenderWindow &window)
{
	window.clear(sf::Color::Black);

	highlight.setPosition(text[selected].getPosition().x - 15, text[selected].getPosition().y);

	window.draw(highlight);

	window.draw(text[0]);
	window.draw(text[1]);
	window.draw(text[2]);
}
Exemple #2
0
int main()
{  
  sf::Clock clock;


  //NEVER SYNC WITH COMPUTER AND USE THIS AT THE SAME TIME! EVER!
  window.setFramerateLimit(60);

  window.clear();
  window.display();
  
  //Window loop
  while (window.isOpen())
    {
      /***********************v Keyboard v*********************/
      //keyboard for outside of gameloop stuff
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
	left = true;
      }
      else
	left = false;
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
	right = true;
      }
      else
	right = false;
      /***********************^ Keyboard ^*********************/

      //handles events
      sf::Event event;
      while (window.pollEvent(event)) {
	switch (event.type) {
	case sf::Event::Closed:
	  window.close();
	  break;
	}
      }

      //Main Menu
      //By default, start at the menu.
      
      //if (something happens)
      running = true;

      if (running) {
	gameLoop(clock,frameGap);
      }
    }
  

  return 0;
}
bool startMenu(sf::Text title, sf::Text anyKey, sf::Text credits, sf::RenderWindow& window)
{
  // create and load texture for earth.png
  sf::Texture earth;
  if(!earth.loadFromFile("img/earth2.png")) cout << "Error, could not load earth.png" << endl;

  sf::Sprite earthSprite;
  earthSprite.setTexture(earth);
  earthSprite.setPosition(WINDOW_WIDTH / 4 , WINDOW_HEIGHT / 4);

  // set title color, position, size and style
  title.setColor(sf::Color::Black);
  title.setPosition(WINDOW_WIDTH / 5, 0);
  title.setCharacterSize(50);
  title.setStyle(sf::Text::Bold);

  // set anyKey position and color
  anyKey.setPosition(WINDOW_WIDTH / 4.5, 410);
  anyKey.setColor(sf::Color::Black);

  credits.setPosition(WINDOW_WIDTH / 2.6, 450);
  credits.setCharacterSize(10);
  credits.setColor(sf::Color::Black);

  while(window.isOpen())
  {
    sf::Event event;
    while (window.pollEvent(event)) // process events
    {
      // QUIT
      if (event.type == sf::Event::Closed)
      {
          window.close(); // close the window
          return false;
      }

      // if the user presses any key
      if(event.type == sf::Event::KeyPressed || event.type == sf::Event::MouseButtonPressed)
        return true;
    }

    window.clear(sf::Color(255, 255, 235, 0));

    window.draw(earthSprite);
    window.draw(title);
    window.draw(anyKey);
    window.draw(credits);
    window.display();
  }

  return false;
}
void Exterieur::start(sf::RenderWindow &app)
{
	(*Kurt)->setPosition(sf::Vector2f(-100, (*Kurt)->getPosition().y), DROITE);

	while((*Kurt)->getPosition().x < 50)
	{
		update();
		(*Kurt)->deplacer(DROITE, (*Kurt)->getVitesse());
		app.clear(sf::Color::Black);
		afficher(app);
		app.display();
	}
}
Exemple #5
0
void Game::draw() {

        m_window.clear(sf::Color(50, 50, 50));

        for (const auto& wall: m_walls)
                m_window.draw(wall);

        m_window.draw(m_start);
        m_window.draw(m_end);

        m_window.draw(m_pointer);

}
Exemple #6
0
	void render(){
		sf::Vector2f vec1(1, 0), vec2(0, 0);
		gameWindow.clear();
		gameWindow.draw(p1Paddle);
		gameWindow.draw(p2Paddle);

		gameWindow.draw(p1ScoreText);

		gameWindow.draw(p2ScoreText);

		gameWindow.draw(ball);
		gameWindow.display();
	}
Exemple #7
0
void TWindows:: Tips(sf::RenderWindow& oknoAplikacji)
{
	//tribe=0;
	option=1;
	while( oknoAplikacji.isOpen() )
	{
		bool fake=false;
		//CZYSZCZENIE OKNA
		oknoAplikacji.clear(sf::Color( 0, 0, 0));

		sf::Texture tlo;
			bool tlolad=tlo.loadFromFile("tlo.png");
			if(tlolad==true)
			{
				sf::Sprite sprit1;
				sprit1.setColor(sf::Color(255, 255, 255, 20));
				sprit1.setPosition(0,0);
				sprit1.setTexture(tlo);
				sprit1.setScale(10,10);
				oknoAplikacji.draw(sprit1);
			}

			tlolad=tlo.loadFromFile("spacja.png");
			if(tlolad==true)
			{
				sf::Sprite sprit1;
				sprit1.setPosition(0,0);
				sprit1.setTexture(tlo);
				oknoAplikacji.draw(sprit1);
			}

		EventsWin(oknoAplikacji, tribe, option, fake, 9);
		if(option==0)
			break;
		oknoAplikacji.display();
	}
	oknoAplikacji.clear(sf::Color( 10, 10, 10 ));
	option=0;
}
int ScreenOption::Run( sf::RenderWindow& App)
{
	bool running = true;

    App.resetGLStates();

    m_window->SetPosition(sf::Vector2f(App.getSize().x / 2.0f - m_window->GetAllocation().width /2.0f, App.getSize().y / 2.0f - m_window->GetAllocation().height /2.0f));
    m_window->Show(true);
	while(running)
	{
		sf::Event event;
		//Verifing events
		while(App.pollEvent(event))
		{
            m_window->HandleEvent( event );

            if(event.type == sf::Event::Closed)
            {
                running = false;
                App.close();
            }

            if( event.type == sf::Event::KeyPressed)
            {
                if( event.key.code == sf::Keyboard::Escape)
                {
                     m_window->Show(false);
                     return MENU;
                }
            }

            if(m_quit)
            {

                m_window->Show(false);
                m_quit = false;
                return MENU;
            }
        }

        m_desktop.Update( 0.f );

		App.clear();
		App.draw(m_background);
		m_sfgui.Display( App );
		App.draw(currentChoice);
		App.display();
        currentChoice.Update();
	}
return (SCREEN_EXIT);
}
void hshow(sf::RenderWindow & window, int tetris, int snake, int tCar){
    Texture hsBackground;
	hsBackground.loadFromFile("images/background.jpg");
	Sprite hSBg(hsBackground);
    Font font;
    font.loadFromFile("game_over.ttf");
    Text hs1("Tetris: "+intToStr(tetris) , font, 20);
    Text hs2("Snake: "+intToStr(snake) , font, 20);
    Text hs3("Tetro car: "+intToStr(tCar) , font, 20);
    Text backB("Back ", font, 20);
    hs1.setPosition(120, 80);
	hs2.setPosition(120, 120);
	hs3.setPosition(120, 160);
	backB.setPosition(120, 200);
	hSBg.setPosition(0, 0);
	bool isHs=1;
	int btNum=0;
    while(isHs){
        hs1.setColor(Color::Magenta);
		hs2.setColor(Color::Magenta);
		hs3.setColor(Color::Magenta);
		if(btNum!=1)
		backB.setColor(Color::Magenta);
		window.clear(Color(129, 181, 221));
		if (IntRect(120, 200, 100, 20).contains(Mouse::getPosition(window))) { backB.setColor(Color::Blue); btNum = 1; }
		sf::Event event;
        while (window.pollEvent(event)){
            if (event.type == sf::Event::Closed){
                window.close();
                return;
        }
            if(event.type == sf::Event::KeyPressed&&(event.key.code==sf::Keyboard::Down||event.key.code==sf::Keyboard::Up)){
                backB.setColor(Color::Blue);
                btNum=1;
            }
            if (Mouse::isButtonPressed(Mouse::Left)||(event.type == sf::Event::KeyPressed&&event.key.code==sf::Keyboard::Return))
		{
		    if (btNum == 1) return;
		    continue;
		}
            continue;
        }
        window.draw(hSBg);
		window.draw(hs1);
		window.draw(hs2);
		window.draw(hs3);
		window.draw(backB);
		window.display();
    }
}
Exemple #10
0
void redraw(bool cells[31][31], sf::RenderWindow &window)
{
	window.clear();
	draw_grid(window);
	for (int i=1;i<30;i++)
		for (int j=1;j<30;j++)
			if (cells[i][j] == true)
			{
				sf::RectangleShape rect(sf::Vector2f(20, 20));
				rect.setPosition(i * 20, j * 20);
				window.draw(rect);
			}
	window.display();
}
void drawGameOverText(sf::RenderWindow &window, int score)			//draw Game Over screen
{
	sf::Font Font;
	Font.loadFromFile("../../assets/MilasianCircaThinPERSONAL.ttf");

	sf::Font FontArial;
	FontArial.loadFromFile("../../assets/arial.ttf");

	sf::Text textGO;
	textGO.setFont(Font);
	textGO.setString("Game Over");
	textGO.setPosition(220, 150);
	textGO.setCharacterSize(100);
	textGO.setColor(sf::Color::Red);
	textGO.setStyle(sf::Text::Bold);


	sf::Text textHS;
	textHS.setFont(FontArial);
	textHS.setString("High Score:");
	textHS.setPosition(500, 100);
	textHS.setCharacterSize(35);
	textHS.setColor(sf::Color::Magenta);
	textHS.setStyle(sf::Text::Bold);


	sf::Text finalScore;
	finalScore.setFont(FontArial);
	finalScore.setString(to_string(score));
	finalScore.setPosition(750, 100);
	finalScore.setCharacterSize(35);
	finalScore.setColor(sf::Color::Magenta);
	finalScore.setStyle(sf::Text::Bold);


	sf::Text reset;
	reset.setFont(Font);
	reset.setString("Press 'A' to play again");
	reset.setPosition(225, 450);
	reset.setCharacterSize(50);
	reset.setColor(sf::Color::White);
	reset.setStyle(sf::Text::Italic);

	window.clear();						//clear every pixel on the screen 
	window.draw(textGO);
	window.draw(reset);
	window.draw(finalScore);
	window.draw(textHS);
	window.display();
}
// Draw all resources to the screen.
void screen0::Draw(sf::RenderWindow &window) {
	// Clear the screen.
	window.clear();
	// Draw all resources.
	window.draw(backgroundSprite);
	window.draw(screenTitle);
	window.draw(buttonStart.sprite);
	window.draw(buttonHelp.sprite);
	window.draw(buttonSettings.sprite);
	window.draw(buttonQuit.sprite);
	window.draw(name);
	// Display all changes to the screen.
	window.display();
}
Exemple #13
0
int Menu::run(sf::RenderWindow &window) {
    if (!initialized) {
        initialized = true;
        if (!init_buttons()) return -1;
    }
    if (text[0] == "Easy") {
        cursor_loc = 1;
        blist[1].toggleHighlight(sf::Color::Yellow);
    } else {
        cursor_loc = 0;
        blist[0].toggleHighlight(sf::Color::Yellow);
    } 
    bool selecting = true;
    while (selecting) {
        sf::Event e;
        while (window.pollEvent(e)) {
            if (e.type == sf::Event::Closed) {
                selecting = false;
                cursor_loc = -1;
            } else if (e.type == sf::Event::KeyPressed) {
                if (e.key.code == sf::Keyboard::Up) {
                    if (cursor_loc > 0) {
                        blist[cursor_loc--].toggleHighlight(sf::Color::Yellow);
                        blist[cursor_loc].toggleHighlight(sf::Color::Yellow);
                    }
                } else if (e.key.code == sf::Keyboard::Down) {
                    if (cursor_loc < blist.size() - 1) {
                        blist[cursor_loc++].toggleHighlight(sf::Color::Yellow);
                        blist[cursor_loc].toggleHighlight(sf::Color::Yellow);
                    }
                } else if (e.key.code == sf::Keyboard::Z) {
                    blist[cursor_loc].toggleHighlight(sf::Color::Yellow);
                    selecting = false;
                } else if (e.key.code == sf::Keyboard::X) {
                    blist[cursor_loc].toggleHighlight(sf::Color::Yellow);
                    selecting = false;
                    cursor_loc = numbuttons - 1;
                }
            }
        }

        window.clear(sf::Color::White);
        for (int i = 0; i < blist.size(); i++) {
            blist[i].draw(window);
        }
        window.display();
    }
    return ret_signal[cursor_loc];
}
Exemple #14
0
    void display_world(b2World& world,sf::RenderWindow& render)
    {
        world.Step(1.0/60,int32(8),int32(3));

        render.clear();

        for (b2Body* body=world.GetBodyList(); body!=nullptr; body=body->GetNext())
        {   
            sf::Shape* shape = static_cast<sf::Shape*>(body->GetUserData());
            shape->setPosition(converter::meters_to_pixels(body->GetPosition().x),converter::meters_to_pixels(body->GetPosition().y));
            shape->setRotation(converter::rad_to_deg<double>(body->GetAngle()));
            render.draw(*shape);
        }

        render.display();
    }
Exemple #15
0
void DrawGame()
{
	GameWin.clear();

	GameWin.draw(PauseText);
	
	GameWin.draw(ground);

	GameWin.draw(wall);
	GameWin.draw(wall2);

	GameWin.draw(box);
	GameWin.draw(box2);

	GameWin.display();
}
Exemple #16
0
int main(int argc, char** argv) {
	srand((unsigned)time(nullptr));

	window.create(sf::VideoMode(800, 600), "sfml",
							sf::Style::Titlebar || sf::Style::Close);
	window.setFramerateLimit(60);
	window.setMouseCursorVisible(false);

	sf::Listener::setPosition(400, 300, -400);

	font.init();


	walls.init();
	player.init();

	stars.resize(100);
	sort(stars.begin(), stars.end(), [](const Star& a, const Star& b) {
		return a.getSpeed() < b.getSpeed();
	});


	while (window.isOpen()) {
		sf::Event e;
		while (window.pollEvent(e)) {
			switch (e.type) {
			case sf::Event::Closed:
				window.close();
				break;
			case sf::Event::KeyPressed:
				if (e.key.code == sf::Keyboard::Escape) window.close();
				break;
			default:
				break;
			}
		}

		window.clear();

		update();

		draw();

		window.display();
	}
	return 0;
}
Exemple #17
0
void GameStateDead::Draw(sf::RenderWindow &window)
{
    sf::Event event;
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            game->Quit();
    }

    window.clear();

    window.draw(bgSprite);
    window.draw(textGameOver);
    window.draw(textInfo);

    window.display();
}
Exemple #18
0
void GameObject::render(sf::RenderWindow &window){
	// Fill Window with background black
	window.clear(sf::Color::Black);

	// Draw score text
	scoreText.setString("Score: " + std::to_string(score));
	window.draw(scoreText);

	drawSnake(window);

	// Draw game over screen if neccessary
	if( gameOver )
		window.draw(gameOverText);

	// Update the window with what we've drawn
	window.display();
}
Exemple #19
0
ScreenIndex FileSelectScreen::run(
    sf::RenderWindow &app,
    Context &context
) {
    sf::Event event;

    // we initalize the file selector list
    midiFileNames = get_midi_files(MIDI_DIR_PATH);
    fileButtons.clear();
    for (auto fileName : midiFileNames) {
        fileButtons.push_back(LongOneLineButton(fileName));
    }
    updateIterators(app);
    setFileButtonsPosition(app);

    setBackButtonPosition(app);

    // on purpose
    while (true) {
        while (app.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                return START_APPLICATION;
            }

            if (actionTriggeredFileButtons(app, event, context)) {
                return START_APPLICATION;
            }

            if (backButton.actionTriggered(app, event)) {
                return START_APPLICATION;
            }
        }

        app.clear(BACKGROUND_COLOR);
        app.draw(backButton);
        std::for_each(
            firstDisplayedIt,
            lastDisplayedIt,
            [&](const LongOneLineButton& oneFileButton) {
                app.draw(oneFileButton);
            }
        );
        app.display();
    }

}
void NewRecordState::update(sf::RenderWindow& window, float) {
    m_delChar = false;
    window.clear(sf::Color::White);
    for (int i = 0; i < 10; i++) {
        window.draw(m_textRank[i]);
        window.draw(m_textPseudo[i]);
        window.draw(m_textScore[i]);
    }
    
    window.draw(m_textNewScore);
    window.draw(m_textFieldText);
    m_textEntered.setString(m_enteredPseudo);
    window.draw(m_textEntered);
    
    sf::sleep(sf::milliseconds(10));
    window.display();
}
int main()
{
    sf::Clock clock;
    initTexts();
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.clear(sf::Color(244, 67, 54));
        if(game_over)
        {
            window.draw(endText);
            ostringstream s;
            s << "Your score was : " << snake.length();
            scoreText.setString(s.str());
            window.draw(scoreText);
        }
        else
        {

            input(dir);
            sf::Time elapsed = clock.getElapsedTime();
            if(elapsed >= delta)
            {
                if(snake.head()->position() ==  f.position())
                {
                    snake.add();
                    f.generatePos();
                    delta = sf::seconds(delta_i.asSeconds() - (float)snake.length()/100);
                }
                snake.move(dir);
                clock.restart();

            }
            o.draw();
            f.draw();
            snake.draw();
            }
        window.display();
    }
    return 0;
}
Exemple #22
0
int main()
{
	window.create(sf::VideoMode(800, 600), "Breakfree");
	window.setVerticalSyncEnabled(true);
	//, sf::Style::Close|sf::Style::Titlebar);
	
	if (!font.loadFromFile("Nirmala.ttf"))
		return EXIT_FAILURE;

	Levels lv;
	Paddle pad;
	InputManager input;
	
	while (window.isOpen())
	{
		switch (level)
		{
		case 0:
			lv.loadLv0();
			break;
		}
		while (playing)
		{
			input.ExecuteEvents(window);
			
			pad.Update();
			

			window.clear(); // ------draw graphics here-------

			sf::Text text("Score: " + std::to_string(score), font, 20);
			text.setPosition(660, 220);
			window.draw(text);

			lv.Draw(window);

			window.draw(pad.sprite);
			window.draw(pad.ball);

			window.display(); // -----------------------
		}
	}

	return 0;
}
Exemple #23
0
void GameStatePlaying::Draw(sf::RenderWindow &window)
{
    sf::Event event;
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            game->Quit();
    }

    window.clear();

    window.draw(bgSprite);
    snake.DrawSnake(window);
    food.DrawFood(window);
    food.DrawScore(window);

    window.display();
}
Exemple #24
0
void update (sf::RenderWindow& window, sf::Clock& sclock) 
{
    sf::Time elapsed = sclock.restart();
    ((void) elapsed); // silence warning for now.
    
    sf::Event event;
    while (window.pollEvent(event)) 
    {
        if (event.type == sf::Event::Closed)
            window.close();
        else if (event.type == sf::Event::MouseButtonPressed)
        {
            sf::Vector2f mouse = sf::Vector2f(sf::Mouse::getPosition(window));
        }
    }

    sf::Vector2f mouse = sf::Vector2f(sf::Mouse::getPosition(window));
    for (size_t i = 0; i < shapes.size(); ++i) 
    {
        if (shapes[i].getGlobalBounds().contains(mouse)) 
        {
            if (i != 0)
                shapes[i].setOutlineColor(sf::Color(255, 0,0));
        } else {
            shapes[i].setOutlineColor(sf::Color::White);
        }
    }

    window.clear();

    size_t i;
 
    for (i = 0; i < shapes.size(); ++i) 
    {
        window.draw(shapes[i]);
    }

    for (i = 0; i < lables.size(); ++i) 
    {
        window.draw(lables[i]);
    }

    window.display();
}
Exemple #25
0
int main()
{
    using namespace sf;

    Color bg = randCol();
    bool run = true;
    unsigned score = 0;

    VideoMode v = VideoMode::getDesktopMode();
    v.width = 1;
    v.height = 1;

    w1.create(v, "Score: 0", Style::None);

    while (run)
    {
        Event event;
        while (w1.pollEvent(event))
        {
            switch (event.type)
            {
            case Event::Closed:
                run = false;
                break;
            case Event::MouseButtonReleased:
            {
                std::stringstream scoreStream;
                scoreStream << "Score: " << ++score;
                w1.setTitle(scoreStream.str());
                w1.setPosition(randPos());
                bg = randCol();
                break;
            }
            default:
                break;
            }
        }

        w1.clear(bg);
        w1.display();
    }

    w1.close();
}
void EffectsHandler::fadeOut(sf::RenderWindow &rw)
{
    sf::Texture ScreenCap;
    ScreenCap.loadFromImage(rw.capture());
    sf::Sprite SpleenCrap;
    SpleenCrap.setTexture(ScreenCap);

    sf::Clock timer;
    float opacity = 0;
    
    while (opacity < 255) {
        rw.clear();
        opacity += timer.restart().asSeconds() * 100;
        SpleenCrap.setColor(sf::Color(0,0,0,opacity));
        
        rw.draw(SpleenCrap);
        rw.display();
    }
}
MainMenu::MenuResult  MainMenu::GetChoosePlayer(sf::RenderWindow& window)
{
		window.clear();
		sf::Texture texture;

		texture.loadFromFile("images/MainMenu.png");
		sf::Sprite sprite(texture);
		window.draw(sprite);

		texture.loadFromFile("images/dragoncopy.png");
		sf::Sprite sprite1(texture);
		sprite1.setPosition(100, 200);
		window.draw(sprite1);

		texture.loadFromFile("images/AIFire.png");
		sf::Sprite sprite2(texture);
		sprite2.setPosition(500, 250);
		window.draw(sprite2);
		
		texture.loadFromFile("images/HumanvsAI.png");
		sf::Sprite sprite4(texture);
		sprite4.setPosition(430, 450);
		window.draw(sprite4);
			
		window.display();
		//minta input user, waktu diklik nge return
		sf::Event event;
		while (true) {
			while (window.pollEvent(event)) {
				if (event.type == sf::Event::MouseButtonPressed) {
					if (event.mouseButton.x >= 500 && event.mouseButton.x <= 700 &&
						event.mouseButton.y >= 250 && event.mouseButton.y <= 350) {
							int greedytype = 1;
							return ChooseGreedy(window, greedytype);
					} else if (event.mouseButton.x >= 430 && event.mouseButton.x <= 780 &&
						event.mouseButton.y >= 450 && event.mouseButton.y <= 550) {
							int greedytype = 2;
							return ChooseGreedy(window, greedytype);
					}
				}
			}
		}
}
Exemple #28
0
void init_boe(int argc, char* argv[]) {
	init_directories(argv[0]);
	init_menubar(); // Do this first of all because otherwise a default File and Window menu will be seen
	sync_prefs();
	init_graph_tool();
	init_snd_tool();
	
	cDialog::init();
	init_sbar(text_sbar, sbar_rect, 58, 11, 58);
	init_sbar(item_sbar, item_sbar_rect, 16, 8);
	init_sbar(shop_sbar, shop_sbar_rect, 16, 8);
	init_btn(done_btn, BTN_DONE);
	init_btn(help_btn, BTN_HELP);
	
	adjust_window_mode();
	// If we don't do this now it'll flash white to start with
	mainPtr.clear(sf::Color::Black);
	mainPtr.display();
	
	make_cursor_watch();
	boost::thread init_thread([]() {
		init_buf();
		check_for_intel();
		srand(time(nullptr));
		init_screen_locs();
		Set_up_win();
		init_startup();
		flushingInput = true;
	});
	show_logo();
	if(get_bool_pref("ShowStartupSplash", true))
		plop_fancy_startup();
	init_thread.join();
	
	cUniverse::print_result = iLiving::print_result = add_string_to_buf;
	cPlayer::give_help = give_help;
	set_up_apple_events(argc, argv);
	init_fileio();
	init_spell_menus();
	init_mini_map();
	redraw_screen(REFRESH_NONE);
	showMenuBar();
}
Exemple #29
0
void Game::GameLoop() {
	sf::Event currentEvent;
	while(_mainWindow.pollEvent(currentEvent)) {

		switch(_gameState) {
			case Game::ShowingMenu: {
					ShowMenu();
					break;
				}
			case Game::ShowingSplash: {
					ShowSplashScreen();
					break;
				}
			case Game::Playing: {

					// close window
					if(currentEvent.type == sf::Event::Closed) {
						_gameState = Game::Exiting;
					}
					// go to menu on escape
					if(currentEvent.type == sf::Event::KeyPressed 
					&& currentEvent.key.code == sf::Keyboard::Escape) {
						ShowMenu();
					}
					// window resize 
					if(currentEvent.type == sf::Event::Resized) {
						sf::FloatRect visible(0, 0, currentEvent.size.width, 
								currentEvent.size.height);
						_mainWindow.setView(sf::View(visible));
					}

					_mainWindow.clear();

					_p1.draw(_mainWindow);

					_mainWindow.display();


					break;
				}
		}
	}
}
void Intestine::render(sf::RenderWindow &window) {
	window.clear();

	// Change view to sceneryView containing background, HUD and other estetic scene objects
	window.setView(mCamera.getSceneryView());
	mLayerHandler.renderBackground(window);


	// Middleground
	//mLayerHandler.renderMiddleground(window);

	// Change view to tileView containing all entities and terrains
	window.setView(mCamera.getTileView());

	// Decorations back
	mDecorationhandler.renderDecoration(window, 'b');

	// Terrains
	mTerrainHandler->render(window);
	mCollisionHandler.renderCollision(window);

	// Entities
	mEntityHandler->render(window);

	// Decorations front
	mDecorationhandler.renderDecoration(window, 'f');

	// Hud
	mLayerHandler.renderHud(window);

	// Foreground
	window.setView(mCamera.getSceneryView());

	// Dialouge
	if (mLevelState == "Dialogue") {
		Dialoguehandler::getInstance().renderDialogue(window);

	}


	window.display();
}