SFML community forums
Help => Window => Topic started by: reDo on June 05, 2011, 11:32:01 am
-
I used this command, but it creates windows with 111 and 200
sf::RenderWindow App(sf::VideoMode(100, 200, 32), "Eye");
Where can be problem?
(http://i53.tinypic.com/anzbpy.jpg)
-
How do you know that the width is 111?
-
Because I measured it, here is example to show, what am I doing wrong please?
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow App(sf::VideoMode(100, 200, 32), "Eye");
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
App.Clear(sf::Color(64,64,64));
App.Draw(sf::Shape::Circle(100, 10, 5, sf::Color(128,255,0)));
App.Display();
sf::Sleep(0.025f);
}
return EXIT_SUCCESS;
}
(http://i54.tinypic.com/21eda9x.jpg)
-
There's nothing wrong with your code, actually.
-
but why has the windows width 111 and no 100 like I want?
-
Are you counting the borders too?
-
no, you can see the problem picture, there I draw circle on x 100 but it is not on good position
-
but why has the windows width 111 and no 100 like I want?
I don't know.
-
I thought someone will know when here are more experienced users :( and you are SFML developer.
-
I'm sorry but this is really strange. It's a very basic thing, and nobody had experienced this bug before you.
What happens if you use a different size? Is the real size always greater by 11 pixels? What is your OS? Do you use SFML 1.6?
-
OS: Windows XP SP3, SFML 1.6, CodeBlocks - MinGW,
window x 110, real x 111
window x 20,real x 111
y works good (I tried it with 20 and it works fine), it looks like some limit or something
-
window x 20,real x 111
Width is always 111 ?!
-
window x 120, real 120 so I think only when window width is equal or less than 111
-
Oh, ok I see. That's the minimum window width that the OS allows, so that the icon and buttons can fit in the title bar.
-
So I cannot do anything with it? because I want window's width 100 pixels
-
I think there's nothing you can do, nobody can create a smaller window.
You can try to remove the maximize and minimize buttons (if you want a 100 pixels wide window you probably don't want users to be able to resize it anyway, right?), and maybe the OS will allow the window to be smaller.
-
Yes, you are right, thanks for all
-
Remove the border ? (sf::Style::None)
-
Yes, I did it and it works, only difference is I used 0 instead of None, thanks Laurent and Hiura a little bit too :)
-
Well, 0 might work now but
- this is not guaranteed in the future (if Laurent change the order of the enum for example);
- None is much more readable/meaningful/...
:wink:
-
Yes, you are right so I use None like you mentioned :D