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

Recent Posts

Pages: 1 ... 8 9 [10]
91
I guess you can check the source code, but the order is not part of the API and instead is an implementation detail.

If you want to know the specific points, you're better off with getPosition() and getPosition() + getSize().
92
I was looking to get the coordinates of the points of a RectangleShape and saw a post saying you can use rect.getTransform().transformPoint(rect.getPoint(i)) where rect is a RectangleShape and i is the index, but I could not find any information about how the points are in the index. Is 0 the top left point and 1 the top right point and so on or is it something else?

Thank you for any help!
93
General / Re: Final answer for async loading texture ?
« Last post by eXpl0it3r on March 27, 2024, 08:16:09 am »
Yes, OpenGL didn't change. ;D

The recommended way is to load the image data with sf::Image or similar from disk in a separate thread, which is one of the slowest parts, as you do IO and decompression, and then move the image data to a texture in the main thread.
This should speed up things noticeably.

And of course making sure you generally use texture atlases withe texture rect on a sprite, instead of loading many small textures. This will prevent you from having to load and handle many textures and will reduce texture switches, that are a bit expensive.
94
Audio / Re: Help with running the package
« Last post by eXpl0it3r on March 27, 2024, 07:41:26 am »
Make sure you're installing the frameworks that SFML ships with, check the getting started tutorial for macOS.

By the way, g++ on macOS will just point to AppleClang, so you might as well use clang to make it clear what compiler you're using. ;)
95
Graphics / Re: Optimization of hexagon-grid
« Last post by JensTheNewbie on March 26, 2024, 10:52:08 pm »
I have fixed it so thank you very much for the help everyone!
96
Audio / Re: Help with running the package
« Last post by julebell27 on March 26, 2024, 03:37:04 am »
Update: I fixed the library issue but now get this:

dyld[67335]: Library not loaded: @rpath/../Frameworks/vorbisenc.framework/Versions/A/vorbisenc
  Referenced from: <72F2B6C0-2DAE-371C-ADA3-32BBC32ADB2B> /Users/julebell/Downloads/SFML-2.6.1-macOS-clang-arm64/lib/libsfml-audio.2.6.1.dylib
  Reason: tried: '/Library/Frameworks/vorbisenc.framework/Versions/A/vorbisenc' (no such file), '/System/Library/Frameworks/vorbisenc.framework/Versions/A/vorbisenc' (no such file, not in dyld cache)
zsh: abort      ./sfml-app
97
Audio / Help with running the package
« Last post by julebell27 on March 26, 2024, 03:31:56 am »
I'm running the code off of my terminal on my new macbook w/m2 chip

#include <SFML/Audio.hpp>
int main() {
    sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("/Users/julebell/Documents/CantinaBand60.wav")){
        return -1;
    }
    return 0;
}

I am running the following commands from the tutorial:

g++ -c main.cpp -I/Users/julebell/Downloads/SFML-2.6.1-macOS-clang-arm64/include

g++ main.o -o sfml-app -L/Users/julebell/Downloads/SFML-2.6.1-macOS-clang-arm64/lib -lsfml-audio -lsfml-window -lsfml-system

export LD_LIBRARY_PATH=/Users/julebell/Downloads/SFML-2.6.1-macOS-clang-arm64/lib && ./sfml-app

But keep getting this error:

dyld[66727]: Symbol not found: __ZN2sf11SoundBuffer12loadFromFileERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
  Referenced from: <A1CF6C7D-6311-3AB7-BC67-EBB3F2F60BC7> /Users/julebell/24c-128/musical_trees/musical_trees_test/sfml-app
  Expected in:     <no uuid> unknown
zsh: abort      ./sfml-app
98
General / Final answer for async loading texture ?
« Last post by Nafffen on March 25, 2024, 10:20:49 pm »
Hey,
I want to load textures while my application is still running (logic + rendering).
I have been looking for a clear answer and the best I could find was in this topic some years ago :
https://en.sfml-dev.org/forums/index.php?topic=20569.0
It's said it's not recommended. Is it the same in 2024 ?
I don't know much about OpenGL, I have seen topics about internal/external context but not really a clear answer.
What are the best practices ?
Thank you
99
Feature requests / Re: export vertexes from the Shape class
« Last post by wdmitry on March 25, 2024, 01:29:27 pm »
yes so far I think its an overkill. 1000 draw calls work just fine.
also calculating vertex again from shapes is cpu consuming.
100
General / Re: How to share assets between the scenes?
« Last post by eXpl0it3r on March 25, 2024, 11:15:44 am »
Personally, I always recommend using something like a ResourceHolder, that ensure proper life-time of the resources, while ensure that you can easily share it, without having to reload anything.

When sharing between classes make sure you know who the owner is.
From the owner you can then provide access to the resource by passing it as references somewhere else, but you always need to make sure that the life-time is handled correctly.
Pages: 1 ... 8 9 [10]