MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / DoFrame

Method DoFrame

LuaSTGPlus/GameObjectPool.cpp:523–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523void 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
567void GameObjectPool::DoRender()LNOEXCEPT
568{

Callers 1

ObjFrameMethod · 0.80

Calls 8

GetTypeMethod · 0.80
SetRotationMethod · 0.80
IsActivedMethod · 0.80
SetInactiveMethod · 0.80
SetCenterMethod · 0.80
SetActiveMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected