Skip to content

Commit

Permalink
ifdef RIVE_EXPERIMENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-rosso committed Jun 13, 2022
1 parent 5cb6f0b commit 4abb84f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions skia/viewer/build/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ project "rive_viewer"
}

buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti"}
defines { "RIVE_EXPERIMENTS" }

filter "configurations:debug"
buildoptions {"-g"}
Expand Down
4 changes: 4 additions & 0 deletions skia/viewer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ std::vector<std::string> stateMachineNames;

constexpr int REQUEST_DEFAULT_SCENE = -1;

#ifdef RIVE_EXPERIMENTS
#include <time.h>
double GetSecondsToday() {
time_t m_time;
Expand All @@ -85,6 +86,7 @@ double GetSecondsToday() {
// printf("%g %g %g\n", secs, secs/60, secs/60/60);
return secs;
}
#endif

// We hold onto the file's bytes for the lifetime of the file, in case we want
// to change animations or state-machines, we just rebuild the rive::File from
Expand Down Expand Up @@ -320,10 +322,12 @@ int main() {
canvas->drawPaint(paint);

if (currentScene) {
#ifdef RIVE_EXPERIMENTS
// See if we can "set the time" e.g. clock statemachine
if (auto num = currentScene->getNumber("isTime")) {
num->value(GetSecondsToday()/60/60);
}
#endif

currentScene->advanceAndApply(elapsed);

Expand Down

0 comments on commit 4abb84f

Please sign in to comment.