2 #include "lottieview.h"
9 * To check the frame rate with rendermode off run
10 * ECORE_EVAS_FPS_DEBUG=1 ./lottieviewTest --disable-render
12 * To check the frame rate with render backend
13 * ECORE_EVAS_FPS_DEBUG=1 ./lottieviewTest
20 LottieViewTest(EvasApp *app, bool renderMode) {
22 mRenderMode = renderMode;
25 bool isJsonFile(const char *filename) {
26 const char *dot = strrchr(filename, '.');
27 if(!dot || dot == filename) return false;
28 return !strcmp(dot + 1, "json");
31 void buildResourceList() {
34 d = opendir(DEMO_DIR);
36 while ((dir = readdir(d)) != NULL) {
37 if (isJsonFile(dir->d_name))
38 mResource.push_back(dir->d_name);
43 void displayResourceList() {
44 for(auto i : mResource) {
45 std::string filePath = DEMO_DIR;
51 if (mResource.empty()) return;
53 int count = mResource.size();
54 int colums = (int) ceil(sqrt(count));
56 int vw = (mApp->width() - (2 * offset * colums))/colums;
60 for(auto i : mResource) {
61 std::string filePath = DEMO_DIR;
64 std::unique_ptr<LottieView> view(new LottieView(mApp->evas(), mRenderMode));
65 view->setFilePath(filePath.c_str());
66 view->setPos(posx, posy);
67 view->setSize(vw, vh);
71 //view->setRepeatMode(LottieView::RepeatMode::Reverse);
74 if ((mApp->width() - posx) < vw) {
76 posy = posy + vh + offset;
78 mViews.push_back(std::move(view));
85 bool mRenderMode = false;
86 std::vector<std::unique_ptr<LottieView>> mViews;
87 std::vector<std::string> mResource;
91 onExitCb(void *data, void *extra)
93 LottieViewTest *view = (LottieViewTest *)data;
98 main(int argc, char **argv)
100 EvasApp *app = new EvasApp(800, 800);
103 bool renderMode = true;
105 if (!strcmp(argv[1],"--disable-render"))
108 LottieViewTest *view = new LottieViewTest(app, renderMode);
109 view->buildResourceList();
112 app->addExitCb(onExitCb, view);