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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - crgimenes

Pages: [1]
1
Graphics / Outside Visual Studio screen goes black
« on: November 04, 2011, 04:40:02 pm »
I solved the problem.

In my game engine is a boolean variable that tells whether the object will be drawn or not.
And I forgot to initialize this variable in the constructor of my class.

It is the most basic of all the commandments, initialize all variables.

2
Graphics / Outside Visual Studio screen goes black
« on: November 04, 2011, 02:03:14 pm »
when I say "outside of Visual Studio" I mean:
I compile the executable, so I copy the exe file from release folder to the correct folder and finally I run the program, the images are loaded correctly, I can see it because otherwise the program would not load.

Code: [Select]

sf::Image player;
if (!player.LoadFromFile("textures\\player.png"))
{
std::cout << "erro textures\\player.png" << std::endl;
exit(1);
}


The path is dynamic but I am absolutely sure that the images are being loaded.

3
General discussions / have fast moving sprites without distortion?
« on: November 04, 2011, 10:31:47 am »
maybe I really need glasses ... :(

Anyway the problem continues, I optimize my code as much as I could. The FPS is above 1200 with vsinc disabled.

I'm worried because there will be a much larger amount of sprites on the screen when the game been completed.

4
Graphics / Outside Visual Studio screen goes black
« on: November 04, 2011, 10:19:39 am »
Any image that I remove everything works. But what intrigues me is that the same binary (compiled in release mode) works correctly in the visual stidio and does not work out of it.

5
Graphics / Outside Visual Studio screen goes black
« on: November 01, 2011, 02:59:55 pm »
Hello everyone.

My game runs inside Visual Studio without problems. But when I try to run the same binary outside Visual Studio, textures do not appear and the screen goes black. The textures are loaded and the path is correct but do not appear on the screen.

So I tried to remove some textures and everything work ok, inside and outside of Visual Studio, them I put the textures back again and the problem appears.

I did all the tests in release mode.

am I running into some limit or have a configuration that I should adjust?

6
General discussions / have fast moving sprites without distortion?
« on: October 27, 2011, 06:50:59 pm »
Hi Disch, thanks for the reply.

VSync makes the jump stop. But I still have problems with the sprites. They are not clear, as if there was not time to clear the old position of the sprite on the screen before drawing the new position. it makes you see multiple sprites at the same time especially when the ball is moving vertically. When it is moving horizontally it looks blurred.

Is there anything else I can do to solve or alleviate this problem?

7
General discussions / have fast moving sprites without distortion?
« on: October 26, 2011, 01:46:22 pm »
Quote from: "Fkscorpion"

Put away the comment slashes?


Yes, of course.
I did several tests trying to solve the problem with and without these lines.

I understand that Clear() is not necessary since the backgroud image is covering the whole screen, but I tested with it too.

With UseVerticalSync(true) I could see the framerate drop to about 60 as expected.

And it's the same thing with SetFramerateLimit(60), I tried several values ​​trying to reduce the problem but without success.

When I move the sprite slowly everything seems fine, but if I go up the force_x or force_y above 600, the problem appears, and I need 1800 :(

I think it's a hardware limitation, the monitor may simply not fast enough. But I need to make sure I'm not doing anything wrong before saying this to the boss.

8
General discussions / have fast moving sprites without distortion?
« on: October 24, 2011, 06:25:14 pm »
Hello guys.

I made a small example to demonstrate the problem.

The code is much smaller than one created for my project and because of that the FPS is much higher. Yet I keep getting the same problem. I need sprites moving at high speed across the screen but the sprites are not clear.
When I move the sprites at low speed all goes well, but when I accelerate them the problem reappears. I'm afraid that the monitor is not fast enough to redraw the sprites at the speed I need.

I need to know if I'm doing something wrong or if is all right with my code and I have a hardware performace problem.
Also I need to know if there is any way to get around the problem, perhaps using OpenGL directly or by using some trick that I do not know.

The complete project in VisualStudio can be obtained here:
http://dl.dropbox.com/u/15771508/testFPS.zip
If you prefer only the source in C++ use this URL:
http://dl.dropbox.com/u/15771508/main.cpp

here is the source:

Code: [Select]

#include <iostream>
#include <SFML/Graphics.hpp>

int main(void)
{
sf::Event Event;

sf::RenderWindow mainRenderWindow(sf::VideoMode(1280, 768, 32), "test", sf::Style::None);

//mainRenderWindow.UseVerticalSync(true);
//mainRenderWindow.SetFramerateLimit(60);

sf::Image Image;

if (!Image.LoadFromFile("b1.png"))
{
std::cout << "error at LoadFromFile(\"b1.png\")" << std::endl;
}

sf::Image ImageBackground;

if (!ImageBackground.LoadFromFile("bg.png"))
{
std::cout << "error at LoadFromFile(\"bg.png\")" << std::endl;
}

sf::Sprite Sprite;
sf::Sprite Background;

Background.SetImage(ImageBackground);
Sprite.SetImage(Image);

float x = 200;
float y = 300;

float force_x = 1200.0f;
float force_y = 0.0f;


while (mainRenderWindow.IsOpened())
{
//mainRenderWindow.Clear();

float Framerate = 1.0f / mainRenderWindow.GetFrameTime();
std::cout << "Framerate: " << Framerate << std::endl;

//mainRenderWindow.Draw(Sprite);

while (mainRenderWindow.GetEvent(Event))
{
if (Event.Type == sf::Event::KeyReleased && Event.Key.Code == sf::Key::Escape)
{
mainRenderWindow.Close();
}
}

x += force_x * mainRenderWindow.GetFrameTime();
y += force_y * mainRenderWindow.GetFrameTime();

if(x > mainRenderWindow.GetWidth())
{
force_x = (force_x * -1);
x = (float)mainRenderWindow.GetWidth();
}

if(x < 0)
{
force_x = (force_x * -1);
x = 0;
}

if(y > mainRenderWindow.GetHeight())
{
force_y = (force_y * -1);
y = (float)mainRenderWindow.GetHeight();
}

if(y < 0)
{
force_y = (force_y * -1);
y = 0;
}


Sprite.SetPosition( x, y);

mainRenderWindow.Draw(Background);
mainRenderWindow.Draw(Sprite);

mainRenderWindow.Display();
}

return EXIT_SUCCESS;
}


Any suggestions?

9
General discussions / have fast moving sprites without distortion?
« on: October 21, 2011, 07:39:07 pm »
I tried using Clear() on each frame but had no effect on the problem.

I'll try reprodizir the problem with minimal and complete code and send ASAP.

Thank you!

10
General discussions / have fast moving sprites without distortion?
« on: October 21, 2011, 06:48:08 pm »
I enabled UseVerticalSync and experimenting different values ​​in SetFramerateLimit but the problem persists.

It seems that the monitor can not redraw fast enough and the sprites seem to leave a trail a few pixels, as it's not cleaning the old sprite position

11
General discussions / have fast moving sprites without distortion?
« on: October 21, 2011, 06:11:20 pm »
Hello Disch

You mean windows.UseVerticalSync(true) ?

12
General discussions / have fast moving sprites without distortion?
« on: October 21, 2011, 03:22:48 pm »
Hello everyone.

I am new with SFML and I'm having problems moving fast sprites across the screen.

For some reason when I try to accelerate the sprite it begin to truncate and flicking. If I reduce the speed, everything goes smoothly.

Another strange effect that I'm getting is that during the course of the sprite it seems to do some "bumps" by changing the speed at regular intervals.

To move the sprite I'm using:
position x + = speed * elapsed time

I need to learn about best practices and how to have extremely fast moving sprites around the screen without distortion.

Does anyone have any tips or suggestions?

Thanks!

Pages: [1]