Skip to content
Snippets Groups Projects
Select Git revision
  • 32256e4c757a52efba72fb1642e8d0cf487937e8
  • branchX default protected
  • Inventory
  • UIControls
  • fsv2
  • tonetest
  • from_nb
  • tonemapping
  • opt-shadows
  • BX-634
  • xCSG
  • hc
  • gizmos
  • gui2CSSLexer
  • msExporter
  • gui2
  • gui2Fix
  • master protected
  • pk
  • mesh_optimize
  • light_wip
  • version_X.11.2 protected
  • version_X.11.1 protected
  • version_X.11.1-dev protected
  • version_X.11.0-dev protected
  • version_X.10.1 protected
  • version_X.10.1-dev protected
  • version_X.10.0-dev protected
  • version_X.9.5 protected
  • version_X.9.4 protected
  • version_X.9.3 protected
  • version_X.9.3-dev protected
  • version_X.9.2-dev protected
  • version_X.9.1-dev protected
  • version_X.9.0-dev protected
  • version_X.8.2 protected
  • version_X.8.2-dev protected
  • version_X.8.1-dev protected
  • version_X.8.0-dev protected
  • version_X.7.1 protected
  • version_X.7.0 protected
41 results

SkyXEngine_Build.cpp

Blame
  • EntityManager.h 3.63 KiB
    
    /***********************************************************
    Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
    See the license in LICENSE
    ***********************************************************/
    
    #ifndef __ENTITY_MANAGER_H
    #define __ENTITY_MANAGER_H
    
    /*! \file */
    
    #include <gdefines.h>
    #include <common/array.h>
    #include <chrono>
    
    #include "proptable.h"
    
    typedef std::chrono::system_clock::time_point time_point;
    
    class CBaseEntity;
    struct ISXConfig;
    
    /*! Однократно запустить функцию fn через время time
    	\note Должно вызываться изнутри класса объекта
    */
    #define SET_TIMEOUT(fn, time) m_pMgr->setTimeout((void(CBaseEntity::*)(float))&ThisClass::fn, this, time)
    
    /*! Запускать функцию fn через каждые time секунд
    Возвращает идентификатор таймера
    \note Должно вызываться изнутри класса объекта
    */
    #define SET_INTERVAL(fn, time) m_pMgr->setInterval((void(CBaseEntity::*)(float))&ThisClass::fn, this, time)
    
    /*! Отменить интервал по идентификатору
    \note Должно вызываться изнутри класса объекта
    */
    #define CLEAR_INTERVAL(id) m_pMgr->clearInterval(id)
    
    /*! Отменить таймер по идентификатору
    \note Должно вызываться изнутри класса объекта
    */
    #define CLEAR_TIMEOUT(id) m_pMgr->clearTimeout(id)
    
    enum TIMEOUT_STATUS
    {
    	TS_WAIT = 0,
    	TS_DONE,
    	TS_EMPTY
    };
    
    struct timeout_t
    {
    	TIMEOUT_STATUS status;
    	void(CBaseEntity::*func)(float dt);
    	CBaseEntity * pEnt;
    	time_point fStartTime;
    	time_point fNextTime;
    };
    
    struct timeout_output_t
    {
    	TIMEOUT_STATUS status;
    	named_output_t *pOutput;
    	time_point fStartTime;
    	time_point fNextTime;
    	inputdata_t data;
    };
    
    class CEntityManager
    {