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

Author Topic: Using CurrentView  (Read 2842 times)

0 Members and 1 Guest are viewing this topic.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Using CurrentView
« on: November 13, 2010, 07:38:45 pm »
Unless I am missing something here, the following should update the view before each draw:

Code: [Select]
using System;
using SFML.Graphics;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var rw = new RenderWindow(new SFML.Window.VideoMode(800, 600), "Test"))
            {
                Shape sh = Shape.Rectangle(new FloatRect(8,8,32,32), Color.Green);

                while (rw.IsOpened())
                {
                    rw.DispatchEvents();
                    rw.CurrentView.Reset(new FloatRect(0, 0, rw.Width, rw.Height));
                    // rw.CurrentView = rw.CurrentView;
                    rw.Draw(sh);
                    rw.Display();
                }
            }
        }
    }
}


But the changes made to CurrentView don't actually take affect until you do a hack like I have above in the commented-out line. If you leave that line commented out, CurrentView.Reset() appears to have no affect. Adding the commented out line, the view is resized as expected.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using CurrentView
« Reply #1 on: November 13, 2010, 08:27:45 pm »
That's right, the semantics of the views have changed in SFML 2. I need to modify the .Net classes accordingly.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using CurrentView
« Reply #2 on: November 14, 2010, 04:23:44 pm »
It's fixed. CurrentView has been replaced with GetView() and SetView(), so it's now obvious that you need to call SetView to apply the modifications.
Laurent Gomila - SFML developer

 

anything