[etoys-dev] Etoys: MorphicExtras-kfr.42.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Oct 14 13:21:59 EDT 2011
Karl Ramberg uploaded a new version of MorphicExtras to project Etoys:
http://source.squeak.org/etoys/MorphicExtras-kfr.42.mcz
==================== Summary ====================
Name: MorphicExtras-kfr.42
Author: kfr
Time: 14 October 2011, 7:21:17 pm
UUID: dd83d85e-46aa-ef41-8aaf-415813c4882d
Ancestors: MorphicExtras-kfr.41
Some more fixes. Leaving project camera is turned off. entering its turned on again (if it was previously left on). Renamed category
=============== Diff against MorphicExtras-kfr.41 ===============
Item was changed:
----- Method: WebCamMorph class>>additionsToViewerCategories (in category 'scripting') -----
additionsToViewerCategories
"Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories."
^ #(
+ (#'camera' (
- (#'camera settings' (
(slot resolution '160x120, 320x240 or 640x480'
WebCamResolution readWrite Player getWebCamResolution Player setWebCamResolution:)
(slot cameraIsOn 'Whether the camera is on/off' Boolean readWrite Player getWebCamIsOn Player setWebCamIsOn:)
(slot useFrameSize 'Resize the morph to match the cameras frame size'
Boolean readWrite Player getUseFrameSize Player setUseFrameSize:)
(slot lastFrame 'A morph with the last frame' Player readOnly Player getLastFrame unused unused)
(slot graphic 'The picture currently being worn' Graphic readOnly Player getVideoGraphic unused unused)
))
)
!
Item was added:
+ ----- Method: WebCamMorph>>intoWorld: (in category 'initialization') -----
+ intoWorld: aWorld
+
+ super intoWorld: aWorld.
+ camIsOn ifTrue: [self on]
+ ifFalse:[self off].
+ self removeActionsForEvent: #aboutToEnterWorld.
+ aWorld
+ when: #aboutToLeaveWorld
+ send: #outOfWorld:
+ to: self
+ with: aWorld.!
Item was changed:
----- Method: WebCamMorph>>nextFrame (in category 'stepping and presenter') -----
nextFrame
+
CameraInterface getFrameForCamera: camNum into: displayForm bits.
!
Item was changed:
----- Method: WebCamMorph>>on (in category 'accessing') -----
on
+
- camIsOn
- ifTrue: [^ true].
- "Avoid more than one WebCamMorph per
- Camera "
(CameraInterface cameraIsOpen: camNum)
ifTrue: [^ false].
(CameraInterface
openCamera: camNum
width: frameExtent x
height: frameExtent y)
ifNil: [^ false].
(Delay forSeconds: 1) wait.
+ displayForm := Form extent: frameExtent depth:32.
- "why?"
camIsOn := true.
self startStepping.
^ true!
Item was added:
+ ----- Method: WebCamMorph>>outOfWorld: (in category 'initialization') -----
+ outOfWorld: aWorld
+
+ super outOfWorld: aWorld.
+ camIsOn ifTrue: [self off. camIsOn := true].
+ aWorld
+ when: #aboutToEnterWorld
+ send: #intoWorld:
+ to: self
+ with: aWorld.!
Item was changed:
----- Method: WebCamMorph>>updateDisplay (in category 'stepping and presenter') -----
updateDisplay
self getWebCamIsOn
ifFalse: [displayForm getCanvas
drawString: 'Camera is off'
at: 5 @ 2
font: Preferences windowTitleFont
color: Color white.
]
ifTrue:[self nextFrame].
self changed.!
More information about the etoys-dev
mailing list