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

Author Topic: render at 2x?  (Read 2395 times)

0 Members and 1 Guest are viewing this topic.

hagel

  • Newbie
  • *
  • Posts: 23
    • View Profile
render at 2x?
« on: December 24, 2010, 10:14:57 pm »
Hello,
This is a seemingly simple question but anyways, here it goes.
How do I render my RenderWindow at 2x?
e.g. I have a drawing area of 320x240 and draw it all out. Then when actually displaying the drawn stuff I want it to be 640x480.

Allegro has strech_blit. It works like this:
stretch_blit(buffer, screen,0,0,320,240,0,0,640,480);
this streches the buffer(bitmap) with the size of 320,240 pixels to 640,480 pixels and blits it onto screen(bitmap which is displayed).

Is there a way to do this in sfml?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
render at 2x?
« Reply #1 on: December 24, 2010, 10:22:01 pm »
Use a view of 320x240 on a RenderWindow of 640x480.

For example:
Code: [Select]
sf::RenderWindow window(sf::VideoMode(640, 480), ...);
window.GetDefaultView().SetFromRect(sf::FloatRect(0, 0, 320, 240));
Laurent Gomila - SFML developer

hagel

  • Newbie
  • *
  • Posts: 23
    • View Profile
render at 2x?
« Reply #2 on: December 24, 2010, 10:29:58 pm »
Quote from: "Laurent"
Use a view of 320x240 on a RenderWindow of 640x480.

For example:
Code: [Select]
sf::RenderWindow window(sf::VideoMode(640, 480), ...);
window.GetDefaultView().SetFromRect(sf::FloatRect(0, 0, 320, 240));

Laurent, you are damn awesome. 8 minutes for a perfect answer from the administrator.

Thank you very much.