Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
41
Task/Yin-and-yang/FutureBasic/yin-and-yang.basic
Normal file
41
Task/Yin-and-yang/FutureBasic/yin-and-yang.basic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
_window = 1
|
||||
begin enum output 1
|
||||
_imageView1
|
||||
_imageView2
|
||||
end enum
|
||||
|
||||
local fn YinYangImage( size as float ) as ImageRef
|
||||
CFDictionaryRef attributes = @{NSFontAttributeName:fn FontWithName( @"Menlo", size ), NSBackgroundColorAttributeName:fn ColorClear}
|
||||
CFMutableAttributedStringRef aString = fn MutableAttributedStringWithAttributes( @"\u262F", attributes )
|
||||
ImageRef image = fn ImageWithSize( fn AttributedStringSize( aString ) )
|
||||
ImageLockFocus( image )
|
||||
GraphicsContextSaveGraphicsState
|
||||
AttributedStringDrawAtPoint( aString, fn CGPointMake( 0, 0 ) )
|
||||
GraphicsContextRestoreGraphicsState
|
||||
ImageUnlockFocus( image )
|
||||
end fn = image
|
||||
|
||||
void local fn BuildWindow
|
||||
CGRect r = fn CGRectMake( 0, 0, 300, 200 )
|
||||
window _window, @"Rosetta Code Yin and Yang", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
|
||||
WindowSetBackgroundColor( _window, fn ColorWhite )
|
||||
|
||||
ImageRef yinyang = fn YinYangImage( 250.0 )
|
||||
r = fn CGRectMake( 20, 10, 170, 180 )
|
||||
imageview _imageView1, YES, yinyang, r, NSImageScaleNone, NSImageAlignCenter, NSImageFrameNone, _window
|
||||
|
||||
r = fn CGRectMake( 190, 90, 100, 100 )
|
||||
imageview _imageView2, YES, yinyang, r, NSImageScaleProportionallyDown, NSImageAlignCenter, NSImageFrameNone, _window
|
||||
end fn
|
||||
|
||||
void local fn DoDialog( ev as long, tag as long, wnd as long )
|
||||
select ( ev )
|
||||
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