changeset 19:733ad1ed5548

Handle ; key in WebKit and Blink based browsers.
author Mikhail Kryshen <mikhail@kryshen.net>
date Fri, 13 Mar 2020 14:54:23 +0300
parents 392c2a5ebab4
children c8162ac60edc
files src/Serpentron.st
diffstat 1 files changed, 18 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/src/Serpentron.st	Mon Feb 17 04:14:04 2020 +0300
     1.2 +++ b/src/Serpentron.st	Fri Mar 13 14:54:23 2020 +0300
     1.3 @@ -1,7 +1,7 @@
     1.4  Smalltalk createPackage: 'Serpentron'!
     1.5  (Smalltalk packageAt: 'Serpentron' ifAbsent: [ self error: 'Package not created: Serpentron' ]) imports: {'silk/Silk'}!
     1.6  Object subclass: #Serpentron
     1.7 -	instanceVariableNames: 'field skin players playerColors controllerPrototypes score pointsToWin timeoutId startScreenVisible'
     1.8 +	slots: {#field. #skin. #players. #playerColors. #controllerPrototypes. #score. #pointsToWin. #timeoutId. #startScreenVisible}
     1.9  	package: 'Serpentron'!
    1.10  !Serpentron commentStamp!
    1.11  The game UI.!
    1.12 @@ -74,7 +74,8 @@
    1.13  			keyMap: #{
    1.14  				80 -> (0 @ -1).
    1.15  				222 -> (1 @ 0).
    1.16 -				59 -> (0 @ 1).
    1.17 +				59 -> (0 @ 1).  "; in Gecko (Firefox)"
    1.18 +				186 -> (0 @ 1). "; in WebKit and Blink"
    1.19  				76 -> (-1 @ 0)}
    1.20  			name: 'PL;'''.
    1.21  		TronComputerController1 new.
    1.22 @@ -377,7 +378,7 @@
    1.23  			margin: '0 auto'.
    1.24  ! !
    1.25  
    1.26 -Serpentron class instanceVariableNames: 'Instance'!
    1.27 +Serpentron class slots: {#Instance}!
    1.28  
    1.29  !Serpentron class methodsFor: 'compatibility'!
    1.30  
    1.31 @@ -422,7 +423,7 @@
    1.32  ! !
    1.33  
    1.34  Object subclass: #TronCollider
    1.35 -	instanceVariableNames: 'canvas context skin animationRequest lastFrameTime particles particlePool particlesPerCollision'
    1.36 +	slots: {#canvas. #context. #skin. #animationRequest. #lastFrameTime. #particles. #particlePool. #particlesPerCollision}
    1.37  	package: 'Serpentron'!
    1.38  !TronCollider commentStamp!
    1.39  Particle system for collision effect.!
    1.40 @@ -505,7 +506,7 @@
    1.41  ! !
    1.42  
    1.43  Object subclass: #TronColliderParticle
    1.44 -	instanceVariableNames: 'color size velocity position alpha decay'
    1.45 +	slots: {#color. #size. #velocity. #position. #alpha. #decay}
    1.46  	package: 'Serpentron'!
    1.47  
    1.48  !TronColliderParticle methodsFor: 'accessing'!
    1.49 @@ -552,7 +553,7 @@
    1.50  ! !
    1.51  
    1.52  Object subclass: #TronController
    1.53 -	instanceVariableNames: 'field player'
    1.54 +	slots: {#field. #player}
    1.55  	package: 'Serpentron'!
    1.56  !TronController commentStamp!
    1.57  Abstract superclass for controlling input devices and algorithms.!
    1.58 @@ -612,10 +613,10 @@
    1.59  reset
    1.60  ! !
    1.61  
    1.62 -TronController class instanceVariableNames: 'directions'!
    1.63 +TronController class slots: {#directions}!
    1.64  
    1.65  TronController subclass: #TronComputerController1
    1.66 -	instanceVariableNames: 'weight aggressiveness'
    1.67 +	slots: {#weight. #aggressiveness}
    1.68  	package: 'Serpentron'!
    1.69  
    1.70  !TronComputerController1 methodsFor: 'accessing'!
    1.71 @@ -691,7 +692,7 @@
    1.72  ! !
    1.73  
    1.74  TronController subclass: #TronKeyboardController
    1.75 -	instanceVariableNames: 'keyMap name'
    1.76 +	slots: {#keyMap. #name}
    1.77  	package: 'Serpentron'!
    1.78  
    1.79  !TronKeyboardController methodsFor: 'accessing'!
    1.80 @@ -712,10 +713,10 @@
    1.81  	^ true
    1.82  ! !
    1.83  
    1.84 -TronKeyboardController class instanceVariableNames: 'keyMaps'!
    1.85 +TronKeyboardController class slots: {#keyMaps}!
    1.86  
    1.87  TronController subclass: #TronRandomController
    1.88 -	instanceVariableNames: ''
    1.89 +	slots: {}
    1.90  	package: 'Serpentron'!
    1.91  
    1.92  !TronRandomController methodsFor: 'accessing'!
    1.93 @@ -736,7 +737,7 @@
    1.94  ! !
    1.95  
    1.96  Object subclass: #TronField
    1.97 -	instanceVariableNames: 'skin size matrix players livePlayers colors liveColors canvas context collider timerId onEndGame'
    1.98 +	slots: {#skin. #size. #matrix. #players. #livePlayers. #colors. #liveColors. #canvas. #context. #collider. #timerId. #onEndGame}
    1.99  	package: 'Serpentron'!
   1.100  !TronField commentStamp!
   1.101  The game field. Provides game logic and rendering.!
   1.102 @@ -955,7 +956,7 @@
   1.103  ! !
   1.104  
   1.105  Object subclass: #TronPlayer
   1.106 -	instanceVariableNames: 'enabled color name controller segments location moved direction nextDirection onColorChange onEnabledChange onControllerChange'
   1.107 +	slots: {#enabled. #color. #name. #controller. #segments. #location. #moved. #direction. #nextDirection. #onColorChange. #onEnabledChange. #onControllerChange}
   1.108  	package: 'Serpentron'!
   1.109  
   1.110  !TronPlayer methodsFor: 'accessing'!
   1.111 @@ -1107,7 +1108,7 @@
   1.112  	^ segment
   1.113  ! !
   1.114  
   1.115 -TronPlayer class instanceVariableNames: 'directions directionNames'!
   1.116 +TronPlayer class slots: {#directions. #directionNames}!
   1.117  
   1.118  !TronPlayer class methodsFor: 'initialization'!
   1.119  
   1.120 @@ -1131,7 +1132,7 @@
   1.121  ! !
   1.122  
   1.123  Object subclass: #TronSegment
   1.124 -	instanceVariableNames: 'player sprite'
   1.125 +	slots: {#player. #sprite}
   1.126  	package: 'Serpentron'!
   1.127  
   1.128  !TronSegment methodsFor: 'accessing'!
   1.129 @@ -1161,7 +1162,7 @@
   1.130  ! !
   1.131  
   1.132  TronSegment subclass: #TronHead
   1.133 -	instanceVariableNames: 'direction'
   1.134 +	slots: {#direction}
   1.135  	package: 'Serpentron'!
   1.136  
   1.137  !TronHead methodsFor: 'accessing'!
   1.138 @@ -1179,7 +1180,7 @@
   1.139  ! !
   1.140  
   1.141  Object subclass: #TronSkin
   1.142 -	instanceVariableNames: 'skinMap skinImage tileSize maskOffset'
   1.143 +	slots: {#skinMap. #skinImage. #tileSize. #maskOffset}
   1.144  	package: 'Serpentron'!
   1.145  
   1.146  !TronSkin methodsFor: 'accessing'!