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 - Perde

Pages: 1 2 [3] 4 5
General / Slow execution on first start.
« on: August 25, 2012, 05:44:41 pm »
[edit] The problem seems to have disappeared after updating to the latest snapshot. Should've thought of that before. While it would still be interesting to know what caused that behaviour, everything seems to work now.

This is something that has been bugging me for a very long time now, but never to a point that made me look for a solution. Whenever I start up a program that uses the SFML for the first time after a fresh boot the execution is terribly slow. I often get around 1fps, or even less.
Then, after ending the program and restarting it again, everything works perfectly fine (every other program that is using SFML works fine after that as well).
After the next reboot of my system however, the whole issue starts again.

It's probably caused by something else than SFML, but only happens with apps using it.
I'm currently using the RC and it's pre-compiled libs. OS is Win7 64 bit, gcc is 4.4.1 if I'm not mistaken.

Would be glad about any hint.

Window / Re: issue with pollEvent in SFML 2.0
« on: August 25, 2012, 05:24:26 pm »
Nevermind. I don't exactly know what happened. It was working properly after doing the change I suggested, but after resetting to your code again it continued to do so.

Btw, when I thought that I could reproduce your problem, I was actually witnessing this:

Graphics / Re: Displaying sub-images?
« on: August 23, 2012, 09:53:29 pm »
But it's not under Sprite either:

Laurent already answered that one. I was refering to 2.0 simply because you linked to it's doc in a previous post.
By the way, as a bloody beginner myself I advise you to stick to 2.0 even though it's "just" a RC for now. Once you wrap your mind around the basics it's absolutely simple to use.

Graphics / Re: Displaying sub-images?
« on: August 23, 2012, 09:13:22 pm »
Texture only seems to be able to load only one portion of the image from file
Where did you get that idea from? sf::Texture::loadFromFile() loads the whole and complete image into memory. I think there's a bit of confusion about the usage of sf::Image, sf::Texture and sf::Sprite. You should definately look that up. (setTextureRect is a member of sf::Sprite btw)

You could always create multiple instances of sf::Sprite that get their information from the same sf::Texture but use different TextureRects. You could as well change the Rect of a single sf::Sprite after drawing and then draw again with the new Rect, and so on. (I've never used any of the 2 methods, but both should work according to my understanding of it.)

Is that what you're talking about?

General / Re: Problem with sf::Clock
« on: August 03, 2012, 04:11:42 am »
Why would you wait for everything to be drawn and displayed before you reset the clock?
You're not doing anything else before getting the time or after resetting the clock, but in between. So this is what happens:

  • getElapsedTime()
  • drawing & displaying
  • clock.reset()
  • nothing else
  • getElapsedTime()
  • ...

You're practically restarting right before getting the time again, and therefore it will take quite a while for frameTime to become >= 1 seconds (if ever, not sure about the details).

But this isn't really relevant since your last snippet is how you should actually do it.
sf::Time elapsedTime = clock.restart();

Window / Re: [SFML 2.0] Why isKeyPressed isn't working immediately
« on: July 28, 2012, 12:24:18 am »
There is no isKeyPressed in sf::Event (IIRC)
There's sf::Event::KeyPressed and sf::Event::KeyReleased. ;)

I don't see how that contradicts my statement.  :P

Window / Re: [SFML 2.0] Why isKeyPressed isn't working immediately
« on: July 27, 2012, 11:28:52 pm »
There is no isKeyPressed in sf::Event (IIRC), but in sf::Keyboard (what you should be using for that sort of thing), which kind of replaces sf::Input from SFML 1.6.
As far as I understand it, events shouldn't be used for that kind of direct input.

SFML projects / Re: [WIP] MMORPG project - recruiting
« on: July 27, 2012, 01:04:35 am »

Since this doesn't add much to the actual topic I will keep this reply short.
I wasn't being rude, I strongly disagreed with what you wrote, there's a difference. And I hope you can accept my apologies if it came out wrong.

I just tried several approaches on how to formulate my reply, but I don't see any end to a discussion on different learning-methods, since they may be as different as the people using them. Reason for my original post was that I always get that slight feeling of annoyance when somebody suggests to better not try something in the first place, that is all.
There's this famous Edison quote about failure, but that would be a bit cheap now, would it?

Feel free to PM me anytime you want, I don't want to be blamed for hijacking this thread.  ;D

SFML projects / Re: [WIP] MMORPG project - recruiting
« on: July 26, 2012, 07:55:39 pm »
What immediately came into my mind: This, this and this.

Good luck. ;)

Nice writing, except "If you are still convinced that you can and want to do it, then by all means go for it!". Don't get me wrong, I don't try to be an ass here (I like that role, but this time I'm serious ;)), but you should rather spend your time on things where you have a bigger chance of success.

I don't know your background and I don't know if you have completed games yet. But one thing is for sure: Every(!) game you complete will give you experience, motivation and the will to do something bigger. Even if it's the 3453478345th Pacman clone of Arkanoid. Complete your stuff, make it a game (with menus, highscores, good code design etc.).

My 2 ct.

Better do something small that nobody will notice than to actually try something big that might fail. Long live the mediocrity!

This is the worst approach to do something new, and even worse than worst (yeah, whatever  :P) for learning anything. You can't make any progress if all you ever do is stay on the same level and do the same stuff over and over again, that others have done before you. The bigger your steps are, the more you will learn. All you need to do is _stick_ to it and accept that failure is a crucial part of learning.

I think I just raged a little inside. No offense though, it's just - like everything else - a mere opinion based on personal experience. ;D

General / Re: Access Violation
« on: July 10, 2012, 12:04:37 am »
If I'm not mistaken your question was already answered in the first reply.

Simply out of curiosity, what's the name of the book you're/you've been using?

and displays the follow error message several times, though NOT as many times as there are points

By saying that, do you mean that you're loading the same file several times?

Someone else might know what your problem is without, but it might help to show how you're loading the image and how you're displaying it.

Window / Re: Calculating Framerate
« on: June 12, 2012, 05:37:12 pm »
Uhm, what? I told you it's in seconds, you want to get the "frames per second", don't you?

No you don't. f = 1/T is the formula to calculate the current framerate based on the time that has passed since the last draw (http://en.wikipedia.org/wiki/Frequency). Using that value to set the framerate limit would make absolutely no sense.
If you want 60 fps you use setFramerateLimit(60), or any other value. If you want to use VSync you use SetVerticalSyncEnabled(true).

 - Documentation and Board-Search.

Window / Re: Calculating Framerate
« on: June 12, 2012, 04:58:17 am »
Keeping track of it:
 - Use a sf::Clock to get the time that has passed since the last draw in seconds.
 - f = 1/T

Controlling it:
 - sf::Window::setFramerateLimit(unsigned int limit)
 - sf::Window::setVerticalSyncEnabled(bool enabled)

 - Documentation and Board-Search.

Graphics / Re: sf::Text bounds not updated
« on: June 02, 2012, 01:53:32 pm »
I will do that, but I have found a solution already. It's not the most elegant, but all I have to do is remind myself of it when this will be fixed/updated.

The problem I had was with the text-input of my gui-system. Whenever the last character got removed the cursor would stay on a wrong position. Now, whenever the string is empty it gets set to the relative position of the control, and not the sf::text bounds anymore.

SFML projects / Re: MyGui - Yet another GUI-System!
« on: June 01, 2012, 01:03:20 pm »
Oh well, the major problem is that my currenct level of programming experience doesn't really guarantee enough reliability of my code. I'm still working on it (mostly optimizing stuff and slimming down the code), and somehow still run in some problems that shouldn't be considered as such.

If I come to a point however where I think it makes sense to make it available I will certainly consider it.

Pages: 1 2 [3] 4 5