Class cc.$

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.$(x)
the dollar sign, classic like jquery, this selector add extra methods to HTMLElement without touching its prototype
it is also chainable like jquery

Method Summary

Class Detail

cc.$(x)
the dollar sign, classic like jquery, this selector add extra methods to HTMLElement without touching its prototype
it is also chainable like jquery
Parameters:
{HTMLElement|String} x
pass in a css selector in string or the whole HTMLElement
Returns:
{cc.$}

Method Detail

  • addAttribute(attributeName, index)
    It will add a new attribute to the shader
    Defined in: CCGLProgram.js.
    Parameters:
    {String} attributeName
    {Number} index
  • addVertex(p)
    add vertex
    Defined in: CCDatas.js.
    Parameters:
    {cc.Point} p
  • createWidget(jsonDict, fullPath, fileName)

    Defined in: GUIReader.js.
    Parameters:
    jsonDict
    fullPath
    fileName
  • ctor(boxSize)
    * Constructor.
    Defined in: CCEditBox.js.
    Parameters:
    boxSize
  • editBoxEditingDidBegin(sender)
    This method is called when an edit box gains focus after keyboard is shown.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.EditBox} sender
  • editBoxEditingDidEnd(sender)
    This method is called when an edit box loses focus after keyboard is hidden.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.EditBox} sender
  • editBoxReturn(sender)
    This method is called when the return button was pressed or the outside area of keyboard was touched.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.EditBox} sender
  • editBoxTextChanged(sender, text)
    This method is called when the edit box text was changed.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.EditBox} sender
    {String} text
  • {String} fragmentShaderLog()
    returns the fragmentShader error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • {String} getFragmentShaderLog()
    returns the fragmentShader error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • {HTMLElement} getHtmlElementObj()
    HTMLElement Object getter
    Defined in: CCTexture2D.js.
    Returns:
    {HTMLElement}
  • {Number} getMaxLength()
    Gets the maximum input length of the edit box.
    Defined in: CCEditBox.js.
    Returns:
    {Number} Maximum input length.
  • {String} getPlaceHolder()
    Get a text in the edit box that acts as a placeholder when an edit box is empty.
    Defined in: CCEditBox.js.
    Returns:
    {String}
  • {WebGLProgram} getProgram()
    get WebGLProgram object
    Defined in: CCGLProgram.js.
    Returns:
    {WebGLProgram}
  • {String} getProgramLog()
    returns the program error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • {string} getText()
    Gets the input string of the edit box.
    Defined in: CCEditBox.js.
    Returns:
    {string}
  • {Number} getUniformLocationForName(name)
    calls retrieves the named uniform location for this shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {String} name
    Returns:
    {Number}
  • {String} getVertexShaderLog()
    returns the vertexShader error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • {Boolean} init(vShaderFilename, fShaderFileName)
    Initializes the CCGLProgram with a vertex and fragment with contents of filenames
    Defined in: CCGLProgram.js.
    Parameters:
    {String} vShaderFilename
    {String} fShaderFileName
    Returns:
    {Boolean}
  • initWithSizeAndBackgroundSprite(size, normal9SpriteBg)
    Init edit box with specified size.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.Size} size
    {cc.Color | cc.Scale9Sprite} normal9SpriteBg
  • {Boolean} initWithString(vertShaderStr, fragShaderStr)
    Initializes the cc.GLProgram with a vertex and fragment with string
    Defined in: CCGLProgram.js.
    Parameters:
    {String} vertShaderStr
    {String} fragShaderStr
    Returns:
    {Boolean}
  • {Boolean} initWithVertexShaderByteArray(vertShaderStr, fragShaderStr)
    Initializes the cc.GLProgram with a vertex and fragment with string
    Defined in: CCGLProgram.js.
    Parameters:
    {String} vertShaderStr
    {String} fragShaderStr
    Returns:
    {Boolean}
  • {Boolean} initWithVertexShaderFilename(vShaderFilename, fShaderFileName)
    Initializes the CCGLProgram with a vertex and fragment with contents of filenames
    Defined in: CCGLProgram.js.
    Parameters:
    {String} vShaderFilename
    {String} fShaderFileName
    Returns:
    {Boolean}
  • links the glProgram
    Defined in: CCGLProgram.js.
    Returns:
    {Boolean}
  • {String} programLog()
    returns the program error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • reset()
    reload all shaders, this function is designed for android
    when opengl context lost, so don't call it.
    Defined in: CCGLProgram.js.
  • {cc.$} resize(x, y)
    resize the element
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {cc.$}
  • retain()
    Currently JavaScript Bindings (JSB), in some cases, needs to use retain and release. This is a bug in JSB, and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. This is a hack, and should be removed once JSB fixes the retain/release bug
    Defined in: CCGLProgram.js.
  • {cc.$} rotate(x)
    rotate the element
    Parameters:
    {Number} x
    in degrees
    Returns:
    {cc.$}
  • setColorPropsForWidgetFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setDelegate(delegate)
    Set the delegate for edit box.
    Defined in: CCEditBox.js.
    Parameters:
    delegate
  • setFont(fontName, fontSize)
    Set the font.
    Defined in: CCEditBox.js.
    Parameters:
    {String} fontName
    The font name.
    {Number} fontSize
    The font size.
  • setFontColor(color)
    Set the font color of the widget's text.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.Color} color
  • setFontName(fontName)
    set fontName
    Defined in: CCEditBox.js.
    Parameters:
    {String} fontName
  • setFontSize(fontSize)
    set fontSize
    Defined in: CCEditBox.js.
    Parameters:
    {Number} fontSize
  • setInputFlag(inputFlag)
    Set the input flags that are to be applied to the edit box.
    Defined in: CCEditBox.js.
    Parameters:
    {Number} inputFlag
    One of the EditBoxInputFlag constants. e.g.cc.EDITBOX_INPUT_FLAG_PASSWORD
  • setInputMode(inputMode)
    Set the input mode of the edit box.
    Defined in: CCEditBox.js.
    Parameters:
    {Number} inputMode
    One of the EditBoxInputMode constants.
  • setMaxLength(maxLength)

    Sets the maximum input length of the edit box.
    Setting this value enables multiline input mode by default.


    Defined in: CCEditBox.js.
    Parameters:
    {Number} maxLength
    The maximum length.
  • setPlaceHolder(text)
    Set a text in the edit box that acts as a placeholder when an edit box is empty.
    Defined in: CCEditBox.js.
    Parameters:
    {string} text
    The given text.
  • setPlaceholderFont(fontName, fontSize)
    Set the placeholder's font.
    Defined in: CCEditBox.js.
    Parameters:
    {String} fontName
    {Number} fontSize
  • setPlaceholderFontColor(color)
    Set the font color of the placeholder text when the edit box is empty.
    Defined in: CCEditBox.js.
    Parameters:
    {cc.Color} color
  • setPlaceholderFontName(fontName)
    Set the placeholder's fontName.
    Defined in: CCEditBox.js.
    Parameters:
    {String} fontName
  • setPlaceholderFontSize(fontSize)
    Set the placeholder's fontSize.
    Defined in: CCEditBox.js.
    Parameters:
    {Number} fontSize
  • setPropsForButtonFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForCheckBoxFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForImageViewFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForLabelAtlasFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForLabelBMFontFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForLabelFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForLayoutFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForListViewFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForLoadingBarFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForPageViewFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForScrollViewFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForSliderFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForTextAreaFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForTextButtonFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForTextFieldFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setPropsForWidgetFromJsonDictionary(widget, options)

    Defined in: GUIReader.js.
    Parameters:
    widget
    options
  • setReturnType(returnType)
    Set the return type that are to be applied to the edit box.
    Defined in: CCEditBox.js.
    Parameters:
    {Number} returnType
    One of the CCKeyboardReturnType constants.
  • {cc.$} setSkew(x, y)
    skews the element
    Parameters:
    {Number} x
    in degrees
    {Number} y
    Returns:
    {cc.$}
  • setText(text)
    Set the text entered in the edit box.
    Defined in: CCEditBox.js.
    Parameters:
    {string} text
    The given text.
  • setUniformForModelViewProjectionMatrix()
    will update the MVP matrix on the MVP uniform if it is different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
  • setUniformLocationI32(location, i1)
    calls glUniform1i only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} i1
  • setUniformLocationWith1f(location, f1)
    calls glUniform1f only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} f1
  • setUniformLocationWith1i(location, i1)
    calls glUniform1i only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} i1
  • setUniformLocationWith2f(location, f1, f2)
    calls glUniform2f only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} f1
    {Number} f2
  • setUniformLocationWith2fv(location, floatArray, numberOfArrays)
    calls glUniform2fv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Float32Array} floatArray
    {Number} numberOfArrays
  • setUniformLocationWith2i(location, i1, i2)
    calls glUniform2i only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} i1
    {Number} i2
  • setUniformLocationWith2iv(location, intArray, numberOfArrays)
    calls glUniform2iv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Int32Array} intArray
    {Number} numberOfArrays
  • setUniformLocationWith3f(location, f1, f2, f3)
    calls glUniform3f only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} f1
    {Number} f2
    {Number} f3
  • setUniformLocationWith3fv(location, floatArray, numberOfArrays)
    calls glUniform3fv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Float32Array} floatArray
    {Number} numberOfArrays
  • setUniformLocationWith3i(location, i1, i2, i3)
    calls glUniform3i only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} i1
    {Number} i2
    {Number} i3
  • setUniformLocationWith3iv(location, intArray, numberOfArrays)
    calls glUniform3iv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Int32Array} intArray
    {Number} numberOfArrays
  • setUniformLocationWith4f(location, f1, f2, f3, f4)
    calls glUniform4f only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} f1
    {Number} f2
    {Number} f3
    {Number} f4
  • setUniformLocationWith4fv(location, floatArray, numberOfArrays)
    calls glUniform4fv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Float32Array} floatArray
    {Number} numberOfArrays
  • setUniformLocationWith4i(location, i1, i2, i3, i4)
    calls glUniform4i only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Number} i1
    {Number} i2
    {Number} i3
    {Number} i4
  • setUniformLocationWith4iv(location, intArray, numberOfArrays)
    calls glUniform4iv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Int32Array} intArray
    {Number} numberOfArrays
  • setUniformLocationWithMatrix4fv(location, matrixArray, numberOfMatrices)
    calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
    Parameters:
    {WebGLUniformLocation} location
    {Float32Array} matrixArray
    {Number} numberOfMatrices
  • setUniformsForBuiltins()
    will update the builtin uniforms if they are different than the previous call for this same shader program.
    Defined in: CCGLProgram.js.
  • {cc.$} translates(x, y)
    move the element
    Parameters:
    {Number} x
    in pixel
    {Number} y
    in pixel
    Returns:
    {cc.$}
  • updateUniforms()
    It will create 4 uniforms: cc.UNIFORM_PMATRIX cc.UNIFORM_MVMATRIX cc.UNIFORM_MVPMATRIX cc.UNIFORM_SAMPLER
    Defined in: CCGLProgram.js.
  • use()
    it will call glUseProgram()
    Defined in: CCGLProgram.js.
  • {String} vertexShaderLog()
    returns the vertexShader error log
    Defined in: CCGLProgram.js.
    Returns:
    {String}
  • widgetFromJsonDictionary(data)

    Defined in: GUIReader.js.
    Parameters:
    data