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

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Is there a way to use the windows' default file/folder selector?
« Last post by kojack on March 28, 2024, 06:15:06 pm »
I use Portable File Dialogs: https://github.com/samhocevar/portable-file-dialogs
It's a single header only library that supports windows, mac and linux.
It can do file open/save and folder selection dialogs, plus message boxes and notifications.
2
General / Re: Is there a way to use the windows' default file/folder selector?
« Last post by eXpl0it3r on March 28, 2024, 04:17:51 pm »
No, SFML doesn't offer such a functionality, but there are various libraries that have implemented this in some way or another.

https://github.com/mlabbe/nativefiledialog
https://sourceforge.net/projects/tinyfiledialogs/
3
General / Is there a way to use the windows' default file/folder selector?
« Last post by somevan on March 28, 2024, 03:17:10 pm »
Im currently making a program, about editing json files. Is there a way to open the default windows file selector, and is it possible to make it open folders as well? I haven't found anything about this topic on the internet, so it would be really useful to know. I don't want to use the default WinAPI's choose file window, because it would only work in windows. Thanks in advance!
4
General / Re: Load Font
« Last post by king.randow on March 28, 2024, 12:33:58 pm »
aaahhhh thank you for this. This is working now!

For others that might come across this. Here is what I needed to change:

Go to your project properties -> Linker -> Input -> Additional Dependencies:

For debug configuration:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
sfml-audio-d.lib
sfml-main-d.lib

For release configuration:
sfml-graphics.lib
sfml-window.lib
sfml-system.lib
sfml-audio.lib
sfml-main.lib
5
Graphics / Re: hello. a question about setTextureRect
« Last post by eXpl0it3r on March 28, 2024, 07:20:52 am »
There's no support for GL_CLAMP_TO_BORDER indeed.

I recommend to not stick to texture size and draw a border of your own.
6
General / Re: Load Font
« Last post by eXpl0it3r on March 28, 2024, 07:15:10 am »
Make sure, you're actually linking debug libraries in debug mode (the ones with the -d) suffix.
7
Graphics / Re: hello. a question about setTextureRect
« Last post by kojack on March 28, 2024, 04:11:45 am »
OpenGL has the following texture wrapping modes: GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, GL_MIRRORED_REPEAT, GL_REPEAT and GL_MIRROR_CLAMP_TO_EDGE.
Clamp to edge does what you are seeing, the edge pixels are extended infinitely around the texture.
Clamp to border lets you specify a single colour (like black) to show around the texture.
Repeat makes the texture tile (so it repeats).

SFML however only supports repeat and clamp to edge. It doesn't have clamp to border. (At least in SFML 3, which I'm using).

I don't know if there's an easy way to trick it besides editing texture.cpp to add the border mode in.
8
General / Re: loading/initializing neighbors of a tile in a grid
« Last post by kojack on March 28, 2024, 03:55:16 am »
The problem here is something that a few languages (not just javascript) going to C++ can run into.
Javascript uses references for classes. C++ uses values by default, but can also use references or pointers.

In your Tile class you have: std::vector<Tile> neighbors;
A vector of Tile isn't just references to tiles, it's complete copies of the tiles. So each tile contains a copy of all adjacent tiles, each of which contains copies of their adjacent tiles, and so on. As you process over the map adding neighbors, each new tile is picking up larger amounts of data.

What you'll want to do is have the neighbors either as an index (1d or 2d) that can look up the specified tile, or pointers to tiles. (C++ references aren't like in other languages, they wouldn't fit here as well as a pointer would)
9
As an example of collision, you could take a look at:
https://github.com/SFML/SFML/wiki/Source%3A-Rectangular-Boundary-Collision

If you feel that it doesn't already do for you the collision that you need, it at least shows an example of how to get the points of a rectangle (using local points and its transform) as well as using an inverse transform to convert into local co-ordinates of a different shape.

This helps. I think they are doing what I was planning to do or something very similar. Thank you!
10
No, they're axis aligned.

If you want to get the rotated points, you can get the local bounds and apply the transformation as you've shown on each point of the sf::Rect. Which still provides a better guarantee than deciding on a specific order of the index.

Ohh okay. I am still pretty new to SFML thank you!
Pages: [1] 2 3 ... 10