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

Pages: [1] 2 3 ... 608
General / Re: Accurate globalBounds of circle.
« on: March 19, 2019, 12:40:20 am »
You can calculate the distance between the center point of the circle and the mouse position. If the distance is larger than the radius, it's outside the circle. If it's smaller (or equal) it's inside.

For how to calculate the distance of two points, I suggest to just google that, as it's basic vector math and better explained elsewhere. :)

General / Re: Where to calculate collisions and physics
« on: March 18, 2019, 05:16:00 pm »
Welcome! :)

The general philosophy (with SFML) is to keep rendering (the actual drawing/displaying of stuff) and game logic separated from each other as much as possible.
As such, you'd be doing the physics & collision handling in the update phase.

For your game loop the most important part (as explained in the book) is to do the updating inside the inner while loop. As that one gets executed for as long and as many times as possible, before the next frame should be rendered (see also the famous Fix Your Timestep article).

Window / Re: Rounded SFML window
« on: March 17, 2019, 02:01:46 pm »
SFML doesn't support transparent or special shaped windows.

You could take a look at Texus' Transparent Window class: https://github.com/texus/TransparentWindows

Graphics / Re: Load a white rectangle using Game headerfile
« on: March 17, 2019, 01:59:59 pm »
It's fine to ask questions, I merely wanted to point out that the code and book sections you're looking at were written to solve this exact issue. Not realizing this, makes it seem like you haven't understood the concept behind and may want to go back to understand it before moving on. ;)

Adding static "solves" the issue, but it would be better if you used the resource holder as class member.

Audio / Re: How exactly does SoundFileReaderFlac work?
« on: March 17, 2019, 12:27:42 am »
I didn't really look into your code, but if you double the sample size (16bit -> 32bit) you have to make sure, you're still reading and playing back things correctly.

Also make sure you use the correct sample rate at playback.

General / Re: The file is not created.
« on: March 17, 2019, 12:21:40 am »
Check your anti virus software or any other odd software you're running.
Also make sure you check in the working directory for the file and not at some other location.

Graphics / Re: Load a white rectangle using Game headerfile
« on: March 16, 2019, 05:09:37 pm »
I hope you're also reading the book and are not just copying code, because I'm pretty sure the book explains why you need a resource holder in the first place.
Once you understand why that is needed, you'd also understand why your code defeats the whole point of it. ;)

You create a resource holder instance that is local to the Game() constructor. So right after the texture is loaded, the resource holder is destroyed again and with it, the texture is destroyed and thus the sprite's reference to the texture is broken and renders a white square.

See also the White Square Problem described in the official tutorial: https://www.sfml-dev.org/tutorials/2.5/graphics-sprite.php#the-white-square-problem

Please make use of the edit function next time, instead of adding a new post every few minutes. :)

General / Re: SFML Integration in QTCreator with CMake
« on: March 16, 2019, 09:20:08 am »
Are you using a different compiler as part of the QtCreator (e.g. x86 vs x64 mismatch)?
Are the SFML libraries located at D:\SFML\lib?

Your code obviously creates a memory leak, as you never delete the allocated sf::Text.

My point was more, whether you fully understand what the output says (as I do not) or whether you just see some text and want to "fix" it? ;)

And who says that those are errors? ;)

Just because valgrind (or whatever tool that is), spits out some text, doesn't mean it's actually an issue.
Compiles and runs fine on my end as well, even tried using the font you referenced.

General / Re: Store last key during sleep
« on: March 12, 2019, 12:30:44 pm »
What do you mean with "last key press" and what do you mean with "during sleep"?

See also Read before posting thread on how to write good forum posts.

Window / Re: application generates multiple key release event
« on: March 12, 2019, 08:13:12 am »
I'm sure we could figure it out if you provide a minimal but complete example. ;)

Window / Re: application generates multiple key release event
« on: March 12, 2019, 07:34:25 am »
You get one event through polling, but then you handle the same event for each object and since they all use the same code, you'll get the same message printed n times.

General / Re: Change text if press button
« on: March 10, 2019, 08:46:16 pm »
You change text the same way you set it the first time. If you want to just change part of it, you'll have to do basic string manipulation.

General / Re: loadFromFile always returns false (SFML 2.5.1 64-bit)
« on: March 10, 2019, 12:27:46 pm »
What's the output on the console?
What's your working directory?

Pages: [1] 2 3 ... 608