2018-09-05 13:17:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  "..\e2dmodule.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-09-06 23:26:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  "..\e2dobject.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  "..\e2dtransition.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-04-21 21:24:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  "..\e2dmanager.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-07-21 22:57:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# include  <thread> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								e2d : : Game  *  e2d : : Game : : instance_  =  nullptr ;  
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								e2d : : Game  *  e2d : : Game : : GetInstance ( )  
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( ! instance_ ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										instance_  =  new  ( std : : nothrow )  Game ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									return  instance_ ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : DestroyInstance ( )  
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( instance_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										delete  instance_ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										instance_  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-28 00:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-03 01:49:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								e2d : : Game : : Game ( )  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									:  quit_ ( true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									,  paused_ ( false ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									,  curr_scene_ ( nullptr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									,  next_scene_ ( nullptr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									,  transition_ ( nullptr ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-03 01:49:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-02 14:03:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									: : CoInitialize ( nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-03 01:49:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-03 18:16:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								e2d : : Game : : ~ Game ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-07 00:28:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									SafeRelease ( transition_ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									SafeRelease ( curr_scene_ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									SafeRelease ( next_scene_ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 14:03:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									: : CoUninitialize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-03 18:16:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : Start ( )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									quit_  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									auto  window  =  Window : : GetInstance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									auto  input  =  Input : : GetInstance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									auto  renderer  =  Renderer : : GetInstance ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 13:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-02 00:27:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									const  int  minInterval  =  5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									Time  last  =  Time : : Now ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									HWND  hWnd  =  window - > GetHWnd ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-02 00:27:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2018-07-21 22:57:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									: : ShowWindow ( hWnd ,  SW_SHOWNORMAL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									: : UpdateWindow ( hWnd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									window - > Poll ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									UpdateScene ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 01:43:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									while  ( ! quit_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										auto  now  =  Time : : Now ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-02 00:27:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										auto  dur  =  now  -  last ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( dur . Milliseconds ( )  >  minInterval ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-02 00:27:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											last  =  now ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											input - > Update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-19 15:11:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 23:47:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											UpdateScene ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											DrawScene ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 23:47:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											window - > Poll ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-12 14:05:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
											// ID2D1HwndRenderTarget <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ˴ <EFBFBD> ֱͬ<D6B1> <CDAC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ⱦʱ<C8BE> <CAB1> <EFBFBD> ȴ<EFBFBD> <C8B4> <EFBFBD> ʾ <EFBFBD> <CABE> ˢ<EFBFBD> £<EFBFBD> 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 13:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
											// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˷dz<CBB7> <C7B3> ȶ<EFBFBD> <C8B6> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> <EFBFBD> ã<EFBFBD> <C3A3> <EFBFBD> <EFBFBD> Դ<D4B4> ʱ<EFBFBD> <CAB1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> ֶ<EFBFBD> <D6B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߳̽<DFB3> <CCBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
											// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ĵ<EFBFBD> <C4B4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> һ <D2BB> <D0A9> <EFBFBD> <EFBFBD> <EFBFBD> £<EFBFBD> <C2A3> <EFBFBD> <EFBFBD> 細<EFBFBD> <E7B4B0> <EFBFBD> <EFBFBD> С <EFBFBD> <D0A1> ʱ<EFBFBD> <CAB1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̣߳<DFB3> <CCA3> <EFBFBD> ֹռ <D6B9> ù<EFBFBD> <C3B9> <EFBFBD>  CPU <20> <> 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											int  wait  =  minInterval  -  dur . Milliseconds ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 13:44:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											if  ( wait  >  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
												std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( wait ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : Pause ( )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									paused_  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : Resume ( )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( paused_  & &  ! quit_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-24 00:58:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-05 00:08:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( curr_scene_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 18:20:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											curr_scene_ - > GetRoot ( ) - > UpdateTime ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-24 00:58:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									paused_  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-10 18:18:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								bool  e2d : : Game : : IsPaused ( )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									return  paused_ ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : Quit ( )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									quit_  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : EnterScene ( Scene  *  scene ,  Transition  *  transition )  
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( scene  = =  nullptr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										WARN ( " Next scene is null pointer! " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									if  ( next_scene_  ! =  nullptr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										WARN ( " Scene is transitioning... " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-07 00:28:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( next_scene_ ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										next_scene_ - > Release ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									next_scene_  =  scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									next_scene_ - > Retain ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( transition ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( transition_ ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											transition_ - > Stop ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											transition_ - > Release ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										transition_  =  transition ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										transition_ - > Retain ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-10 15:28:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										transition_ - > Init ( curr_scene_ ,  next_scene_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								e2d : : Scene  *  e2d : : Game : : GetCurrentScene ( )  
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									return  curr_scene_ ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								bool  e2d : : Game : : IsTransitioning ( )  const  
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									return  transition_  ! =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : UpdateScene ( )  
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-07 23:47:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( paused_ ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( transition_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										transition_ - > Update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( transition_ - > IsDone ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											transition_ - > Release ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											transition_  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									if  ( next_scene_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( curr_scene_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											curr_scene_ - > OnExit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 23:20:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											curr_scene_ - > Release ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										next_scene_ - > OnEnter ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										curr_scene_  =  next_scene_ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										next_scene_  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								void  e2d : : Game : : DrawScene ( )  
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									Renderer : : GetInstance ( ) - > BeginDraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										if  ( transition_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											transition_ - > Draw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										else  if  ( curr_scene_ ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 23:26:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
											curr_scene_ - > Draw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 23:30:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-04 22:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
									Renderer : : GetInstance ( ) - > EndDraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-30 16:45:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}