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 = sqrt(count);
55 int rows = (count % colums) ? colums+1 : colums;
57 int vw = (mApp->width() - (2 * offset * colums))/colums;
58 int vh = (mApp->height() - (2 * offset * rows))/rows;
61 for(auto i : mResource) {
62 std::string filePath = DEMO_DIR;
65 std::unique_ptr<LottieView> view(new LottieView(mApp->evas(), mRenderMode));
66 view->setFilePath(filePath.c_str());
67 view->setPos(posx, posy);
68 view->setSize(vw, vh);
72 //view->setRepeatMode(LottieView::RepeatMode::Reverse);
75 if ((mApp->width() - posx) < vw) {
77 posy = posy + vh + offset;
79 mViews.push_back(std::move(view));
86 bool mRenderMode = false;
87 std::vector<std::unique_ptr<LottieView>> mViews;
88 std::vector<std::string> mResource;
94 LottieViewTest *view = (LottieViewTest *)data;
99 main(int argc, char **argv)
101 EvasApp *app = new EvasApp(800, 800);
104 bool renderMode = true;
106 if (!strcmp(argv[1],"--disable-render"))
109 LottieViewTest *view = new LottieViewTest(app, renderMode);
110 view->buildResourceList();
113 app->addExitCb(onExitCb, view);