TButtonHolder


Croquet-Teapot

Comment:

TButtonHolder contains and positions TButtons in a 2D surface.

Hierarchy:

ProtoObject
Object
TObject
TFrame
TPrimitive
TRectangle
TButtonHolder

Summary:

Pool:

OpenGLConstants

methods:

instance class
accessing initialize render scriptThis no messages

Detail:

instance methods:

accessing
addChild: bttn


	| size box scale |
	box _ bttn boundingBox.
	scale _ 0.8/(box extentMax).
	bttn scale: scale.

	super addChild: bttn.
	size _ (frameChildren size)sqrt.
	self extent: ((size+1)@size).
extent: ext


	| dx dy ddx ddy topCorner box |
	dx _ ext x//1. 
dx _ 3.
	dx < 1 ifTrue: [ dx _ 1.].
	dy _ frameChildren size // dx.
	dx*dy < frameChildren size ifTrue:[dy _ dy + 1.].
	extent _ (dx asFloat)@(dy asFloat).
	topCorner _ (extent x/-2.0 + 0.5)@(extent y/2.0 - 0.5).
	frameChildren doWithIndex:[ :fc :index |
		ddx _ (index-1\\dx).
		ddy _ (index-1//dx) negated.
		box _ fc boundingBox.
		fc translationX: topCorner x + ddx-box center x y: topCorner y + ddy-box center y z:0.0.
		].

initialize
initialize

	super initialize.
	extent _ 2.0@1.0.
	self solid: false.
	^self

render
material: mat

pick: pointer


	^ false.
"	^super pick: pointer."
render: ogl


	"do nothing."
renderAlpha: ogl


	"do nothing."
	super renderAlpha: ogl.

scriptThis
makeNewSpace

	| sp2 light tframe p1 win p2 |

	sp2 _ TSpace new.
	sp2 color:  (Color
				r: 0.2
				g: 0.25
				b: 0.6).
	
	sp2 url: 'http://www.reed.com/TeaLand/spaces/newSpace.tea'.
"Add a light to the world "
	light _ TLight new.
	tframe _ TSpinner new.
	tframe translationX: -10 y:0.0 z: 0.0.
	tframe rotationAroundZ: 120.
	tframe addRotationAroundY:-10.
	tframe matNil.
	tframe contents: light.
	sp2 addChild: tframe.
	self makeFloor: sp2 fileName:'stone.bmp'.

	p1 _ TPortal new.

	win _ TWindow new.
	win translationX: 0 y: 0.0 z: -3.0.
	win contents: p1.
	Croquet world activeCamera addChild: win.
	win releaseWindow.

	p2 _ TPortal new.
	win _ TWindow new.
	win rotationAroundY: 225.
	win translationX: 40.0 y:2.0 z: 40.0.
	win contents: p2.
	sp2 addChild: win.
	p1 linkPortal: p2.
	^sp2
makeNewSpace: ptr

	| sp2 light tframe p1 win p2 |

	sp2 _ TSpace new.
	sp2 color:  (Color
				r: 0.2
				g: 0.25
				b: 0.6).
	
	sp2 url: 'http://www.reed.com/TeaLand/spaces/newSpace.tea'.
"Add a light to the world "
	light _ TLight new.
	tframe _ TSpinner new.
	tframe translationX: -10 y:0.0 z: 0.0.
	tframe rotationAroundZ: 120.
	tframe addRotationAroundY:-10.
	tframe matNil.
	tframe contents: light.
	sp2 addChild: tframe.
	self makeFloor: sp2 fileName:'stone.bmp'.

	p1 _ TPortal new.

	win _ TWindow new.
	win translationX: 0 y: 0.0 z: -3.0.
	win contents: p1.
	ptr avatar addChild: win.
	win releaseWindow.

	p2 _ TPortal new.
	win _ TWindow new.
	win rotationAroundY: 225.
	win translationX: 40.0 y:2.0 z: 40.0.
	win contents: p2.
	sp2 addChild: win.
	p1 linkPortal: p2.
	^sp2

class methods:

^top


- made by Dandelion -