#ifndef __CCCONTROLPOTENTIOMETER_H__

#define __CCCONTROLPOTENTIOMETER_H__

#include "CCControl.h"

NS_CC_EXT_BEGIN

/**

* @addtogroup GUI

* @{

* @addtogroup control_extension

* @{

*/

/** @class CCControlPotentiometer Potentiometer control for Cocos2D. */

class CCControlPotentiometer : public CCControl

{

public:

CCControlPotentiometer();

virtual ~CCControlPotentiometer();

/**

* Creates potentiometer with a track filename and a progress filename.

*/

static CCControlPotentiometer* create(const char* backgroundFile, const char* progressFile, const char* thumbFile);

/**

* Initializes a potentiometer with a track sprite and a progress bar.

*

* @param trackSprite CCSprite, that is used as a background.

* @param progressSprite CCProgressTimer, that is used as a progress bar.

*/

bool initWithTrackSprite_ProgressTimer_ThumbSprite(CCSprite* trackSprite, CCProgressTimer* progressTimer, CCSprite* thumbSprite);

void setValue(float value);

float getValue();

void setMinimumValue(float minimumValue);

float getMinimumValue();

void setMaximumValue(float maximumValue);

float getMaximumValue();

void setEnabled(bool enabled);

virtual bool isTouchInside(CCTouch * touch);

virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);

virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);

virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);

protected:

CC_SYNTHESIZE_RETAIN(CCSprite*, m_pThumbSprite, ThumbSprite)

CC_SYNTHESIZE_RETAIN(CCProgressTimer*, m_pProgressTimer, ProgressTimer)

CC_SYNTHESIZE(CCPoint, m_tPreviousLocation, PreviousLocation)

/** Contains the receiver’s current value. */

float           m_fValue;

/** Contains the minimum value of the receiver.

* The default value of this property is 0.0. */

float           m_fMinimumValue;

/** Contains the maximum value of the receiver.

* The default value of this property is 1.0. */

float           m_fMaximumValue;

/** Factorize the event dispath into these methods. */

void potentiometerBegan(CCPoint location);

void potentiometerMoved(CCPoint location);

void potentiometerEnded(CCPoint location);

/** Returns the distance between the point1 and point2. */

float distanceBetweenPointAndPoint(CCPoint point1, CCPoint point2);

/** Returns the angle in degree between line1 and line2. */

float angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(

CCPoint beginLineA,

CCPoint endLineA,

CCPoint beginLineB,

CCPoint endLineB);

};

// end of GUI group

/// @}

/// @}

NS_CC_EXT_END

#endif /* __CCCONTROLPOTENTIOMETER_H__ */


CCControlExtension/CCControlPotentiometer的更多相关文章

  1. GUI之CCControlExtension

    Introduction CCControl is inspired by the UIControl API class from the UIKit library of CocoaTouch. ...

  2. cocos2d-x特效之CCControlPotentiometer

    在test示例下面,有一个关于此功能的代码,实现的效果如下: 通过拉动可旋转的按钮,从而改变所代表的值,这个效果的确是很棒的,但,和我的需求有一些差别,先贴上我实现的效果吧               ...

  3. Cocos2d-x CCControlPotentiometer之圆形音量button及特效

    1. 圆形音量button 事实上作者的本意应该是叫做"电位计button".可是我觉得它和我们的圆形音量button非常像,所以就这么叫它吧~先看效果: 好了,不多解释,本篇到此 ...

  4. CCControlExtension/CCControl

    #ifndef __CCCONTROL_H__ #define __CCCONTROL_H__ #include "CCInvocation.h" #include "C ...

  5. CCControlExtension/CCControlButton

    #ifndef __CCCONTROL_BUTTON_H__ #define __CCCONTROL_BUTTON_H__ #include "CCControl.h" #incl ...

  6. cocos2d-x3.2 使用开关控制按钮 ControlSwitch

    ContolSwitch 控件起到了一个开关的作用类似于现实生活中的开关,直接上代码: .h文件 // // SwitchBtnScene.h // LSWGameIOS // // Created ...

  7. Cocos2D-x培训课程

    1.1 Cocos2D-x 什么是cocos2d-x cocos2d-x在游戏开发中的运用 cocos2d-x的几个重要版本特点 iOS环境下搭建cocos2d开发环境 windows平台搭建coco ...

  8. Cocos2d-x C++调用Android弹出提示框

    转载请注明地址,谢谢.. Cocos2d-x中提供了一个JniHelper类来让我们对Jni进行操作. (PS:弄了一天想自己写代码操作Jni的,但是总是出错,技术差不得不使用Cocos2d-x现成的 ...

  9. 按 Eclipse 开发喜好重新布置 cocos2dx 目录层次

    [tonyfield 2013.08.29 ] 1.  Cocos2dx 库的改动 处于个人的固执,花一天时间重新布置了cocos2dx 2.1.4的目录层次,将android平台无关的代码全数裁剪, ...

随机推荐

  1. Android中XML解析,保存的三种方法

    简单介绍 在Android开发中,关于XML解析有三种方式,各自是: SAX 基于事件的解析器.解析速度快.占用内存少.非常适合在Android移动设备中使用. DOM 在内存中以树形结构存放,因此检 ...

  2. JTCalendar

    JTCalendar是一款简易使用而且能够自己定义事件的日历.包含圈点标识的颜色等都能够自己定义.demo中还提供了转换日历模式的样例. 效果图: " style="margin: ...

  3. Windows 7 x64环境下JDK8安装过程

    Windows 7 x64环境下JDK8安装过程 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads ...

  4. 《C++编程思想》第四章 初始化与清除(原书代码+习题+解答)

    相关代码: 1. #include <stdio.h> class tree { int height; public: tree(int initialHeight); ~tree(); ...

  5. 数据格式与数据类型(Content-Type)

    常见数据类型: 文本文件: 二进制文件: 编码后的图像文件: jpeg png 网络中爬取的数据: 1. Content-Type Media Types Type text text/css tex ...

  6. htmlunit 简单操作

    首先我们新建一个Maven普通客户端项目,然后打开pom.xml 引入htmlunit支持: <dependency> <groupId>net.sourceforge.htm ...

  7. Redis学习笔记(二) Redis 数据类型

    Redis 支持五种数据类型:string(字符串).list(列表).hash(哈希).set(集合)和 zset(有序集合),接下来我们讲解分别讲解一下这五种类型的的使用. String(字符串) ...

  8. Ubuntu 14.04安装Skype

    Skype 4.3版本在14.04 LTS工作正常.安装步骤: $ sudo apt-get remove skype skype-bin:i386 skype:i386 $ sudo apt-get ...

  9. form&method【POST~GET】

    <form.../>中method属性指定了该表单是以哪种方式提交请求,有两种方式:GET请求方式和POST请求方式,默认是GET请求方式.两种方式的区别:get方式的请求是在浏览器地址栏 ...

  10. 问题集锦 ~ PHP

    #switch //当variable为数字0的时候,case为true,会执行第一段case代switch (variable) { case 'value': # code... break; d ...