コード例 #1
0
Preview::ActionPtr Preview::GetActionById(std::string const& _id) const
{
  for (Preview::ActionPtr const& action : GetActions())
  {
    if (action->id == _id)
      return action;
  }
  return Preview::ActionPtr();
}
コード例 #2
0
ファイル: common.c プロジェクト: BackupTheBerlios/wl530g-svn
struct action *CheckActions(int sid, char *name)
{
   struct action *a;
   	
   for (a = GetActions(sid); a->name != NULL; a++) 
   {
      if (strcmp(a->name, name)==0)	
      {
      	 return(a);      	
      }
   }
   return NULL; 	
}
コード例 #3
0
void clGotoAnythingManager::ShowDialog()
{
    // Let the plugins know that we are about to display the actions
    clGotoEvent evtShowing(wxEVT_GOTO_ANYTHING_SHOWING);
    evtShowing.SetEntries(GetActions());
    EventNotifier::Get()->ProcessEvent(evtShowing);

    // Let the plugins sort the content
    clGotoEvent evtSort(wxEVT_GOTO_ANYTHING_SORT_NEEDED);
    evtSort.GetEntries().swap(evtShowing.GetEntries());
    EventNotifier::Get()->ProcessEvent(evtSort);

    std::vector<clGotoEntry> entries = evtSort.GetEntries();
    GotoAnythingDlg dlg(EventNotifier::Get()->TopFrame(), entries);
    dlg.ShowModal();
}
コード例 #4
0
ファイル: Game.cpp プロジェクト: cxuhua/cxengine
void Game::OnMain()
{
    SetPlanSize(cxSize2F(2048, 1536));
//
    const cxStr *data = nullptr;
    {
        cxStr *code = cxStr::UTF8("8347834");
        IndexType message = IndexType_init_zero;
        message.tid = 200;
        message.code = CX_STR_PB_ENCODE(code);
        data = cxStr::PBEncode(IndexType_fields, &message);
        cxUtil::Instance()->WriteDocument("test.dat", data, true);
    }
    {
        cxStr *code = cxStr::Create();
        IndexType m2 = IndexType_init_zero;
        m2.code = CX_STR_PB_DECODE(code);
        cxBool ok = data->PBDecode(IndexType_fields, &m2);
        CX_LOGGER("%d",ok);
    }
    
//    LoadTexture("grid.png","grid");
//
//    cxSprite *sp = cxSprite::Create();
//    sp->SetSize(cxSize2F(64));
//    sp->SetTexture("grid");
//    Window()->Append(sp);
//    
//    cxMoveTo::Create(cxPoint2F(0, 512), 6)->AttachTo(sp)->onExit+=cxAction::Remove;
//    
//    {
//        cxSprite *sp2 = cxSprite::Create();
//        sp2->SetSize(cxSize2F(64));
//        sp2->SetTexture("grid");
//        sp2->SetColor(cxColor4F::RED);
//        Window()->Append(sp2);
//        
//        cxFollow::Create(sp, 50)->AttachTo(sp2);
//    }
    
//    Controller *cv = Controller::Create(6, 6);
//    cv->SetResizeFlags(cxView::ResizeBottom);
//    Window()->Append(cv);
//
//    return;
    //加载纹理
    LoadTexture("jl.lqt");
    //加载帧序列
    LoadFrames("frames.csv");
    //加载动作组
    LoadActions("actions.csv");
    //获取法师帧序列
    const cxFrames *fs = GetFrames("Mage");
    //获取法师的动作列表
    const cxActionGroup *ag = GetActions("Mage");
    //获得move动作
    
    //创建动画
    {
        //获得动作组
        const cxActionAttr *move = ag->Action("attack");
        //创建动画
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //创建载体
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->Append(animate);//加入动画
        //载体加入绘制
        Window()->Append(atlas);
    }
    
    {
        const cxActionAttr *move = ag->Action("move");
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->SetPosition(cxPoint2F(0, 300));
        animate->AttachTo(atlas);
        Window()->Append(atlas);
    }
}