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

Author Topic: view.Viewport.Top doesn`t work  (Read 1881 times)

0 Members and 1 Guest are viewing this topic.

R0M41K

  • Newbie
  • *
  • Posts: 4
    • View Profile
view.Viewport.Top doesn`t work
« on: January 23, 2017, 04:31:18 pm »
Hello there.
Writing on SFML.NET. When i use the view.Viewport.Top or view.Viewport.Left, it's results in 0, although it should be -100 in my case. What's the problem? How can i get the position of my camera?
        static void Main()
        {
            RenderWindow window = new RenderWindow(new Window.VideoMode(500, 300), "test");
            View view = new View(new Vector2f(-100,-100), window.GetView().Size);
            window.Closed += (o, a) => window.Close();
            CircleShape circle = new CircleShape(20);

            while (window.IsOpen())
            {
                Console.WriteLine(view.Viewport.Top);
                window.SetView(view);
                window.Draw(circle);
                window.DispatchEvents();
                window.Display();
                window.Clear();
            }
        }
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: view.Viewport.Top doesn`t work
« Reply #1 on: January 23, 2017, 04:55:38 pm »
Do you understand how the view works?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

R0M41K

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: view.Viewport.Top doesn`t work
« Reply #2 on: January 23, 2017, 05:09:39 pm »
Unfortunately, i bad in english. It will be very difficult to me to find a necessary information there. Would you tell that i am doing wrong, please?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: view.Viewport.Top doesn`t work
« Reply #3 on: January 23, 2017, 05:26:27 pm »
The view's area (what you set with the constructor) and its viewport (what you print) are two different things. I don't know how to explain that better than in the doc/tutorial/wiki ;)
Laurent Gomila - SFML developer

R0M41K

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: view.Viewport.Top doesn`t work
« Reply #4 on: January 23, 2017, 05:45:15 pm »
Got it. How can i get the position of this view's area? Does SFML have some methods for this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: view.Viewport.Top doesn`t work
« Reply #5 on: January 23, 2017, 08:16:34 pm »
View.Center and View.Size.
Laurent Gomila - SFML developer

R0M41K

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: view.Viewport.Top doesn`t work
« Reply #6 on: January 23, 2017, 08:18:12 pm »
Thanks  :)

 

anything