GithubHelp home page GithubHelp logo

rive-app / rive-cpp Goto Github PK

View Code? Open in Web Editor NEW
286.0 286.0 43.0 29.09 MB

C++ runtime for Rive

License: MIT License

Dart 0.92% Shell 1.70% C++ 89.89% Lua 1.73% C 5.54% Dockerfile 0.03% Objective-C++ 0.12% Objective-C 0.01% GLSL 0.05% Batchfile 0.02%

rive-cpp's People

Contributors

avivian avatar csmartdalton avatar hermet avatar jcash avatar luigi-rosso avatar mikerreed avatar mjohnsullivan avatar mjtalbot avatar na2axl avatar taehyub avatar umberto-sonnino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rive-cpp's Issues

Dynamic text, etc?

How can you make text inside a Rive animation dynamic? Eg use Rive for UI? Have a template that text can be loaded in by host language, etc?

TIA

Windows compilation

Hi,

I was willing to try playing with rive-cpp, so I just added it to my third party cmake, added all cpp files and encountered two errors when building with Visual Studio 2019 :

  • In binary_reader.cpp, readString() method line 45, MSVC does not like the char rawValue[length];. I replaced the code by
std::string result;
result.resize(length);
auto readBytes = decode_string(length, m_Position, m_End, result.data());

and it seems ok (at least it compiles). It might not be the best way to handle that if you want to avoid micro allocations so it might not be the best fix.

  • In shapes/star.cpp, M_PI is not defined. With MSVC, one needs to add _USE_MATH_DEFINES before including math.h. I defined it globally with cmake, but adding the definition before the first cmath include would make more sense.

FFMPEG uses CBR when bitrate is specified

Our current implementation tries to set a target bitrate but it appears to not force it. It is probably doing some computation to evaluate what's needed and setting the bitrate accordingly.
When we specify a bitrate for the exporter, we want to make sure that value is used in the encoding process.

runtime for python

Is there a plan for building runtime for python. there is already a project for skia-python.
Is it even possible?
This will enable python users to render rive animations for desktop applications,

Hide background

Hi there,

How do I hide the background of the artboard once loaded?
I'd like to hide (make the color transparent, or remove it etc) by default, and allow the user to enable it manually if required.

artboard = file->artboard();
// What to do here to hide background?

Ideally of course the user would create their own assets with transparent background, but this isn't always possible if using third-party assets :)

Cheers,
Peter

Example using rive and skia

Hi there,

I'm trying to get rive and skia working in a GLFW window but am having trouble. I've only got the old flare examples to go on that I've been able to find. However, a lot seems to have changed since these were written.

Do you have a simple example of at least rendering a rive file to a surface using skia?

Thank you!

Build warnings (non-virtual destructors and comparison of different signedness)

While building, there are some warnings printed:

In file included from ../submodule/rive-cpp/include/rive/artboard.hpp:6,
                 from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
                 from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/core_context.hpp:9:11: warning: ‘class rive::CoreContext’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
    9 |     class CoreContext {
      |           ^~~~~~~~~~~
In file included from ../submodule/rive-cpp/include/rive/artboard.hpp:11,
                 from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
                 from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/shapes/shape_paint_container.hpp:14:11: warning: ‘class rive::ShapePaintContainer’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
   14 |     class ShapePaintContainer {
      |           ^~~~~~~~~~~~~~~~~~~
In file included from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
                 from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/artboard.hpp:28:11: warning: base class ‘class rive::CoreContext’ has accessible non-virtual destructor [-Wnon-virtual-dtor]
   28 |     class Artboard : public ArtboardBase, public CoreContext, public ShapePaintContainer {
      |           ^~~~~~~~
../submodule/rive-cpp/include/rive/artboard.hpp:28:11: warning: base class ‘class rive::ShapePaintContainer’ has accessible non-virtual destructor [-Wnon-virtual-dtor]
In file included from ../submodule/rive-cpp/include/rive/file.hpp:7,
                 from ../viewer/viewer.cpp:22:
../submodule/rive-cpp/include/rive/file_asset_resolver.hpp:9:11: warning: ‘class rive::FileAssetResolver’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
    9 |     class FileAssetResolver {
      |           ^~~~~~~~~~~~~~~~~
../viewer/viewer.cpp: In function ‘void initAnimation(int)’:
../viewer/viewer.cpp:96:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   96 |     if (index >= 0 && index < artboardInstance->animationCount()) {
      |                       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Base class for renderer

Use a base class for the video renderer and the PNG sequence renderer: they'll share the resources and some of the functionality they both need.

Rive Unity Runtime [Question]

Is this the base repo for the Rive Unity Runtime? Are there any early examples we can play with? It wouldn't take much to determine if Rive is right for my team. Thanks so much!

Unable to build with correct debug level

Hi all,

I'm creating static debug builds of all the libraries I'm using (MTd) with LLVM clang, and have it working for all libraries so far except Rive. I've been trying different things for a couple of days. Any help appreciated!

This is my linker output:

1>lld-link : error : /failifmismatch: mismatch detected for '_ITERATOR_DEBUG_LEVEL':
1>>>> skia.lib(skia.SkColorSpace.obj) has value 2
1>>>> rive.lib(binary_reader.o) has value 0

This is my current (part of) premake lua:

filter "configurations:debug"
    buildoptions {"-MTd"}
    debuglevel (2)
    symbols "On"

This is an example of the generated command:

clang++   -MMD -MP -D_USE_MATH_DEFINES -I../include -m64 -g -std=c++17 -Wall -fno-exceptions -fno-rtti -MTd  -o \"obj/debug/artboard.o\" -MF \"obj/debug/artboard.d\" -c \"../src/artboard.cpp\""

Note that I don't think debuglevel (2) has done anything (the command has the same arguments if I leave it off).

Note that all my libraries are built with debug level of 2, but whatever I do I cannot get Rive to build with this level.

Any help appreciated!

rive ? flare?

Hi, I'm one of rive users.

I'm wondering the compatibility of flare(flr) animation by new Rive runtime(rive-cpp).

Do you have any plan to support flare animation in this runtime?

There are a plenty of flare animation design resources in community and wondering if they are usable or not here.

Test runtime support for JPEG

The attached .riv contains a couple JPEG assets. This is the first test of allowing designers to keep their assets in this format.

TODO:

  • test that this draws correctly on ALL platforms/SDKs
  • test in other environments too (e.g. recorder)

lunch.riv.zip

Issues building on Ubuntu (16.04)

Opened this issue as a discussion.
I'm not sure if this is reproducible on newer Ubuntu versions (our build server uses 16.04 still).

The problem is X11.h (much like Window.h) adds names to the global namespace, that may fail consequent code.
Although I was able to move the inclusion of X11.h later, I suspect it might not always be as easy for others.

On Ubuntu (16.04), if you happen to include X11.h before the rive headers, you'll get these errors:

In file included from upload/defold-rive/pluginsrc/plugin.cpp:9:
In file included from upload/defold-rive/include/artboard.hpp:6:
In file included from upload/defold-rive/include/generated/artboard_base.hpp:3:
In file included from upload/defold-rive/include/container_component.hpp:3:
In file included from upload/defold-rive/include/generated/container_component_base.hpp:3:
In file included from upload/defold-rive/include/component.hpp:3:
upload/defold-rive/include/component_dirt.hpp:9:3: error: expected identifier
                None = 0,
                ^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None                 0L /* universal null resource or null atom */

I'm not sure what a good solution is here, but perhaps a name change to e.g. Empty, Clear, Nilor something similar is acceptable.

Find a valid zipping library

In order to support generating image sequences, we're going to need a zipping library for compressing and setting up the output.

Need debug and release Skia builds

When we build skia(lib) as a dependency (which we do all over the place) we need to support passing in 'debug' or 'release', so the skialib will 'match' the setting in our tool/app.

This is important not just for performance (release is faster), but occasionally for correctness too ... A header might declare an object differently in those two modes, and if we're not consistent, we could break the ABI at runtime.

Are there any interfaces for getting bounds size of the node?

I want to get the node bounds (x,y,w,h) in the rive animation to cover user interaction scenario.
but It seems that there are no interfaces for getting bounds area.
Are there any interfaces for getting bounds area of the node?
Ex) The bound aera of face node is calculated in web design tool already, can I get the same bounds area in rive-cpp runtime?
image
@luigi-rosso

component name is unmatched

To change the instance color during the runtime I named Fills and Strokes as "mycolor" and "mystroke".
but the instance I found is unmatched. (however m_Objects vector container in artboard has the object which I named.)
How can I get the exact instance which I named?

rive::SolidColorBase* fill = (rive::SolidColorBase*)artboard->find("mycolor");
fill->colorValue(rive::colorARGB(255, 0, 0 255));

rive::SolidColorBase* stroke = (rive::SolidColorBase*)artboard->find("mystroke");
stroke->colorValue(rive::colorARGB(255, 0, 255, 255));

image

@luigi-rosso

Static library file size 14 - 16MB (release)

Hi all,

I'm building a release build of rive as a static library.

Compiling using Visual Studio with default toolset (msvc) I get a static lib of 14MB.
Still compiling with VS, but with the clang-cl toolset I get 16MB.

I have a version of rive.lib that I compiled earlier in 2021 that is 1.7MB. I just cannot figure out why it is so big now.!

Use premake to build Win32/Win64

So far I've only been able to configure a 32+64 bit library build using the visual studio solution.
That is also generating only Win32, so you have to clone the config, create a x64 config.
Lastly, you also have to change the dynamic linkage to static.

I think it would be beneficial if it would be possible to use the platform/arch with the build script, e.g.:
build.sh release Win32 / build.sh release Win64

Any possible way to integrate Rive animations with OBS studio?

So I have created an animation with rive and thinking it to integrate with OBS studio where my chat using commands can change the state of rive animation. So is there any possible way to do the same or if someone can come up with some hint it will be very helpful too. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.