Display picture with text window over it

I wand to display a picture with a text window over it, if I could put some little animations (gif) and a fade between 2 images it would be the best !

You can use SFML https://www.sfml-dev.org/ and the GitHub - charlietangora/gif-h: Simple C++ one-header library for the creation of animated GIFs from image data.. After you install it you can code something to load 2 images like

// Load two images
    sf::Texture texture1, texture2;
    if (!texture1.loadFromFile("image1.png") || !texture2.loadFromFile("image2.png")) {
        return 1;
    }

And the gif animation

// Set up the GIF animation
    GifReader gifReader;
    GifOpen(&gifReader, "animation.gif", nullptr);
    sf::Texture gifTexture;
    sf::Sprite gifSprite;

There’s the text, sprites and fade effect but I believe you can achieve that on your own.

1 Like

How can I install the SMFL library in replit ? I’ve tried all the possible ways I found on their website but since it’s not on my computer I have a hard time installing it ^^

Replit doesn’t natively support SFML (I’m not sure), but you can use the CSFML package.

pkg install csfml

After that you can use the library

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

I think the webview is still facing some problems in replit so there may be limitations when working with SFML.

Try to see if there is any SFML template within the community too.

PS.: Update your CMakeLists.txt file to include CSFML and its dependencies.

cmake_minimum_required(VERSION 3.8)
project(replit-sfml-example)

set(CMAKE_CXX_STANDARD 17)

find_package(CSFML COMPONENTS graphics window system REQUIRED)
include_directories(${CSFML_INCLUDE_DIR})

add_executable(replit-sfml-example main.cpp)

target_link_libraries(replit-sfml-example ${CSFML_LIBRARIES})