2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#Compiles emscripten instance of this project for the web. Use "full" argument if your PGE has to be completely rebuilt. Use "headless" argument for a headless version.  
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:28:30 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								#C++  
						 
					
						
							
								
									
										
										
										
											2022-11-22 10:40:26 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								output = $( dpkg -l |  grep libx11-dev)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  [ [  -z $output  ] ]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								then  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fi  
						 
					
						
							
								
									
										
										
										
											2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  [ [  " $1 "  = =  "full"  ||  " $2 "  = =  "full"  ] ] ;  then  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    rm "pixelGameEngine_wasm.o" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fi  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  [  ! -f "pixelGameEngine_wasm.o"  ]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								then  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    printf  "Pixel Game Engine compile object missing. Compiling for the first time..." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    em++ -std= c++17 -O2 -s ALLOW_MEMORY_GROWTH = 1  -s MAX_WEBGL_VERSION = 2  -s MIN_WEBGL_VERSION = 2  -s USE_SDL_MIXER = 2  -s USE_LIBPNG = 1  -c pixelGameEngine.cpp -o pixelGameEngine_wasm.o
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fi  
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:28:30 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								if  [  -d "assets"  ] ;  then  
						 
					
						
							
								
									
										
										
										
											2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    em++ -std= c++17 -O2 -s ALLOW_MEMORY_GROWTH = 1  -s MAX_WEBGL_VERSION = 2  -s MIN_WEBGL_VERSION = 2  -s USE_SDL_MIXER = 2  -s USE_LIBPNG = 1  $( find . -type f -name "*.cpp"  -not -path "./test/*"  -not -name "pixelGameEngine.cpp" )  pixelGameEngine_wasm.o -o ${ PROJECT_NAME } .html --preload-file ./assets
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:28:30 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								else  
						 
					
						
							
								
									
										
										
										
											2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    em++ -std= c++17 -O2 -s ALLOW_MEMORY_GROWTH = 1  -s MAX_WEBGL_VERSION = 2  -s MIN_WEBGL_VERSION = 2  -s USE_SDL_MIXER = 2  -s USE_LIBPNG = 1  $( find . -type f -name "*.cpp"  -not -path "./test/*"  -not -name "pixelGameEngine.cpp" )  pixelGameEngine_wasm.o -o ${ PROJECT_NAME } .html
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:28:30 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								fi  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								cp buildtemplate.html ${ PROJECT_NAME } .html
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								sed -i " s/_REPLACEME_/ $PROJECT_NAME .js/ "  ${ PROJECT_NAME } .html
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  [ [  " $1 "  = =  "headless"  ||  " $2 "  = =  "headless"  ] ] ;  then  
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:28:30 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    echo  "Running as headless web server" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    emrun --no_browser ${ PROJECT_NAME } .html
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								else  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    emrun --serve_after_close ${ PROJECT_NAME } .html
							 
						 
					
						
							
								
									
										
										
										
											2022-12-29 02:24:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								fi