My Project
ParaEngineService.h
1 #pragma once
2 
3 #include <boost/asio.hpp>
4 #include <boost/bind.hpp>
5 #include <boost/date_time/posix_time/posix_time_types.hpp>
6 #include <iostream>
7 #include <boost/scoped_ptr.hpp>
8 #include <boost/asio/steady_timer.hpp>
9 
10 namespace ParaEngine
11 {
12  using namespace boost::asio;
13 
14  class CParaEngineApp;
21  {
22  public:
25 
31  int Run(const char* pCommandLine = NULL, CParaEngineApp* pApp = NULL);
32 
34  void StopService();
35 
36  /* signal handler function for linux */
37  static void Signal_Handler(int sig);
38 
40  static void InitDaemon(void);
41 
43  void AcceptKeyStroke(bool bAccept = true);
44 
46  inline bool IsAcceptKeyStroke() {return m_bAcceptKeyStroke;};
47  protected:
49  void handle_timeout(const boost::system::error_code& err);
50 
51  protected:
53  boost::asio::io_service m_main_io_service;
54 
57  boost::scoped_ptr<boost::asio::io_service::work> m_work_lifetime;
58 
60  typedef basic_waitable_timer<boost::chrono::steady_clock> timer_type;
61  timer_type m_main_timer;
62 
63  private:
65  bool m_bQuit;
66 
68  bool m_bAcceptKeyStroke;
69 
70  CParaEngineApp* m_pParaEngineApp;
71  };
72 
73 }
boost::scoped_ptr< boost::asio::io_service::work > m_work_lifetime
Work for the private m_io_service_dispatcher to perform.
Definition: ParaEngineService.h:57
different physics engine has different winding order.
Definition: EventBinding.h:32
boost::asio::io_service m_main_io_service
the main loop
Definition: ParaEngineService.h:53
Definition: basic_dir_monitor.hpp:14
bool IsAcceptKeyStroke()
whether we will accept key stroke
Definition: ParaEngineService.h:46
this allows ParaEngine to operate as a system service without GUI, such as in server mode...
Definition: ParaEngineService.h:20
basic_waitable_timer< boost::chrono::steady_clock > timer_type
the main timer that ticks 30 times a second
Definition: ParaEngineService.h:60
This class demonstrate how to initialize, destroy and drive the game loop of ParaEngine through the C...
Definition: ParaEngineApp.h:96