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

Recent Posts

Pages: [1] 2 3 ... 10
1
Graphics / Re: How do I disable font smoothing?
« Last post by Hapax on May 02, 2024, 11:09:21 pm »
If you downloaded SFML from the Download page of SFML's website, you are downloading pre-built binaries. That is, all the CPP files have been compiled already so the source CPP files are no longer necessary.

If you want to modify the code, you'll need to build that code yourself after your modification.
The source code for version 2.6 (the "latest stable version") is here:
https://github.com/SFML/SFML/tree/2.6.x
(note that it contains Font.cpp)

If, however, you'd like to try using the most recent version that is currently in development (version 3), you can get the code here:
https://github.com/SFML/SFML/tree/master

If you use GitHub, you can also fork the repository and modify it in your own version.

sf::Font's setSmooth should be available in both v3 and also v2.6.1. Are you using an older version as it appears it might not have been available in v2.6.0. (see here)
2
To check if two (non-rotated) rectangles are intersecting, you can use Rect's intersects function (SFML 2 only; for SFML 3, you'll need the findIntersection function).

For example:
const sf::Vector2f rect1TopLeft{ 100.f, 100.f };
const sf::Vector2f rect1Size{ 200, 200.f };
const sf::Vector2f rect2TopLeft{ 200.f, 200.f };
const sf::Vector2f rect2Size{ 200, 200.f };
const sf::FloatRect rect1{ rect1TopLeft, rect1Size };
const sf::FloatRect rect2{ rect2TopLeft, rect2Size };
bool isRect1CollidingWithRect2{ rect1.intersects(rect2) };

It's a pretty simple function and you can do something similar yourself by comparing the edges: the right side of the leftmost rectangle must be past (more to the right than) the left side of the rightmost rectangle and/or the bottom side of the topmost rectangle must be past (lower than) the top side of the bottommost rectangle.

If you'd like to use rotated rectangles, there is a short simple function that can do that for you too:
https://github.com/SFML/SFML/wiki/Source%3A-Rectangular-Boundary-Collision
Obviously, it works on non-rotated rectangles too!
3
Graphics / How do I disable font smoothing?
« Last post by Twenty on May 02, 2024, 10:31:17 pm »
Hi, I know that there's been one hundred thousand posts about this issue before, but I couldn't find anything helpful, so I'm writting my post.

The issue is well known: if you try to use small (pixel) fonts, SFML tries to smooth characters. Which looks ugly when it comes to pixel games. How do I disable font smoothing?

I tried to find the solution myself, but nothing worked.

The first way was modifying Font.cpp and changing FT_RENDER_MODE_NORMAL to FT_RENDER_MODE_MONO. It didn't work because I couldn't find Font.cpp. I mean, I know it's kind of weird, Font.cpp must be somewhere in the SFML folder, but I can't find it whatsoever! cpp's are usually stored in the folder called src, but I didn't find even that. I thought something happened to my folder and I downloaded the archive from this site, but even it didn't contained Font.cpp

The second option was using sf::Font::setSmooth(bool).
But my compliler said it wasn't an option:
4
System / Re: Fail to Build Project
« Last post by eXpl0it3r on May 02, 2024, 04:23:27 pm »
Make sure your configuration is for the correct compiler architecture (Win32 vs x64) and config (Debug vs Release). Note how no SFML libraries are listed above.

Also don't delete %(AdditionalLibraryDirectories) from the Additional Library Directory, otherwise the linker might fail to find system libraries.
5
System / Re: Fail to Build Project
« Last post by Kruznova on May 02, 2024, 03:58:48 pm »
I've checked tutorial again and there was no mistakes.

Build gave me this:
Build started...
1>------ Build started: Project: yes2, Configuration: Debug Win32 ------
1>Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30146 for x86
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>cl /c /I"D:\SFML\SFML-2.6.1\include" /ZI /JMC /W3 /WX- /diagnostics:column /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /permissive- /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /external:W3 /Gd /TP /analyze- /FC /errorReport:prompt Source.cpp
1>Source.cpp
1>C:\Users\artio\source\repos\yes2\yes2\Source.cpp(32,15): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
1>C:\Users\artio\source\repos\yes2\yes2\Source.cpp(75,67): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\artio\source\repos\yes2\yes2\Source.cpp(99,47): warning C4244: 'argument': conversion from 'const int' to 'float', possible loss of data
1>C:\Users\artio\source\repos\yes2\yes2\Source.cpp(99,35): warning C4244: 'argument': conversion from 'const int' to 'float', possible loss of data
1>Microsoft (R) Incremental Linker Version 14.29.30146.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>"/OUT:C:\Users\artio\source\repos\yes2\Debug\yes2.exe" /INCREMENTAL "/ILK:Debug\yes2.ilk" "/LIBPATH:D:\SFML\SFML-2.6.1\lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG "/PDB:C:\Users\artio\source\repos\yes2\Debug\yes2.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\artio\source\repos\yes2\Debug\yes2.lib" /MACHINE:X86 Debug\Source.obj
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
1>Done building project "yes2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
6
System / Re: Fail to Build Project
« Last post by eXpl0it3r on May 02, 2024, 03:51:13 pm »
Double check the config with the tutorial, you must have done some mistake somewhere to get the shown error output.

Provide the verbose build output, so we can see the complete configuration: https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide
7
System / Re: Fail to Build Project
« Last post by Kruznova on May 02, 2024, 03:12:01 pm »
I linked it in project properties

C/C++ » General » Additional Include Directories   D:\SFML\SFML-2.6.1\include
Linker » General » Additional Library Directories     D:\SFML\SFML-2.6.1\lib
Also I've added Additional Dependencies    sfml-graphics.lib, sfml-window.lib and sfml-system.lib
8
System / Re: Fail to Build Project
« Last post by eXpl0it3r on May 02, 2024, 03:06:19 pm »
How are you linking SFML?
9
System / Re: Fail to Build Project
« Last post by Kruznova on May 02, 2024, 02:57:31 pm »
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <cstdlib>
#include <ctime>
#include <iostream>

That's what I am including in this file nothing more
10
System / Re: Fail to Build Project
« Last post by eXpl0it3r on May 02, 2024, 02:55:20 pm »
Are you #include-ing the lib file instead of a header file?

You need to provide more information on what you're doing in order for us to help and not just make random guesses.
Pages: [1] 2 3 ... 10
anything