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

Pages: [1] 2 3 ... 25
1
For a long time now the Win32 function GetAsyncKeyState has triggered various antivirus programs, as it could be used as a keylogger.
SFML uses GetAsyncKeyState in both isKeyPressed and isMouseButtonPressed.

2
Audio / Re: Wrong openFromFile Mangling
« on: March 23, 2025, 07:18:55 am »
Are you using downloaded binaries of SFML?
The downloads are for MinGW 13.1, but your error message says you are using MinGW 11.2. The version numbers must match exactly.

You could either change your compiler to 13.1, or build SFML yourself using 11.2.

3
General / Re: Visual Studio Default Settings being reset
« on: March 23, 2025, 07:11:02 am »
This is normal. Project settings only exist for the project you set them on, any new project will start off from scratch again.

You can make your own Visual Studio project templates, although it's been around 4 years since I've done that so don't remember the details. But when I did, I had a template that set up everything ready for my SFML based game engine.

4
Audio / Re: Error 0xc0000005 when trying to load wav file
« on: March 08, 2025, 12:54:29 am »
In Visual Studio STL classes have different sizes depending on release or debug build type. For example std::filesystem::path is 32 bytes in release but 40 bytes in debug (extra debug info added). This also happens for strings and other std classes.

So if your program calls a function in a library of the wrong type and the parameters to the function are STL classes (such as SFML's SoundBuffer::loadFromFile taking an std::filesystem::path), then the function's code will see corrupt data.

5
I pasted the code from the top post into my SFML 3 project and it compiles and runs fine, no warnings or errors.
The mouse button event doesn't happen (I haven't looked into why), but window closed and key pressed call the event handler as expected.

The error is saying something is trying to write 1 byte past the end of a 12 byte buffer in the overloadset. Overloadset is part of the handleevent function.

My first guess, are you matching debug or release SFML with the same for your project? Some std classes change sizes in visual studio between debug and release, which could cause something like that above problem.

6
General / Re: Migrating to SFML 3.0 - No sfml-main[-d].lib?
« on: February 17, 2025, 07:01:23 am »
Unlike earlier SFML versions, SFML 3 is provided (and built by default) as static libraries only, not dynamic.
You'll need to change the settings (CMake) and build SFML yourself to get dynamic libraries.

7
Window / Re: Window Poll Event Mechanics
« on: February 01, 2025, 07:59:52 am »
One event can't contain info for several different events. So only one of those ifs will be true for any call to processMenuInputs.

Under the hood, Event::TextEntered happens when SFML receives a WM_CHAR message from Windows. Event::KeyPressed happens when WM_KEYDOWN is received.

When you press a key, the WM_KEYDOWN message is sent. SFML gets it, and calls TranslateMessage (a windows function) which tries to generate a WM_CHAR message and add it to the end of the message queue. So you will always get Event::KeyPressed first, then maybe an Event::TextEntered next time you poll.
(Not all key presses can be converted to text. For example pressing an arrow key or function key won't result in a TextEntered)

8
Graphics / Re: [SOLVED] setTextureRect() not behaving as intended
« on: January 30, 2025, 04:57:23 am »
Strange. Without the size it should be picking this constructor:
explicit Texture(const std::filesystem::path& filename, bool sRgb = false);
But as long as you have it working. :)

9
Graphics / Re: setTextureRect() not behaving as intended
« on: January 30, 2025, 02:50:38 am »
The problem is the last parameter to the texture constructor:
chkIdleText("/Users/me/Documents/Projects/chk/build/bin/chicken_idle.png", false, sf::IntRect({0, 0}, {32, 32}))
The last parameter is which part of the image to load. When you say sf::IntRect({0, 0}, {32, 32}), that means don't load the entire image, just load the first frame. If you make it:
chkIdleText("/Users/me/Documents/Projects/chk/build/bin/chicken_idle.png", false)
then it should work.

10
Graphics / Re: Draw calls for text and performance
« on: January 21, 2025, 12:53:59 am »
If things aren't changing much, you could render rectangles and text into a render texture, then reuse that to render to the screen. This would let you replace any number of draw calls with just 1. But of course if things are moving independent of each other then you'd have to keep regenerating the render texture and lose the benefit.

11
Graphics / Re: [2.6]C# bindings and Text allocation
« on: January 13, 2025, 04:09:48 pm »
I called it a leak but it may be possible that, due to the small size of the strings, the GC never triggers.
I did a memory profile (using a time limited trial of .Net Memory Profiler) of a C# ray tracer I wrote.
What was interesting was that it showed the garbage collector was only triggering when deleted but not collected memory reached around 120MB. Then it would do a garbage collection, and start again. The garbage collector memory usage looked like a saw tooth wave.

So the collection is delayed until the collector thinks it needs to, it will look like a memory leak in between collections.

I was able to double the performance of the raytracer by changing the ray intersect function to use an out parameter instead of a return, which made the garbage collector activate less often. This is because the out parameter overwrote an existing variable while the return meant a temporary object.

12
Graphics / Re: Rendering Indic Scripts Correctly/Ligatures
« on: January 09, 2025, 12:24:26 am »
Does the Pokemon SDK use SFML?
From the repository readme:
"We wrote a graphic engine called LiteRGSS using SFML, which allows a better mastering of the Graphic part of PSDK like adding Shaders, turning some graphic process to C++ side etc..."

13
General / Re: Cannot Compile with Latest Version
« on: January 01, 2025, 02:18:57 pm »
Easiest way to go without caring about cmake is to go to the main sfml download page: https://www.sfml-dev.org/download/sfml/3.0.0/#all-os
On there are prebuilt versions of SFML for windows (visual studio or gcc), linux and macos.
THese archives contain just the headers and libraries. If you set up the include paths and link the libs, it should be possible to build even from just a command line.

The main downside (and the reason the cmake template is usually recommended) is that GCC in particular is very sensitive to version differences. If you aren't using the identical version to the prebuilt libraries, it can fail. The cmake version makes sure everything is built the same. But as long as you use the compiler listed on the download page, it should work.

(Cmake is great to use for cross platform projects. But my personal game things are only for windows, so it gets in the way more than it helps, for my particular use case)

14
General / Re: Cannot Compile with Latest Version
« on: January 01, 2025, 01:13:14 am »
Ah, that's making sense now. The FindSFML.cmake file is coming from the Daylight project, not your install of SFML. Daylight was written for a version of SFML from 11 years ago (I'm guessing SFML 2.1 or 2.0) and provided its own FindSFML.

Generally I don't use SFML in the usual way. I grab the latest source, run cmake-gui (on Windows) over it to build everything, then I copy out the headers and libs and avoid cmake after that, manually linking it into the engine I built. I've never actually used cmake to set up a new sfml project. :) So I can't give much advice on cmake builds on a mac.
The Daylight project doesn't look too big. My guess would be to first get a default SFML project compiling using the tutorial eXpl0it3r linked to for getting started with cmake. Once that's building fine, take the files from the Daylight and add them in. It's going to need changes, SFML 3.0 changed a lot, code from 2.1 or earlier definitely won't work as is.

15
General / Re: Cannot Compile with Latest Version
« on: January 01, 2025, 12:14:47 am »
(A couple of other posts came in while I was writing this, so point 1 already mentioned)
There's a few issues here.
First, it's not a good idea to use the 2.6 tutorial page for 3.0. SFML 3.0 has changed quite a bit and its code isn't compatible. There are tutorials for 3.0 here: https://www.sfml-dev.org/tutorials/3.0/

Second, the FindSFML.Cmake issue. That file was removed from SFML in March 2018. It was part of SFML 2.4 and earlier. So you are actually using an outdated version of SFML.
If you got SFML from Github, you will need to change the branch you are on. The error said you are on SFML 1.x, which is from 14 years ago.
I tried following the linux install step from the 2.6 tutorial and it gave me SFML 2.5. No findsfml was there. (Note:  I did this on an ARM based device, maybe an x64 would give me the right version? I'm not a Linux developer)

Third, you are following a linux tutorial but your screenshot says apple clang. Isn't that part of xcode for macos? I'm REALLY not a mac developer so I could be wrong on that. Maybe one of the SFML tutorials on macos would be more successful?

Pages: [1] 2 3 ... 25