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

Author Topic: Changing window size  (Read 4041 times)

0 Members and 1 Guest are viewing this topic.

WiecznyWem

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • http://wiecznywem.co.cc
Changing window size
« on: June 30, 2011, 09:36:49 am »
Hi
I have a problem, namely:
I have a window (SFML) and I want it when you change the size of expanded space for drawing, not to scale its contents.

What do I do?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Changing window size
« Reply #1 on: June 30, 2011, 10:28:42 am »
React to a sf::Event::Resized event and change the view accordingly.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

WiecznyWem

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • http://wiecznywem.co.cc
Changing window size
« Reply #2 on: June 30, 2011, 10:33:15 am »
"change the view accordingly". Sorry, but I do not know how to do it.

Could you give me the code?
And it can not use the sf:: RednerWindow:: Close and sf:: RenderWindow:: Create.

Xander314

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://sfmlcoder.wordpress.com/
    • Email
Changing window size
« Reply #3 on: June 30, 2011, 10:53:04 am »
I think you must do this:
Code: [Select]

sf::View View(sf::FloatRect(X_pos, Y_pos, Event.Size.Width, Event.Size.Height));
Window.SetView(View);

(where X_pos and Y_pos represent the desired coordinates of the top left corner of the view (can probably set to 0.0f, 0.0f if you're unsure).

Read more here:
Tutorial
Documentation

 

anything