{ import: Box } { import: SDLSurface } { include "SDL/SDL.h" } Circle : Box () "fillCircle support odd number of diameter)" Circle center [ ^(position x + (extent x - 1 // 2)), (position y + (extent y - 1 // 2)) ] Circle radius [ ^extent x - 1 // 2 min: extent y - 1 // 2 ] Circle drawForegroundOn: aContext [ self foreground ifNil: [ ^nil ]. aContext saveColor; color: self foreground; fillCircle: self center radius: self radius; restoreColor. ] Circle drawBorderOn: aContext [ self border ifNil: [ ^nil ]. aContext saveColor; color: self border; drawCircle: self center radius: self radius; restoreColor. ] [ | window circle1 circle2 | window := Window new: 640, 480. circle1 := Circle new. circle1 extent: 20, 20. circle1 position: 50, 100. circle1 foreground: ColorYellow. circle1 border: ColorBlack. circle1 buttonDown: (DraggingHandler with: circle1). circle2 := Circle new. circle2 extent: 21, 21. circle2 position: 100, 100. circle2 foreground: ColorYellow. circle2 border: ColorBlack. circle2 buttonDown: (DraggingHandler with: circle2). window addFront: circle1. window addFront: circle2. window mainLoop. ]