All pastes #350101 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-11 06:43 UTC
rendered paste body
Object subclass: #JoeBox
	instanceVariableNames: 'pen size name '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JoeTheBox'!

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 17:04'!
draw
	self drawColor: (Color black).
	self drawName.
	(Delay forSeconds: (1/20)) wait.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:48'!
drawColor: color
	pen color: color.
	4 timesRepeat: [pen go: size; turn: 90]! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:49'!
drawName
	(self name) = nil ifFalse: [
		| displayName colorGenerator|
		displayName _ name asDisplayText.
		colorGenerator _ Random new.
		displayName 
			foregroundColor: 
				(Color r: colorGenerator next
					   g: colorGenerator next
					   b: colorGenerator next)
			backgroundColor: (Color white).
		displayName displayAt: (pen location)]! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:01'!
grow: increment
	self undraw.
	size _ size + increment.
	self draw.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:44'!
initialize
	pen _ Pen new.
	pen place: 100@100.
	size _ 50.
	self draw.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:45'!
move: pointIncrement
	self undraw.
	pen place: (pen location) + pointIncrement.
	self draw.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:45'!
moveTo: aPoint
	self undraw.
	pen place: aPoint.
	self draw.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:11'!
name
	^name! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:11'!
name: aName
	name _ aName! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:45'!
turn: degrees
	self undraw.
	pen turn: degrees.
	self draw.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 17:20'!
undraw
	self drawColor: (World color).
	self undrawName.! !

!JoeBox methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 16:50'!
undrawName
	(self name) = nil ifFalse: [
		| displayName |
		displayName _ name asDisplayText.
		displayName 
			foregroundColor: (Color white)
			backgroundColor: (Color white).
		displayName displayAt: (pen location)]! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JoeBox class
	instanceVariableNames: ''!

!JoeBox class methodsFor: 'as yet unclassified' stamp: 'picxenk 2/1/2004 14:54'!
new
	
	^super new initialize
! !