This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HelloWorldAVR.c | |
* | |
* Created: 03.06.2015 18:51:15 | |
* Author: Dmitry Victorov | |
*/ | |
#define F_CPU 1000000UL // ATmega16 Internal clock frequency | |
#include <stdbool.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) update: (ccTime) t | |
{ | |
// XXX: shall I add % 360 | |
if (_angleX == _angleY) | |
[_target setRotation:_startAngleX + _angleX * t]; | |
else | |
{ | |
[_target setRotationX:(_startAngleX + _angleX * t)]; | |
[_target setRotationY:(_startAngleY + _angleY * t)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)update:(ccTime)t | |
{ | |
NSAssert([_target isKindOfClass:[CCNode class]], @"Target is not CCNode"); | |
// XXX: shall I add % 360 | |
if (_angleX == _angleY) | |
[(CCNode *)_target setRotation:_startAngleX + _angleX * t]; | |
else | |
{ | |
[_target setRotationX:(_startAngleX + _angleX * t)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) startWithTarget:(CCNode *)aTarget | |
{ | |
[super startWithTarget:aTarget]; | |
startAngle_ = [self.target rotation]; | |
diffAngle_ = dstAngle_ - startAngle_; | |
} | |
-(void) update: (ccTime) t | |
{ | |
[self.target setRotation: startAngle_ + diffAngle_ * t]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) startWithTarget:(CCNode *)aTarget | |
{ | |
[super startWithTarget:aTarget]; | |
NSAssert([self.target isKindOfClass:[CCNode class]], @"Target is not CCNode"); | |
startAngle_ = [(CCNode *)self.target rotation]; | |
diffAngle_ = dstAngle_ - startAngle_; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needed to work with attributed strings | |
#import <CoreText/CoreText.h> | |
// Somewhere in drawing code, that renders string: | |
NSMutableParagraphStyle *paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; | |
paragraphStyle.alignment = alignments[hAlignment]; | |
paragraphStyle.lineBreakMode = linebreaks[lineBreakMode]; | |
NSDictionary *attributes = @{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In interface definition | |
CGPoint *vertices; | |
CGPoint *coordinates; | |
// In drawing function | |
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); | |
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, coordinates); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSInteger angle = arc4random_uniform(90) - 45; |