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

Author Topic: Ayuda  (Read 873 times)

0 Members and 2 Guests are viewing this topic.

JeremiasXS

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Ayuda
« on: January 13, 2024, 02:28:00 am »
Necesito ayuda con el siguiete codigo:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    // Load a sprite to display
    sf::Texture texture;
    if (!texture.loadFromFile("cute_image.jpg"))
        return EXIT_FAILURE;
    sf::Sprite sprite(texture);
    // Create a graphical text to display
    sf::Font font;
    if (!font.loadFromFile("arial.ttf"))
        return EXIT_FAILURE;
    sf::Text text("Hello SFML", font, 50);
    // Load a music to play
    sf::Music music;
    if (!music.openFromFile("nice_music.ogg"))
        return EXIT_FAILURE;
    // Play the music
    music.play();
    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed)
                window.close();
        }
        // Clear screen
        window.clear();
        // Draw the sprite
        window.draw(sprite);
        // Draw the string
        window.draw(text);
        // Update the window
        window.display();
    }
    return EXIT_SUCCESS;
}
Cuando compilo y ejecuto me dice que no se encuentran los SFML/Audio.hpp y SFML/Graphics.hpp
« Last Edit: January 15, 2024, 02:05:45 pm by eXpl0it3r »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Ayuda
« Reply #1 on: January 13, 2024, 10:42:01 pm »
Remember to link to SFML (specify where its include folder is) when building (Windows) or install it (Linux). (Possibly both for Mac)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Ayuda
« Reply #2 on: January 15, 2024, 02:05:33 pm »
This is an English speaking forum, please stick to it. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/