| 521 | } |
| 522 | |
| 523 | void GameObjectPool::DoFrame()LNOEXCEPT |
| 524 | { |
| 525 | GETOBJTABLE; // ot |
| 526 | |
| 527 | GameObject* p = m_pObjectListHeader.pObjectNext; |
| 528 | while (p && p != &m_pObjectListTail) |
| 529 | { |
| 530 | // ����id��ȡ�����lua��table���õ�class���õ�framefunc |
| 531 | lua_rawgeti(L, -1, p->id + 1); // ot t(object) |
| 532 | lua_rawgeti(L, -1, 1); // ot t(object) t(class) |
| 533 | lua_rawgeti(L, -1, LGOBJ_CC_FRAME); // ot t(object) t(class) f(frame) |
| 534 | lua_pushvalue(L, -3); // ot t(object) t(class) f(frame) t(object) |
| 535 | lua_call(L, 1, 0); // ot t(object) t(class) ִ��֡���� |
| 536 | lua_pop(L, 2); // ot |
| 537 | |
| 538 | // ���¶���״̬ |
| 539 | p->vx += p->ax; |
| 540 | p->vy += p->ay; |
| 541 | p->x += p->vx; |
| 542 | p->y += p->vy; |
| 543 | p->rot += p->omiga; |
| 544 | |
| 545 | // ��������ϵͳ�����У� |
| 546 | if (p->res && p->res->GetType() == ResourceType::Particle) |
| 547 | { |
| 548 | float gscale = LRES.GetGlobalImageScaleFactor(); |
| 549 | p->ps->SetRotation((float)p->rot); |
| 550 | if (p->ps->IsActived()) // �����Դ��� |
| 551 | { |
| 552 | p->ps->SetInactive(); |
| 553 | p->ps->SetCenter(fcyVec2((float)p->x, (float)p->y)); |
| 554 | p->ps->SetActive(); |
| 555 | } |
| 556 | else |
| 557 | p->ps->SetCenter(fcyVec2((float)p->x, (float)p->y)); |
| 558 | p->ps->Update(1.0f / 60.f); |
| 559 | } |
| 560 | |
| 561 | p = p->pObjectNext; |
| 562 | } |
| 563 | |
| 564 | lua_pop(L, 1); |
| 565 | } |
| 566 | |
| 567 | void GameObjectPool::DoRender()LNOEXCEPT |
| 568 | { |
no test coverage detected