SFML community forums
Help => Graphics => Topic started by: Don Andy on June 06, 2008, 03:42:28 pm
-
Since I'm working on a rather small pixel-scale, sharpness is very important, so I already set "SetSmooth" on false for the image.
However, when moving the thing around with
if (App.GetInput().IsKeyDown(sf::Key::Left)) spr_hero.SetLeft(spr_hero.GetLeft() - 100 * ElapsedTime);
It often gets blurry and stretched, depending on how it stops. I think this has something to do with the positioning using floats. I'm not sure how to fix it, though and would appreciate any help.
-
Well ,I guess there is no such thing as help
(btw.. I noticed, that the edges of the screen are more blurry than the center °_o) you can try this out, by taking a random pixelmap and sho it.
(every pixel got a random lightness between 0 and 0xff)
I wonder why? (does SFML use some kind of render to texture to display all the stuff?? -> posteffects??) P.S. there where no Post effects activated in this testcase
greetz tgm
-
I think this has something to do with the positioning using floats
In this case, using integer coordinates should solve the problem.
(btw.. I noticed, that the edges of the screen are more blurry than the center °_o) you can try this out, by taking a random pixelmap and sho it.
(every pixel got a random lightness between 0 and 0xff)
What the hell are you talking about ? :lol:
-
In this case, using integer coordinates should solve the problem.
Uhm, yeah, that's the thing. I've gotten a bit rusty with C++ and wanted to get back into the whole thing with the help of SFML.
Do I need to rewrite the sprite class to use integers instead of floats?
It's probably something incredibly simple again <.<
-
In this case, using integer coordinates should solve the problem.
Uhm, yeah, that's the thing. I've gotten a bit rusty with C++ and wanted to get back into the whole thing with the help of SFML.
Do I need to rewrite the sprite class to use integers instead of floats?
It's probably something incredibly simple again <.<
No. You just need to cast any position data sent to the sprite class to ints.
-
Sorry if I sound stupid or anything, but can anybody tell me what I'd need to do with
if (Window->GetInput().IsKeyDown(sf::Key::Left)) Sprite.SetLeft(Sprite.GetLeft() - 100 * Window->GetFrameTime());
to make it work with integers? I think I've pretty much tried every possible combination of typecasts, but this isn't quite working as I want it to >.<
-
If you move your sprite (btw. isn't there a Move() function?) depending on the frametime, a constant movement is rather not propable.
-
Well, I did it like it was described in the tutorial :/
If there is a way to keep a constant framerate and use a technique of movement that does not stretch and blur my sprite I'd gladly take it.
-
Sprite.SetLeft(floor(...));
Sprite.SetTop(floor(...));
-
Aah, thanks a bunch.
-
What the hell are you talking about ? :lol:
öhm.. draw a sprite with some iregular high contrast pattern (1 px checkboard for example) and you'll notice some focal blur effect in the edges of the Renderwindow...
-
öhm.. draw a sprite with some iregular high contrast pattern (1 px checkboard for example) and you'll notice some focal blur effect in the edges of the Renderwindow...
Do you have a perfect 1:1 pixel match between your window and your 2D world ? If not, the blur effect is not surprising.
-
yeah.. I think so..
simply using a normal rendering window, and drawing a 800x600 (for example) sprite without changing anything about scale etc..
-
Ok, I'll do some tests.