zoukankan      html  css  js  c++  java
  • TD 加载界面实现

    一)编写ini文件,用button实现加载界面

    cl_animationWin={
      type="window"
      x=0
      y=0
      w=1024
      h=600
      style="cl_normalwin"
      flags={
        window_splash
      }
    
    ...
    
      cl_picLoadingButton={
        type="button"
        x=425
        y=180
        w=174
        h=174
        style="comWaitBtn"
        flags={
          no_focus
          button_no_offset
          no_event
        }
      }
    ...
    }

    二)代码中实现此功能

    static void initCarLifeAnimation()
    {
        TWidget *loading,*aniLogo;
    
        loading = TObjectGetFromName("cl_picLoadingButton");
        aniLogo = TObjectGetFromName("cl_picLoadingLogo");
    
        TTable *tableLoading = TTableCreate();
        TTable *tableLogo = TTableCreate();
    
        int i = 0;
        char picPath[ANI_PICPATH_CHARMAX]= {0};
        for(i=0; i<ANI_LOADING_PIC_MAX; i++)
        {
            sprintf(picPath,"../style/carlife/car_ic_loading_%02d.png",i+1);
    
            CL_D("----add %d%s 
    ",i,picPath);
            TTableAddString(tableLoading,(Tint)NULL,picPath,-1);
            memset(picPath,0,ANI_PICPATH_CHARMAX);
        }
    
        for(i = 0; i<ANI_LOGO_PIC_MAX; i++)
        {
            sprintf(picPath,"../style/carlife/car_ic_loading_logo%02d.png",i+1);
            CL_D("----add %d %s 
    ",i,picPath);
            TTableAddString(tableLogo,(Tint)NULL,picPath,-1);
            memset(picPath,0,ANI_PICPATH_CHARMAX);
        }
    
        if(clViewInfo&&clViewInfo->animationInfo)
        {
            if(clViewInfo->animationInfo->btnAniLogo==NULL)
            {
                clViewInfo->animationInfo->btnAniLogo = createBtnAnimation(aniLogo,tableLogo,ANI_TIME_INT,1);
                registerAniBtnFinishCBK(clViewInfo->animationInfo->btnAniLogo,animationLogoFinished,animationShowLogo);
            }
            else
            {
                CL_E("[error] last logo animtion hasn't destory.plz check.
    ");
            }
    
            if(clViewInfo->animationInfo->btnAni==NULL)
            {
                clViewInfo->animationInfo->btnAni = createBtnAnimation(loading,tableLoading,ANI_TIME_INT,-1);
                registerAniBtnFinishCBK(clViewInfo->animationInfo->btnAni,animationLogoFinished,NULL);
                startBtnAnimation(clViewInfo->animationInfo->btnAni);
            }
            else
            {
                CL_E("[error] last loading animtion hasn't destory.plz check.
    ");
            }
    
        }
    
        TTableDestroy(tableLoading);
        TTableDestroy(tableLogo);
    
    }

    三)开始加载界面  startBtnAnimation

    四)暂停加载界面 stopBtnAnimation

    五)实现回调函数

    animationShowLogo

    static void animationShowLogo(TWidget *widget)
    {
        TWidget *btn = TObjectGetFromName("cl_picBaiduLabel");
        TwShow(btn);
    }

    animationLogoFinished

    static void animationLogoFinished(TWidget *widget)
    {
        CHECK_POINTER(clViewInfo);
    
        TWidget *loading = TObjectGetFromName("cl_picLoadingButton");
    
        CL_D("%s %d widget %x:laoding %x
    ",__FUNCTION__,__LINE__,(Tuint32)widget,(Tuint32)loading);
    
        if(loading == widget)
        {
            CL_I();
    
            TWidget *btn = TObjectGetFromName("cl_picLoadLogo");
            TwHide(btn);
            btn = TObjectGetFromName("cl_picLoadingButton");
            TwHide(btn);
            btn = TObjectGetFromName("cl_picLoadingLabel");
            TwHide(btn);
    
            btn = TObjectGetFromName("cl_picLoadingLogo");
            TwShow(btn);
    
            if(clViewInfo->animationInfo->btnAniLogo)
            {
                startBtnAnimation(clViewInfo->animationInfo->btnAniLogo);
            }
        }
        else
        {
            if(clViewInfo->isProjected == TRUE)
            {
                clViewInfo->isProjected = FALSE;
                changeView(CL_PROJECTED);
            }
            else
            {
                changeView(CL_Failed);
            }
        }
    }
  • 相关阅读:
    ab (ApacheBench)命令
    Linux yum apt-get 方式
    Linux 作业调度器 crond
    FastDFS 注意事项
    FastDFS 搭建
    FastDFS 基础知识
    JS判断web网站访问端是PC电脑还是手机
    C# Json数据反序列化为Dictionary并根据关键字获取指定值1
    C#委托的异步调用1
    C# Json数据反序列化为Dictionary并根据关键字获取指定值
  • 原文地址:https://www.cnblogs.com/senior-engineer/p/14026174.html
Copyright © 2011-2022 走看看