changeset 7:66d8fd6a64e8

Browser compatibility check.
author Mikhail Kryshen <mikhail@kryshen.net>
date Wed, 23 Mar 2016 21:34:08 +0300
parents 11c20013e0e5
children b32efce2d860
files src/Serpentron.st
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/src/Serpentron.st	Thu Feb 18 01:35:45 2016 +0300
     1.2 +++ b/src/Serpentron.st	Wed Mar 23 21:34:08 2016 +0300
     1.3 @@ -319,6 +319,12 @@
     1.4  !Serpentron methodsFor: 'rendering'!
     1.5  
     1.6  augmentPage
     1.7 +	Serpentron isCompatibleBrowser ifFalse: [
     1.8 +		'#serpentron' asSilk resetContents
     1.9 +			<< 'Your browser is not supported.'
    1.10 +			<< Silk BR
    1.11 +			<< 'Please use a modern browser to run the game.'.
    1.12 +		^ self ].
    1.13  	'#serpentron' asSilk resetContents << 'Loading...'.
    1.14  	skin
    1.15  		load: 'resources/skin.png'
    1.16 @@ -362,6 +368,15 @@
    1.17  
    1.18  Serpentron class instanceVariableNames: 'Instance'!
    1.19  
    1.20 +!Serpentron class methodsFor: 'compatibility'!
    1.21 +
    1.22 +isCompatibleBrowser
    1.23 +	"No reason to polyfill requestAnimationFrame
    1.24 +	 or use vendor prefixes as browsers that do not have it
    1.25 +	 will likely have other incompatibilities."
    1.26 +	< return window.requestAnimationFrame && true || false >
    1.27 +! !
    1.28 +
    1.29  !Serpentron class methodsFor: 'starting'!
    1.30  
    1.31  start