Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
60
Task/Death-Star/FutureBasic/death-star-2.basic
Normal file
60
Task/Death-Star/FutureBasic/death-star-2.basic
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
_window = 1
|
||||
begin enum 1
|
||||
_circularView
|
||||
_ovalView
|
||||
end enum
|
||||
|
||||
void local fn BuildWindow
|
||||
CGRect r = fn CGRectMake( 0, 0, 400, 400 )
|
||||
|
||||
window _window, @"Death Star", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
|
||||
WindowSetBackgroundColor( _window, fn ColorBlack )
|
||||
|
||||
r = fn CGRectMake( 20, 20, 360, 360 )
|
||||
subclass view _circularView, r
|
||||
|
||||
r = fn CGRectMake( 0, 120, 200, 200 )
|
||||
subclass view _ovalView, r
|
||||
end fn
|
||||
|
||||
local fn OvalView( tag as NSInteger )
|
||||
CGRect r = fn ViewBounds( tag )
|
||||
r.size.height *= 0.5
|
||||
CFArrayRef cols = @[fn ColorWithWhite(0.8,1),fn ColorBlack]
|
||||
BezierPathRef path = fn BezierPathWithOvalInRect( r )
|
||||
GradientRef grad = fn GradientWithColors( cols )
|
||||
GraphicsContextSaveGraphicsState
|
||||
AffineTransformRef tx = fn AffineTransformInit
|
||||
NSPoint center = fn CGPointMake( fn CGRectGetMidX(r), fn CGRectGetMidY(r))
|
||||
center.x -= 25
|
||||
AffineTransformTranslate( tx, center.x, center.y )
|
||||
AffineTransformRotateByDegrees( tx, 52 )
|
||||
AffineTransformConcat( tx )
|
||||
GradientDrawInBezierPath( grad, path, 0.0 )
|
||||
GraphicsContextRestoreGraphicsState
|
||||
end fn
|
||||
|
||||
local fn CircularView( tag as NSinteger )
|
||||
CGRect r = fn ViewBounds( tag )
|
||||
CFArrayRef cols = @[fn ColorWithWhite(0.1,1),fn ColorWhite]
|
||||
BezierPathRef path = fn BezierPathWithOvalInRect( r )
|
||||
GradientRef grad = fn GradientWithColors( cols )
|
||||
GradientDrawInBezierPath( grad, path, 0.0 )
|
||||
end fn
|
||||
|
||||
void local fn DoDialog( ev as long, tag as long )
|
||||
select ( ev )
|
||||
case _viewDrawRect
|
||||
select ( tag )
|
||||
case _circularView : fn CircularView( tag )
|
||||
case _ovalView : fn OvalView( tag)
|
||||
end select
|
||||
case _windowWillClose : end
|
||||
end select
|
||||
end fn
|
||||
|
||||
on dialog fn DoDialog
|
||||
|
||||
fn BuildWindow
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue