2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  CTutorialWindow . cpp ,  part  of  VCMI  engine 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Authors :  listed  in  file  AUTHORS  in  main  folder 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  License :  GNU  General  Public  License  v2 .0  or  later 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Full  text  of  license  available  in  license . txt  file ,  in  main  folder 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "StdInc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "CTutorialWindow.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../eventsSDL/InputHandler.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../../lib/CConfigHandler.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../../lib/CondSh.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../CPlayerInterface.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../gui/CGuiHandler.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "../gui/Shortcut.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "../gui/WindowHandler.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../widgets/Images.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "../widgets/Buttons.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "../widgets/TextControls.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CTutorialWindow : : CTutorialWindow ( const  TutorialMode  &  m )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									:  CWindowObject ( BORDERED ,  ImagePath : : builtin ( " DIBOXBCK " ) ) ,  mode  {  m  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pos  =  Rect ( pos . x ,  pos . y ,  540 ,  400 ) ;  //video: 480x320
 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									background  =  std : : make_shared < CFilledTexture > ( ImagePath : : builtin ( " DIBOXBCK " ) ,  Rect ( 0 ,  0 ,  pos . w ,  pos . h ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									updateShadow ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									center ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									addUsedEvents ( LCLICK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									buttonOk  =  std : : make_shared < CButton > ( Point ( 239 ,  367 ) ,  AnimationPath : : builtin ( " IOKAY " ) ,  CButton : : tooltip ( ) ,  std : : bind ( & CTutorialWindow : : close ,  this ) ,  EShortcut : : GLOBAL_ACCEPT ) ;  //62x28
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									buttonLeft  =  std : : make_shared < CButton > ( Point ( 5 ,  177 ) ,  AnimationPath : : builtin ( " HSBTNS3 " ) ,  CButton : : tooltip ( ) ,  std : : bind ( & CTutorialWindow : : previous ,  this ) ,  EShortcut : : MOVE_LEFT ) ;  //22x46
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									buttonRight  =  std : : make_shared < CButton > ( Point ( 513 ,  177 ) ,  AnimationPath : : builtin ( " HSBTNS5 " ) ,  CButton : : tooltip ( ) ,  std : : bind ( & CTutorialWindow : : next ,  this ) ,  EShortcut : : MOVE_RIGHT ) ;  //22x46
 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									buttonLeft - > block ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									labelTitle  =  std : : make_shared < CLabel > ( 270 ,  15 ,  FONT_BIG ,  ETextAlignment : : CENTER ,  Colors : : YELLOW ,  " Touchscreen Intro " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									labelInformation  =  std : : make_shared < CMultiLineLabel > ( Rect ( 5 ,  50 ,  530 ,  60 ) ,  EFonts : : FONT_MEDIUM ,  ETextAlignment : : CENTER ,  Colors : : WHITE ,  " Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  CTutorialWindow : : openWindowFirstTime ( const  TutorialMode  &  m )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( GH . input ( ) . hasTouchInputDevice ( )  & &  ! persistentStorage [ " gui " ] [ " tutorialCompleted "  +  std : : to_string ( m ) ] . Bool ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( LOCPLINT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											LOCPLINT - > showingDialog - > set ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GH . windows ( ) . pushWindow ( std : : make_shared < CTutorialWindow > ( m ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Settings  s  =  persistentStorage . write [ " gui " ] [ " tutorialCompleted "  +  std : : to_string ( m ) ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										s - > Bool ( )  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  CTutorialWindow : : close ( )  
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( LOCPLINT ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 21:52:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										LOCPLINT - > showingDialog - > setn ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WindowBase : : close ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  CTutorialWindow : : next ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  CTutorialWindow : : previous ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2023-11-14 22:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}