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

Author Topic: How to fit the screen resolution in iOS?  (Read 2297 times)

0 Members and 1 Guest are viewing this topic.

smartly

  • Newbie
  • *
  • Posts: 10
    • View Profile
How to fit the screen resolution in iOS?
« on: October 28, 2014, 03:14:45 pm »
How to fit the screen resolution?

My iphone is 640x1136, but look image in attachment!

my code:

#import <SFML/Main.hpp>
#import <SFML/Graphics.hpp>

void main()
{
    sf::RenderWindow window(sf::VideoMode(640, 1136), "Putao Application");
   
    sf::CircleShape shape;
    shape.setPosition(100, 100);
    shape.setRadius(100.0f);
    shape.setFillColor(sf::Color::Cyan);
   
    while (window.isOpen())
    {
        sf::Event event;
       
        window.pollEvent(event);
        window.clear();
        window.draw(shape);
        window.display();
    }
}
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to fit the screen resolution in iOS?
« Reply #1 on: October 28, 2014, 03:18:12 pm »
And what's the issue?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to fit the screen resolution in iOS?
« Reply #2 on: October 28, 2014, 03:19:34 pm »
You mean it is too big?

Otherwise, something that a lot of people do wrong: The position of the circle is the left-upper corner of the bounding rect and not the circle's center. Set the origin if you need to change this.

And please next time post in the Help/Graphics forum, not in General Discussions.
« Last Edit: October 28, 2014, 03:38:14 pm by Laurent »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to fit the screen resolution in iOS?
« Reply #3 on: October 28, 2014, 03:40:54 pm »
It's a retina screen, right? So I guess that the logical resolution is 320x568, which seems to match your result. So no problem here.

Note that the iOS port doesn't provide explicit support for retina screens yet (ie. rendering at physical resolution).
Laurent Gomila - SFML developer

smartly

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to fit the screen resolution in iOS?
« Reply #4 on: October 28, 2014, 07:20:51 pm »
You mean it is too big?

Otherwise, something that a lot of people do wrong: The position of the circle is the left-upper corner of the bounding rect and not the circle's center. Set the origin if you need to change this.

And please next time post in the Help/Graphics forum, not in General Discussions.
yes, too big, this is 100px ...

thank you, next publish here :)

smartly

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to fit the screen resolution in iOS?
« Reply #5 on: October 28, 2014, 07:23:46 pm »
It's a retina screen, right? So I guess that the logical resolution is 320x568, which seems to match your result. So no problem here.

Note that the iOS port doesn't provide explicit support for retina screens yet (ie. rendering at physical resolution).
OK, thank you, i need real px :)