Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sfml and sdl examples #292

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Yohannfra
Copy link

No description provided.

@Yohannfra Yohannfra changed the title add sfml example add sfml and sdl examples Sep 28, 2021
@TheLartians
Copy link
Member

Hey thanks for the example! It can definitely be useful for users checking how to use the sfml and sdl libraries. However it may be hard to test compilation CI as it seems to be missing X11 support. Maybe you could add the examples to the smippets as well?

@Yohannfra
Copy link
Author

I didn't see the snippets page. I'll add it !

@iboB
Copy link
Member

iboB commented Sep 29, 2021

I think examples belong in a separate repo (or maybe multiple separate repos?)

@OlivierLDff
Copy link
Contributor

It's really cool to have common library as part of unit testing. Because it test real world scenario. Complexity and hidden bugs often hides in there.

@TheLartians
Copy link
Member

@OlivierLDff yeah, that's why currently all examples included in the examples directory are included in the CI testing suite. This specific case is a bit complex though as it requires an X11 environment, which is unusual for CI.

@OlivierLDff
Copy link
Contributor

I'm doing some unit test on gui (using Qt) in github action, here how I am doing:

sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-xinerama0 libxcb-keysyms1 libxcb1 libxcb-render-util0 libxcb-randr0
xvfb-run ctest --build-config "${{ matrix.build_type }}" --progress --verbose


add_executable(CPMSFMLExample main.cpp)
target_compile_features(CPMSFMLExample PRIVATE cxx_std_17)
target_link_libraries(CPMSFMLExample sfml-system sfml-graphics sfml-window sfml-audio)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example only uses the Graphics module which transitively depends on the Window and System module so this line can be as simple as

target_link_libraries(CPMSFMLExample PRIVATE sfml-graphics)

@@ -0,0 +1,16 @@
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<SFML/Graphics.hpp> includes <SFML/Window.hpp> so that 2nd header can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants