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 wrap: on
line diff
--- a/src/Serpentron.st	Mon Feb 17 04:14:04 2020 +0300
+++ b/src/Serpentron.st	Fri Mar 13 14:54:23 2020 +0300
@@ -1,7 +1,7 @@
 Smalltalk createPackage: 'Serpentron'!
 (Smalltalk packageAt: 'Serpentron' ifAbsent: [ self error: 'Package not created: Serpentron' ]) imports: {'silk/Silk'}!
 Object subclass: #Serpentron
-	instanceVariableNames: 'field skin players playerColors controllerPrototypes score pointsToWin timeoutId startScreenVisible'
+	slots: {#field. #skin. #players. #playerColors. #controllerPrototypes. #score. #pointsToWin. #timeoutId. #startScreenVisible}
 	package: 'Serpentron'!
 !Serpentron commentStamp!
 The game UI.!
@@ -74,7 +74,8 @@
 			keyMap: #{
 				80 -> (0 @ -1).
 				222 -> (1 @ 0).
-				59 -> (0 @ 1).
+				59 -> (0 @ 1).  "; in Gecko (Firefox)"
+				186 -> (0 @ 1). "; in WebKit and Blink"
 				76 -> (-1 @ 0)}
 			name: 'PL;'''.
 		TronComputerController1 new.
@@ -377,7 +378,7 @@
 			margin: '0 auto'.
 ! !
 
-Serpentron class instanceVariableNames: 'Instance'!
+Serpentron class slots: {#Instance}!
 
 !Serpentron class methodsFor: 'compatibility'!
 
@@ -422,7 +423,7 @@
 ! !
 
 Object subclass: #TronCollider
-	instanceVariableNames: 'canvas context skin animationRequest lastFrameTime particles particlePool particlesPerCollision'
+	slots: {#canvas. #context. #skin. #animationRequest. #lastFrameTime. #particles. #particlePool. #particlesPerCollision}
 	package: 'Serpentron'!
 !TronCollider commentStamp!
 Particle system for collision effect.!
@@ -505,7 +506,7 @@
 ! !
 
 Object subclass: #TronColliderParticle
-	instanceVariableNames: 'color size velocity position alpha decay'
+	slots: {#color. #size. #velocity. #position. #alpha. #decay}
 	package: 'Serpentron'!
 
 !TronColliderParticle methodsFor: 'accessing'!
@@ -552,7 +553,7 @@
 ! !
 
 Object subclass: #TronController
-	instanceVariableNames: 'field player'
+	slots: {#field. #player}
 	package: 'Serpentron'!
 !TronController commentStamp!
 Abstract superclass for controlling input devices and algorithms.!
@@ -612,10 +613,10 @@
 reset
 ! !
 
-TronController class instanceVariableNames: 'directions'!
+TronController class slots: {#directions}!
 
 TronController subclass: #TronComputerController1
-	instanceVariableNames: 'weight aggressiveness'
+	slots: {#weight. #aggressiveness}
 	package: 'Serpentron'!
 
 !TronComputerController1 methodsFor: 'accessing'!
@@ -691,7 +692,7 @@
 ! !
 
 TronController subclass: #TronKeyboardController
-	instanceVariableNames: 'keyMap name'
+	slots: {#keyMap. #name}
 	package: 'Serpentron'!
 
 !TronKeyboardController methodsFor: 'accessing'!
@@ -712,10 +713,10 @@
 	^ true
 ! !
 
-TronKeyboardController class instanceVariableNames: 'keyMaps'!
+TronKeyboardController class slots: {#keyMaps}!
 
 TronController subclass: #TronRandomController
-	instanceVariableNames: ''
+	slots: {}
 	package: 'Serpentron'!
 
 !TronRandomController methodsFor: 'accessing'!
@@ -736,7 +737,7 @@
 ! !
 
 Object subclass: #TronField
-	instanceVariableNames: 'skin size matrix players livePlayers colors liveColors canvas context collider timerId onEndGame'
+	slots: {#skin. #size. #matrix. #players. #livePlayers. #colors. #liveColors. #canvas. #context. #collider. #timerId. #onEndGame}
 	package: 'Serpentron'!
 !TronField commentStamp!
 The game field. Provides game logic and rendering.!
@@ -955,7 +956,7 @@
 ! !
 
 Object subclass: #TronPlayer
-	instanceVariableNames: 'enabled color name controller segments location moved direction nextDirection onColorChange onEnabledChange onControllerChange'
+	slots: {#enabled. #color. #name. #controller. #segments. #location. #moved. #direction. #nextDirection. #onColorChange. #onEnabledChange. #onControllerChange}
 	package: 'Serpentron'!
 
 !TronPlayer methodsFor: 'accessing'!
@@ -1107,7 +1108,7 @@
 	^ segment
 ! !
 
-TronPlayer class instanceVariableNames: 'directions directionNames'!
+TronPlayer class slots: {#directions. #directionNames}!
 
 !TronPlayer class methodsFor: 'initialization'!
 
@@ -1131,7 +1132,7 @@
 ! !
 
 Object subclass: #TronSegment
-	instanceVariableNames: 'player sprite'
+	slots: {#player. #sprite}
 	package: 'Serpentron'!
 
 !TronSegment methodsFor: 'accessing'!
@@ -1161,7 +1162,7 @@
 ! !
 
 TronSegment subclass: #TronHead
-	instanceVariableNames: 'direction'
+	slots: {#direction}
 	package: 'Serpentron'!
 
 !TronHead methodsFor: 'accessing'!
@@ -1179,7 +1180,7 @@
 ! !
 
 Object subclass: #TronSkin
-	instanceVariableNames: 'skinMap skinImage tileSize maskOffset'
+	slots: {#skinMap. #skinImage. #tileSize. #maskOffset}
 	package: 'Serpentron'!
 
 !TronSkin methodsFor: 'accessing'!