开发者

A good C++ native multimedia library?

开发者 https://www.devze.com 2023-03-20 18:50 出处:网络
Can anyone recommend a portable, c++ native multimedia libra开发者_开发技巧ry? I\'ve tried SDL, but it doesn\'t interface well with classes, as it is a c library.There’s SFML – the “Simple and Fast

Can anyone recommend a portable, c++ native multimedia libra开发者_开发技巧ry? I've tried SDL, but it doesn't interface well with classes, as it is a c library.


There’s SFML – the “Simple and Fast Multimedia Library” – which is essentially a object-oriented, platform-independent, OpenGL-based alternative to SDL and which looks really quite promising.

It allows to write very clear code with no special attention to resource cleanup:

#include <SFML/Graphics.hpp>

int main() {
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    sf::Image Image;
    if (not Image.LoadFromFile("cute_image.jpg"))
        return -1;
    sf::Sprite Sprite(Image);

    while (App.IsOpened()) {
        sf::Event Event;
        while (App.GetEvent(Event)) {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        App.Clear();
        App.Draw(Sprite);
        App.Display();
    }
}


Have you tried looking at ffmpeg?

It's very widely used, cross platform, and their site mentions libavcodec which might be a suitable library for you.


Ffmpeg is a pretty good library, though not that easy to use.

What are you trying to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号