2013-12-18 39 views
9

我試圖用一個非常認真的筆畫(如0.25像素)做一個SKShapeNode。看來1的lineWidth是我可以去的最小的,至少這就是它在屏幕上看起來不像什麼值小於1的設置。如何爲SKShapeNode設置小於1的線寬?

SKShapeNode *buttonOutline; 
buttonOutline = [[SKShapeNode alloc] init]; 

CGMutablePathRef myPath = CGPathCreateMutable(); 
CGPathAddRoundedRect(myPath, NULL, CGRectMake(0, 0, 100, 30), 10, 10);  
buttonOutline.path = myPath; 
buttonOutline.strokeColor=[SKColor grayColor]; 

buttonOutline.lineWidth= 0.25; 

buttonOutline.name = [NSString stringWithFormat:@"%@-buttonOutline", thisButtonName]; 
buttonOutline.position = CGPointMake(thisXPos,thisYPod); 
buttonOutline.alpha = 1; 

回答

12

嘗試將antialiased屬性設置爲false。抗鋸齒增加了一些額外的像素。

// Objective-C 
buttonOutline.antialiased = NO 

// Swift 
buttonOutline.antialiased = false 
+0

謝謝你提供的,這個工作,我無法找到在此文檔的任何地方 –

0

設定的比例爲.25,記住正確高檔座標(乘以4在這種情況下)

相關問題