SoundEffect 为画笔添加系统提示声音
1.初始化系统声音方法
+(id)soundEffectWithContentsOfFile:(NSString *)aPath
-(id)initWithContentsOfFile:(NSString *)path
2.播放系统声音方法
-(void)play
3.释放声音资源
-(void)dealloc
DrawingBoardVC 实现UI,并切换画笔颜色、清空屏幕事件
1.实现UI、添加事件按钮
- (void)setUpUI
3.清理屏幕
- (IBAction)earse:(id)sender
播放系统声音并抹去视图
- (void)eraseView
调用PaintView中的erase⽅方法
2.修改画笔颜色,选择控制器事件响应
-(void)changBrushColor:(id)sender
调用PaintView 中的- (void)setBrushColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue
PaintView 实现绘制、修改画笔颜色、 清空屏幕等事件
1.初始化PaintView
initWithCoder:(NSCoder *)aDecoder
2.-(void)layoutSubviews
没有初始化initialized 绘制”加 油!”
-(BOOL)initGL
手写着⾊器程序
pointv.vsh
pointf.fsh
加载纹理 - (textureInfo_t)textureFromName:(NSString *)name
加载Shader - (void)setupShaders
绘制已经存储顶点的”加油” -(void)paint
在2点之间绘制线条 -(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
已经初始化
- (BOOL)resizeFromLayer:(CAEAGLLayer *)layer
3.修改画笔颜⾊
- (void)setBrushColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue
4.清理屏幕
-(void)erase
5.开始绘制(任意图形、线条)
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
将2点绘制成线条
-(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
将2点绘制成线条
-(void)renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end
-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
Demo: 05-OpenGLES画板
网友评论