Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML how to transfer parametr to function(C++, Visual Studio)  (Read 2610 times)

0 Members and 1 Guest are viewing this topic.

DeKaReW

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
SFML how to transfer parametr to function(C++, Visual Studio)
« on: October 12, 2019, 12:15:44 pm »
I made code, Visual Studio don't see mistakes, but, program don't compilating;

#include <SFML/Graphics.hpp>
using namespace sf;

void MainMenu(RenderWindow &window) {
   Image menu;
   menu.loadFromFile("images/Main_menu.png");
   Texture a;
   a.loadFromImage(menu);
   Sprite Mainmenu;
   Mainmenu.setTexture(a);
   Mainmenu.setPosition(100, 100);

   window.draw(Mainmenu);
}

int main()
{
   RenderWindow window(VideoMode(1200, 720), "SFML works!");

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

      window.clear();
      window.display();
   }

   MainMenu(window);

   return 0;
}


Program don't compilating because of this line:

   window.draw(Mainmenu);   // 13th line.
« Last Edit: October 12, 2019, 12:29:59 pm by DeKaReW »