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);
            }
        }
    }
  • 相关阅读:
    Max History CodeForces
    Buy a Ticket CodeForces
    AC日记——字符串的展开 openjudge 1.7 35
    AC日记——回文子串 openjudge 1.7 34
    AC日记——判断字符串是否为回文 openjudge 1.7 33
    AC日记——行程长度编码 openjudge 1.7 32
    AC日记——字符串P型编码 openjudge 1.7 31
    AC日记——字符环 openjudge 1.7 30
    AC日记——ISBN号码 openjudge 1.7 29
    AC日记——单词倒排 1.7 28
  • 原文地址:https://www.cnblogs.com/senior-engineer/p/14026174.html
Copyright © 2011-2022 走看看