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 - JimJ22

Pages: [1]
1
Window / [Newbie question] Using views
« on: July 16, 2014, 01:44:25 pm »
Hi there,

I am trying to understand how the View class works. I am trying to create a simple display with two views, where each view is half of the window size, ie the window is split vertically down the middle. I am using: // view1.setViewport(sf::FloatRect(0, 0, 0.5f, 1)); and view2.setViewport(sf::FloatRect(0.5f, 0, 0.5f, 1)); as shown in the tutorial here: http://sfml-dev.org/tutorials/2.1/graphics-view.php

However I am unsure how to ensure an object is the size of the view. I want to place a rectangle in the bottom half of each view, so essentially I am covering the bottom half of the screen, with one rectangle in each side.

My window size is 300x400. I am making a rectangle of size sf::RectangleShape rectangle(sf::Vector2f(150, 200)); and then setting position with rectangle.setPosition(75, 400);

Is there a way to ensure anything I place inside my view is the same size as the view?

Thanks for any help.

Pages: [1]
anything