Commit Graph

1390 Commits

Author SHA1 Message Date
binary1248
a759ccd5db Enable compiler warnings. 2021-11-30 11:25:58 +01:00
Anton Vasiliev
7fc026e3ec Add missing comment
Added missing comment to WM_DEVICECHANGE event in Window
implementation for Win32.
2021-11-30 09:52:35 +01:00
Vittorio Romeo
ef8fee5356 Simplify management of ActivityStates 2021-11-24 00:34:03 +01:00
Vittorio Romeo
dc88cbd81e Remove include directives for unused headers 2021-11-22 00:47:11 +01:00
Vittorio Romeo
c21e842007 Fix useless temporary sf::Lock 2021-11-19 23:17:14 +01:00
jqdg
2888d9c56e Improve high DPI handling on macOS 2021-11-18 21:34:07 +01:00
Corentin Schreiber
912422f486 Partial revert from 40a0584636dab89f3fa1747e63f26fa895036ce1
This reverts the change to addLine(), which no longer had its
outline drawn after the offending commit.
2021-10-25 22:47:32 +02:00
Corentin Schreiber
d950c9387a Simplify glyph advance calculation
Since auto-hinting is enabled, the advance will always be an integer
number of pixels. The actual fractional advance is handled by bearings.
https://github.com/SFML/SFML/pull/1827#issuecomment-939531582
2021-10-18 09:46:35 +02:00
Corentin Schreiber
4d2e5b18e2 Fix incorrect glyph rect for text outline 2021-10-18 09:46:35 +02:00
jqdg
3b1ff125b0 Code style and comments 2021-09-15 13:15:50 +02:00
jqdg
85e72faf5e Delete unnecessary message when closing window integrated in an NSView 2021-09-15 13:15:50 +02:00
jqdg
c80cbb9c97 Change handling of NSAutoreleasePool
GUI toolkits such as wxWidgets and Qt provide their own NSAutoreleasePool
objects. To avoid pool corruption, it is required that the pools be nested,
which the previous implementation did not guarantee. Furthermore, autorelease
pools should always be drained in the same context (function, loop, etc.) that
they are created, which was not the case with the previous implementation
(https://developer.apple.com/documentation/foundation/nsautoreleasepool).

This commit removes long-lived autorelease pools, and instead each function that
calls into the Cocoa API creates its own autorelease pool (using the new C++
AutoreleasePool wrapper object).

Should fix crashes in issue #1549 and similar.
2021-09-15 13:15:50 +02:00
Herman Semenov
c90d308b45 Fixed funcs for safe use in Win32/Win64
Signed-off-by: GermanAizek <GermanAizek@yandex.ru>
2021-08-18 19:32:58 +02:00
StrikerX3
ee8c4fdcda Use native Windows cursors to preserve the drop shadow 2021-08-13 00:51:01 +02:00
jqdg
86617c0550 Fix zombie windows in Mac OS when switching to/from fullscreen 2021-08-12 23:19:13 +02:00
jqdg
7ff34cdc86 Process Cocoa events after window close
Workaround issue where the window remains open if events are not
processed.
2021-08-12 23:19:13 +02:00
Vittorio Romeo
f162b3a037 Enable support for unity builds 2021-08-12 21:00:16 +02:00
Chase Warrington
47a4e88704 Try more possible names for OpenGLES library. Fixes SFML/SFML#1687 2021-08-09 18:16:37 +02:00
Guillaume Bertholon
1f21e5497b Control GL_FRAMEBUFFER_SRGB flag in RenderTarget
This fixes wrong rendering for RenderTexture that need sRGB encoding along a
non-sRGB window.
We cannot simply always enable GL_FRAMEBUFFER_SRGB because some drivers
enable sRGB encoding on non-sRGB window surfaces.
Also add a isSrgb() method to tell if a RenderTarget is encoding into
sRGB color space.
2021-05-11 16:52:55 +02:00
Guillaume Bertholon
ade4a3912a Support sRGB color space in RenderTexture
When the sf::ContextSettings asks for an sRGB capable buffer, set the
rendered image to sRGB mode and convert pixels when drawing.

This is the choice of simplicity compared to actually support textures
with more color depth.
2021-05-11 16:52:55 +02:00
Lukas Dürrenberger
9e27096c37 Fix configuration conflicts with Clang
- On Windows you can use Clang with both MSVC and MinGW
- When using Clang with MSVC all the MSVC conditions should be fulfilled
- When using Clang with MinGW all the MSVC steps should not be run
2021-05-10 12:20:48 +02:00
Lukas Dürrenberger
2b79ae96d9 Fix OpenGL context on Android
When waiting for an event, rather then polling, the android
looper prevents the creation of a OpenGL context till ALooper
receives an event rather then allowing creation at the appropriate time
2021-04-29 21:16:06 +02:00
acsbendi
20c23f0007 Fixed WindowImplAndroid used after deleted. 2021-04-29 21:07:08 +02:00
Guillaume Bertholon
f3a180bc09 Fix sf::Context::getActiveContext to stop returning inactive contexts
sf::Context::getActiveContext could return an inactive context if
RenderTargets activation occured since the last sf::Context activation.
This is not what its documentation suggest, and was clearly an
unexpected behaviour.

This fix make the function return NULL if the current active context is
not managed by sf::Context (e.g. because it is a RenderTarget).
2021-04-26 16:31:12 +02:00
Mozzg
ce992ee01f Fix overflow when calculating time value for Clock 2021-04-15 09:06:42 +02:00
binary1248
43b2e9dc12 Fixed regression introduced in 4fcef89 causing EXT_texture_edge_clamp support to not be considered, added explicit initialization of nbFormats to 0 in WglContext.cpp in order to prevent broken graphics drivers from filling nbFormats with a garbage value.
Fixes #1786.
2021-04-14 11:04:45 +02:00
Vittorio Romeo
c0b19109a9 Fix incorrect standard includes in 'InputSoundFile' and 'Music' 2021-04-13 10:21:11 +02:00
Jonny Paton
b29cb44fad Keep existing cursor type if requested type fails 2021-04-13 10:02:15 +02:00
Jonny Paton
f4844c11f8 Fix potential crash when changing cursor - don't release the NSCursor object if it's already been released 2021-04-13 10:02:15 +02:00
Vittorio Romeo
9541719893 Fix ordering of 'sf::Font' members in 'Font.cpp' 2021-04-12 13:28:00 +02:00
binary1248
eaeb977700 Relax the requirement to provide geometry shader support to accept a 3.2+ compatibility context as well. While the compatibility profile functionality is not 100% identical to the EXT/ARB functionality, the extent to which SFML makes use of geometry shaders should not pose any serious problems to a developer who is aware of the subtle differences. The current geometry shader example already requires GLSL 1.50 which was only available in OpenGL 3.2+. (Closes #1768) 2021-03-28 19:26:16 +02:00
binary1248
4fcef893c9 Updated glad loader to OpenGL 4.6 Compatibility Profile as base and added version support defines to GLExtensions.hpp. 2021-03-28 19:26:16 +02:00
Guillaume Bertholon
05c83617de Add Min and Max blend modes 2021-03-23 21:09:53 +01:00
Jon Keller
788ac2ecf5 MacOS: When initializing an openGL view with a parent window, call finishInit 2021-03-20 22:36:19 +01:00
Radek Dutkiewicz
88451a0740 Fixed naming convention mistakes 2021-02-11 00:40:30 +01:00
Radek Dutkiewicz
e7ae462c82 Fixed formating mistake 2021-02-11 00:40:30 +01:00
Radek Dutkiewicz
84e0a25e04 Fixed unnecessary loadGlyph() calls
getKerning() now passes the bold flag to getGlyph() function, so already cached glyph can be used.
2021-02-11 00:40:30 +01:00
Radek Dutkiewicz
165b715d02 Fixed unintialized variable 2021-02-11 00:40:30 +01:00
Radek Dutkiewicz
f76f0607c7 Fix for fonts with no kerning tables
Apply deltas even if the font has no kerning table
2021-02-11 00:40:30 +01:00
Radek Dutkiewicz
7a0c35c334 Added glyph position compensation after autohinting
This improves glyph spacing by subtracting glyph position deltas from glyph advance generated by forced autohinting
2021-02-11 00:40:30 +01:00
fgallegosalido
54204058a4 Fixed copy assign operator in sf::Sound so it checks for self-assignment 2021-01-18 07:50:45 +01:00
Sevag Hanssian
0ef9647589 Fix NULL in Android EGL_DEFAULT_DISPLAY 2021-01-14 16:40:21 +01:00
hobby8
e85ed33fb2 Fixed Win32 requestFocus in multithreaded environment 2021-01-14 09:46:07 +01:00
Eren121
d29c51d82b Fix warning: control may reach end of non-void function [-Wreturn-type]
Fix warning and/or bug in androidKeyToSF() adding a default label for all keys _Keyboard::Unknown_
2021-01-14 09:44:00 +01:00
vfjpl
b939c794fb Don't needlesly call getSize() twice while setting texture 2021-01-14 09:40:21 +01:00
vfjpl
aa81cae6cf [sprite] don't set default rect before the user provided one 2021-01-14 09:40:21 +01:00
acsbendi
808adedf13 Replaced all reinterpret_casts with memcpys when reading from Packet. 2021-01-14 09:24:42 +01:00
acsbendi
1d1415c982 Avoid unaligned memory access when reading floats and doubles from Packet. 2021-01-14 09:24:42 +01:00
swordfatih
498d7ee79c Update the copyright year to 2021
Just updating all the 2020 references to 2021. 😄
2021-01-06 20:21:36 +01:00
Franckltung
0535e322d4 Fixed setMouseCursorGrabbed 2021-01-06 13:11:59 +01:00
GermanAizek
9029118536 Refactor code and declaration more local 2021-01-05 20:46:22 +01:00
binary1248
a262636590 Fixed joystick POV values not being set properly for devices that are accessed via DirectInput. 2020-12-28 17:48:24 +01:00
David Carlier
4cbb34ddb4 NetBSD support proposal. 2020-12-07 16:08:00 +01:00
Jan Haller
d1f4db39c8 Link legacy_stdio_definitions.lib on newer MSVC -- fixes linker errors for sprintf() & Co.
Starting from Visual Studio 2015, some standard symbols are inlined and thus no longer linkable.
Code that was linked against earlier versions can use a compatibility library, as described here:
https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-160#libraries
2020-12-06 13:35:00 +01:00
Arthur Caputo
129774877b Implemented saveToMemory and saveImageToMemory. 2020-12-03 20:12:27 +01:00
Marukyu
c11ea7792f Round sample offset when seeking InputSoundFile
This fixes a bug that caused `sf::Music` to cease looping after certain
seeks due to the sample offset misaligning with the sound file's channel
count.
2020-12-03 20:12:06 +01:00
Bruno Van de Velde
7b84e46fac Added support for directional arrow resize cursors on Linux 2020-11-29 21:22:45 +01:00
Jonny Paton
59df9d0d88 Implement smoothing for fonts 2020-09-20 19:17:11 +02:00
Corentin Schreiber
a96057866d Removed explicit link to Xcursor and rely on X11 interface target
Co-authored-by: binary1248 <binary1248@hotmail.com>
2020-09-13 20:35:48 +02:00
Corentin Schreiber
77145c130f Fixed bug of spurious vertical white lines with monochrome cursor 2020-09-13 20:35:48 +02:00
Corentin Schreiber
a2fde65113 Simplified and clarified code for monochrome bit/byte computations 2020-09-13 20:35:48 +02:00
Corentin Schreiber
9cb67520c7 Fixed black/white threshold computation for Unix monochrome cursors 2020-09-13 20:35:48 +02:00
Corentin Schreiber
d93cd6dd30 Fixed Unix monochrome cursor implementation with non-power-of-two images 2020-09-13 20:35:48 +02:00
Corentin Schreiber
603bc9ee41 Changed code formatting to follow SFML guidelines 2020-09-13 20:35:48 +02:00
Corentin Schreiber
54ac286a67 Added support for colored cursors in Unix implementation 2020-09-13 20:35:48 +02:00
Corentin Schreiber
fc573bc584 Added Xcursor to linux dependencies 2020-09-13 20:35:48 +02:00
Lukas Dürrenberger
9b596cc8d9 Update the copyright year to 2020 2020-09-12 19:34:34 +02:00
Bruno Van de Velde
241b542ca3 Added XFlush call to WindowImplX11::setMouseCursor 2020-07-22 22:45:56 +02:00
binary1248
3557c46ae6 Add support for buffered DirectInput data to reduce polling load when it is supported. Only attempt setting a DirectInput device's axis mode if the device reports having axes and its axis mode is not already set to absolute. If the axis mode still can't be set to absolute, blacklist the device so that any future attempts will abort early. This should help when dealing with broken device drivers that report being game controllers and not fully supporting game controller functionality. 2020-06-18 18:12:36 +02:00
scotth
95c98093e9 Adjustable processing interval in SoundStream #1517
Resurrection of previous PR with updated documentation. Added setter to
adjust processing interval in SoundStream for low-latency streams.
2020-06-18 17:36:59 +02:00
43187455e4 Added Font::hasGlyph() 2020-05-20 16:12:41 +02:00
Michal Marszalek
632a015663 Added readCurrentReadPosition in sf::Packet 2020-02-06 22:29:19 +01:00
Jan Haller
110fb75513 Rename FindVorbis -> FindVORBIS, for consistency with exported variables (e.g. VORBIS_FOUND)
Fixes #1626
2020-01-02 15:28:31 +01:00
binary1248
bf98acc61f Force OpenGL states to be reset when RenderTarget detects that a new context has to be tracked. In the case a context is re-created, FBO RenderTextures would not trigger resetting of the OpenGL states if they were drawn to first since re-initialization of the RenderTarget only happens when a context owner such as a RenderWindow is re-created. Fixes #1625. 2020-01-02 15:27:20 +01:00
Mario Liebisch
a1d4bc80c2 Changed Doxygen single-line comment format
Single line comments starting with `///` are interpreted by
Microsoft Visual Studio as documentation containing XML code.

Therefore single line comments starting with `///<` unfortunately
cause a parsing error, as IntelliSense will assume the `<` is the
start of an XML tag. This is not the case, but unfortunately,
IntelliSense will still complain about the following space
character rather than displaying the raw string. This commit alters
all such comments to start with `//!<` instead, which prevents the
issue.

This fixes issue #1622.
2020-01-02 15:25:57 +01:00
Radek Dutkiewicz
6a79ebf1b3 Fixed text rendering artifacts on Radeon cards, revised.
Reverted the padding used for drawing to 1.0 and increased the padding during glyph generation instead.
2019-10-29 20:15:39 +01:00
Radek Dutkiewicz
689f468e36 Fixed text rendering artifacts on Radeon cards.
Padding set to 1.0 was causing adjacent glyphs leaking on Radeon cards. The initial padding value for glyphs was too high anyway, the proper value should be 0.5 on each side.
2019-10-29 20:15:39 +01:00
binary1248
6272f853c1 Add support for creating Vulkan window surfaces. 2019-10-16 21:48:24 +02:00
Sztergbaum Roman
8886134156 fix(compilation): clang compilation on windows
When using LLVM-clang on Windows which share the same ABI as `MSVC` (that means clang is able to use MSVC compiled DLL)

the CMake library path was not updated resulting on not finding dependencies.

Command line: `cmake -G "Visual Studio 16 2019" -A x64 -T "ClangCl" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" ../`

Can be great to add it to CI on appveyor too.
2019-10-13 23:21:25 +02:00
Lukas Dürrenberger
2eb70c6537 Replaced glLoadGen loader with glad loader and dynamically load EGL and GLES extensions as is done for desktop GL. 2019-09-12 23:02:52 +02:00
binary1248
f2b8e6397b Remove the glFlush() call that became unnecessary after 3871e01a9f was merged. This also fixes glFlush() being called in a state in which no context would be active in specific use cases. 2019-09-04 15:26:38 +02:00
acsbendi
ea71dd2fe0 Fixed navigation bar not being entirely hidden. 2019-09-03 14:21:06 +02:00
binary1248
81a1da6a59 Revert "Added a VertexBuffer implementation to all Drawables that were rendered via VertexArrays."
This reverts commit 4dfad062e4.
2019-09-01 18:20:13 +02:00
Jonny
b00317e90c Initialise m_context correctly in SFContext constructors 2019-09-01 17:40:57 +02:00
Benjamin Porter
86672a3724 Fix: Win32 no longer hides cursor when hovering title bar, keeping in line with behaviour of other platforms. 2019-03-17 15:51:06 +11:00
binary1248
4043f71156
Fixed missing checks for empty vertex arrays when updating the vertex buffers in sf::Text. (Fixes #1558) 2019-02-20 20:26:23 +01:00
binary1248
4dfad062e4 Added a VertexBuffer implementation to all Drawables that were rendered via VertexArrays. 2019-02-19 10:05:59 +01:00
Mario Liebisch
0980e90ee4 Fixed potential buffer overrun in Win32 OpenGL error handling
This fixes issue #1245.
2019-01-23 15:27:40 +01:00
Tobias Widlund
bf92efe9a4 Remove usages of std::auto_ptr to get rid of warnings when building with
gcc 8.2+
2019-01-23 15:25:34 +01:00
Ceylo
82c2f4c05e All mobile-compatible examples now successfully link 2019-01-19 01:29:12 +01:00
hobby8
7e40f80f52 Fix OpenGL extensions not loading 2019-01-15 23:55:31 +01:00
EpicCoder
489482a630 Updated the copyright year to 2019 2019-01-08 08:53:33 +01:00
binary1248
ae337952a9
Allow creation of a window without an OpenGL context in order to support use cases where the user wants to render using other graphics APIs. 2019-01-05 23:22:08 +01:00
binary1248
04131e1607 Fixed EGL incorrectly being passed the anti-aliasing level as EGL_SAMPLE_BUFFERS instead of EGL_SAMPLES. Fixes #1533. 2019-01-05 00:54:37 +01:00
binary1248
db80f6a60f
Make sure setActive(false) is called before the surface is destroyed in EglContext. Fixes #1530. 2018-12-29 13:36:01 +01:00
Dmitry Marakasov
119195ac20 Remove unneeded cast 2018-12-03 18:41:22 +01:00
Sven Hesse
de0ba77d3b Unix: Filter X visual by X screen
On an X set-up with multiple monitors running separate X screens (as
opposed to merging them into one large X screen using Xinerama), the
selected X visual needs to be one for the screen where the colormap,
window, and other X resources are created. In fact, all these need to
match, and the GL context as well.

Most of the SFML windowing and graphics code uses (X)DefaultScreen()
for that, which is fine. Combined with XOpenDisplay(NULL), this will
create the window on the screen (and monitor) selected by the DISPLAY
enviroment variable. :0.0 will be the first monitor, :0.1 the second,
etc.

However, XGetVisualInfo() will return visuals for *all* screens, not
just the default one. They seem to be ordered by screen number, but I
don't think the standard makes any guarantees there.

If the visual doesn't match up with the screen, this will abort with
an X error. BadMatch, in many cases.

This means that in addition to other filtering,
GlxContext::selectBestVisual() needs to filter the visuals by screen
number, otherwise SFML won't work at all on any screens but the first.

This fixes issue #724.
2018-10-26 21:15:25 +02:00
binary1248
ac98be760b Allow re-creation of the shared context as a core context if the user indicates they want a core profile context. Sharing of compatibility and core profile contexts is not possible on macOS which is why we need to have a way to re-create the shared context as a core context if required in this case. 2018-10-23 21:54:36 +02:00
Jonny Paton
d1d788fcb3 Add -ObjC flag to fix static linking on macOS 2018-10-15 21:07:54 +02:00
Maxime Alvarez
a5d45b910f Fixed the error message when the wrong bitmap font size is selected 2018-10-04 22:25:11 +02:00