Commit Graph

80 Commits

Author SHA1 Message Date
binary1248
698f265277 (Re-)Introduce default constructors and load/open member functions for resource objects that can be reused. 2024-08-08 09:19:32 -06:00
Bambo-Borris
5eb57ae5f1 Fix white square problem in OpenGL example
Because the sf::Texture::m_texture value changes when the texture is
reloaded from disk, we need to rebind the texture since the previously
bound sf::Texture::m_texture value is no longer a valid identifier.
2024-07-15 12:32:08 -06:00
kimci86
fca4fa1aa2 Rename Font::loadFromFile into Font::openFromFile
Similar renaming for Font::loadFromMemory and Font::loadFromStream.
The goal is to better express the need to keep the source available,
similar to Music::openFromFile for example.
2024-06-25 22:53:28 +02:00
vittorioromeo
86c1a71a93 Remove default empty state of sf::Event 2024-06-23 19:11:10 +02:00
Chris Thrasher
bfd65989e9 Remove default empty state of sf::Texture 2024-06-04 13:19:58 -06:00
Chris Thrasher
504b850f03 Remove default empty state of sf::Font 2024-05-19 14:01:54 -06:00
trustytrojan
ca0a231b35 Add operator bool() to sf::Event for checking if the event type is not Empty 2024-05-03 22:50:59 +00:00
Chris Thrasher
59447dd8e5 Rewrite sf::Event API to improve type safety
This new API is built on top of std::variant. This allows us to
store many different event types in a space-efficient way and access
the active event type in a type-safe manner that eliminates the
categories of UB that are possible with unions.

Co-authored-by: kimci86 <kimci86@hotmail.fr>
2024-05-01 18:00:58 +00:00
vittorioromeo
b552148e26 Header cleanup guided by IWYU 2024-02-09 12:52:23 +01:00
Chris Thrasher
a2c003b2b7 Add sf::State for specifying fullscreen or floating windows 2024-01-15 23:08:33 -07:00
kimci86
39da2b829c Make Keyboard::Key a scoped enumeration 2023-12-22 10:47:30 -06:00
Chris Thrasher
c3f69e5d64 Remove leading newlines 2023-11-29 15:54:38 -07:00
Chris Thrasher
2fcdec5153 Remove unnecessary reinterpret_casts 2023-11-26 18:08:02 -05:00
Chris Thrasher
27249d42ed Add sf::WindowBase::set{Min|Max}imumSize()
Co-authored-by: Shane Whitmire <dogunbound5@gmail.com>
Co-authored-by: michael.david.howard@outlook.com <michael.david.howard@outlook.com>
2023-05-12 14:36:06 -06:00
Chris Thrasher
fb1cfdc48d Add misc-const-correctness clang-tidy check 2023-05-04 16:22:03 -06:00
vittorioromeo
cbfa9cbb65 Reorder includes hierarchically 2023-04-25 17:25:33 +02:00
Chris Thrasher
2c99b3343a Remove default sf::Text constructor 2023-04-05 09:54:56 -06:00
Chris Thrasher
7a5b862fd0 Consolidate redundant gl.h headers 2022-10-09 13:04:24 +02:00
Vittorio Romeo
753644a5bd Fix CMake formatting inconsistencies 2022-10-06 20:33:40 +02:00
Chris Thrasher
72d88033e2 Use relative paths for resource files 2022-08-22 11:26:57 +08:00
Chris Thrasher
4f52793f7d Run clang-format 2022-07-11 20:04:56 +02:00
metaquarx
88e9f82bee Add '.clang-format' file, CI integration, and formatting exceptions
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
Co-authored-by: kimci86 <kimci86@hotmail.fr>
2022-07-11 20:04:56 +02:00
Chris Thrasher
0812054e02 Remove trailing whitespace 2022-06-25 21:32:55 +02:00
Chris Thrasher
65fef85b30 Simplify how examples are built
CMake doesn't require absolute paths so we can safely remove
SRCROOT and let implicit relative pathing achieve the same result
with less work on our part.
2022-06-16 23:56:39 +02:00
Chris Thrasher
539483d329 Use std::array 2022-06-16 23:56:39 +02:00
Chris Thrasher
dbac180db5 Limit the scope of event object 2022-06-08 13:16:40 +02:00
Chris Thrasher
0785093ebc Use sf::Vector2<T> for numeric parameter pairs 2022-05-17 08:33:11 +02:00
Chris Thrasher
a302a9829e Ensure files end with newline character 2022-04-12 08:13:48 +02:00
Chris Thrasher
33a7c4d2a8 Clean up filesystem path usage in examples 2022-03-15 15:21:45 +01:00
Chris Thrasher
5f2c7bb898 Use std::filesystem::path 2022-02-17 00:40:29 +00:00
Vittorio Romeo
a3b27b4a6d Use pre-increment when post-increment is not necessary 2022-02-17 00:39:35 +00:00
Chris Thrasher
4586db91a9 Add SFML:: namespace to targets
This removes the sfml- prefixed targets from the export set. The sfml-
prefixed targets are still available within the build tree but not to
downstream users thus making this an API breaking change when compared
to the 2.x releases. To keep things consistent, usage of the sfml-
targets were replaced with their namespaced counterparts.

This has a number of benefits:

  1. It's more idiomatic. Modern CMake libraries are expected to
     have namespaced targets.

  2. Namespaced targets are less likely to collide with user-defined
     targets. No one will accidentally define a SFML:: target.

  3. If a namespaced target is not found by CMake, configuration
     will immediately stop.
2022-01-11 22:27:39 +01:00
Vittorio Romeo
7364d5b578 Fix broken OpenGL example 2021-12-21 20:41:44 +01:00
Vittorio Romeo
e9e353a7b2 Remove redundant APIs taking '(x, y)' in favour of ones taking 'sf::Vector' 2021-12-15 11:22:46 +01:00
Vittorio Romeo
363e964acc Strategic use of '[[nodiscard]]' in 'Graphics' module 2021-12-10 01:27:05 +00:00
Lukas Dürrenberger
bc628c6b28 Fix warnings in examples
- Convert where necessary
- Adjust type where reasonable
- Use SYSTEM headers for gl.h, stb* and vulkan
2021-11-30 11:25:58 +01:00
MrZeusTheCoder
20238e758e Switch example resources to public domain ones. 2021-04-02 22:16:22 +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
Jonny Paton
353c846c87 Update examples for iOS including touch support, proper handling of window resize, launch screens and icons 2019-01-19 01:34:30 +01:00
Ceylo
1272b704d6 window, opengl and pong examples now work on iOS 2019-01-19 01:29:12 +01:00
Ceylo
82c2f4c05e All mobile-compatible examples now successfully link 2019-01-19 01:29:12 +01:00
Ceylo
ee08e18726 Modernize CMake files 2018-03-27 00:03:34 +02:00
Marco Antognini
b0f3611ab9 Renamed a few key codes
Deprecated BackSlash, BackSpace, SemiColon, Dash and
introduced Backslash, Backspace, Semicolon, Hyphen in a
retrocompatible way.
2018-03-26 23:39:39 +02:00
Ceylo
ce7ced5488 Replace INSTALL_RESOURCES_DIR option of sfml_add_example() command with RESOURCES_DIR 2018-01-25 00:23:33 +01:00
Ceylo
777ec2c04d Fix launch of Cocoa example due to missing MainMenu.nib in bundle app 2018-01-25 00:23:33 +01:00
binary1248
2df9abf341 Added missing setActive virtual method to sf::RenderTarget, added setActive calls to OpenGL example to demonstrate proper explicit context management. 2016-10-13 17:01:41 +02:00
binary1248
259811d59c Implemented support for explicit mipmap generation in sf::Texture and sf::RenderTexture. (#123) 2016-05-04 20:01:22 +02:00
Marco Antognini
9d70da3aaa Fixed and silenced a few warnings 2016-04-14 12:26:40 +02:00
binary1248
e00d160224 Add support for sRGB capable framebuffers. (#175) 2016-03-10 10:08:17 +01:00
binary1248
2752bbcfb0 Added methods to get the currently active context, query whether an OpenGL extension is available and query the actual OpenGL version of a context, made context switches during initialization of texture and shader static values unnecessary, fixed code style in loaders. 2015-09-21 20:29:55 +02:00