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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Torisuke

Pages: [1]
1
Graphics / Restricting zoom level
« on: February 15, 2011, 08:31:04 pm »
This is probably a newbie-ish issue, so I'm sorry for any wasted time this causes.

Anyways, I'm trying to limit the zoom of a view to never scale the view out farther than it's original size ( or zoomLevel zero as I've dubbed it).

 I currently have tried setting up a counter to increment on positive delta, and decrement on negative, with negative only affecting the zoom while the counter is above 0. No matter what way I write that, the zoom will never zoom out in the slightest with (zoomLevel > 0) requirement in place.

Thank you for your assistance.

Code: [Select]

unsigned int zoomLevel = 0;
while (App.GetEvent(Event))
        {
        if ((Event.Type == sf::Event::MouseWheelMoved) && (Event.MouseWheel.Delta > 0))
            {
                background.Zoom(1.1f);
                zoomLevel++;

            }
            else if((Event.Type == sf::Event::MouseWheelMoved) && (Event.MouseWheel.Delta < 0) && (zoomLevel > 0))
            {
                    background.Zoom(.9f);
                    zoomLevel--;
       
             };

};

Pages: [1]
anything