Skip to content

Classes

GlobalDescription
Graphics

负责游戏图形渲染、显示和相关处理的静态类

Graphics

负责游戏图形渲染、显示和相关处理的静态类

Kind: global class

  • Graphics
    • new Graphics()
    • .frameCount : Number
    • .BLEND_NORMAL : Number
    • .BLEND_ADD : Number
    • .BLEND_MULTIPLY : Number
    • .BLEND_SCREEN : Number

new Graphics()

执行图形处理的静态类
The static class that carries out graphics processing.


Graphics.frameCount : Number

游戏屏幕的总帧数
The total frame count of the game screen.

Kind: static property of Graphics
Properties

Name
frameCount

Graphics.BLEND_NORMAL : Number

PIXI.blendModes.NORMAL 的别名
The alias of PIXI.blendModes.NORMAL.

Kind: static property of Graphics
Read only: true
Properties

Name
BLEND_NORMAL

Graphics.BLEND_ADD : Number

PIXI.blendModes.ADD 的别名
The alias of PIXI.blendModes.ADD.

Kind: static property of Graphics
Read only: true
Properties

Name
BLEND_ADD

Graphics.BLEND_MULTIPLY : Number

PIXI.blendModes.MULTIPLY 的别名
The alias of PIXI.blendModes.MULTIPLY.

Kind: static property of Graphics
Read only: true
Properties

Name
BLEND_MULTIPLY

Graphics.BLEND_SCREEN : Number

PIXI.blendModes.SCREEN 的别名
The alias of PIXI.blendModes.SCREEN.

Kind: static property of Graphics
Read only: true
Properties

Name
BLEND_SCREEN

.initialize(width, height, type)

初始化图形系统
Initializes the graphics system.

Kind: static function

ParamTypeDescription
widthNumber游戏屏幕宽度 The width of the game screen
heightNumber游戏屏幕高度 The height of the game screen
typeString渲染器类型 The type of the renderer. 'canvas', 'webgl', or 'auto'.

.canUseCssFontLoading() ⇒ Boolean

检查是否可以使用 CSS 字体加载
Checks whether CSS font loading can be used.

Kind: static function
Returns: Boolean - 如果可以使用 CSS 字体加载则返回 true / True if CSS font loading can be used


.tickStart()

标记 FPS 计量器每帧的开始
Marks the beginning of each frame for FPSMeter.

Kind: static function


.tickEnd()

标记 FPS 计量器每帧的结束
Marks the end of each frame for FPSMeter.

Kind: static function


.render(stage)

将舞台渲染到游戏屏幕
Renders the stage to the game screen.

Kind: static function

ParamTypeDescription
stageStage要渲染的舞台对象 The stage object to be rendered

.isWebGL() ⇒ Boolean

检查渲染器类型是否为 WebGL
Checks whether the renderer type is WebGL.

Kind: static function
Returns: Boolean - 如果渲染器类型是 WebGL 则返回 true / True if the renderer type is WebGL


.hasWebGL() ⇒ Boolean

检查当前浏览器是否支持 WebGL
Checks whether the current browser supports WebGL.

Kind: static function
Returns: Boolean - 如果当前浏览器支持 WebGL 则返回 true / True if the current browser supports WebGL.


.canUseDifferenceBlend() ⇒ Boolean

检查是否支持画布混合模式'difference'
Checks whether the canvas blend mode 'difference' is supported.

Kind: static function
Returns: Boolean - 如果支持画布混合模式'difference'则返回 true / True if the canvas blend mode 'difference' is supported


.canUseSaturationBlend() ⇒ Boolean

检查是否支持画布混合模式'saturation'
Checks whether the canvas blend mode 'saturation' is supported.

Kind: static function
Returns: Boolean - 如果支持画布混合模式'saturation'则返回 true / True if the canvas blend mode 'saturation' is supported


.setLoadingImage(src)

设置"正在加载"图像的来源
Sets the source of the "Now Loading" image.

Kind: static function

ParamTypeDescription
srcString图像来源路径 / The source path of the image

.startLoading()

初始化用于显示"正在加载"图像的计数器
Initializes the counter for displaying the "Now Loading" image.

Kind: static function


.updateLoading()

增加加载计数器并在必要时显示"正在加载"图像
Increments the loading counter and displays the "Now Loading" image if necessary.

Kind: static function


.endLoading()

清除"正在加载"图像
Erases the "Now Loading" image.

Kind: static function


.printLoadingError(url)

在屏幕上显示加载错误文本
Displays the loading error text to the screen.

Kind: static function

ParamTypeDescription
urlString加载失败的资源 URL / The url of the resource failed to load

.eraseLoadingError()

清除加载错误文本
Erases the loading error text.

Kind: static function


.printError(name, message)

在屏幕上显示错误文本
Displays the error text to the screen.

Kind: static function

ParamTypeDescription
nameString错误名称 / The name of the error
messageString错误消息 / The message of the error

.showFps()

显示 FPS 计量器元素
Shows the FPSMeter element.

Kind: static function


.hideFps()

隐藏 FPS 计量器元素
Hides the FPSMeter element.

Kind: static function


.loadFont(name, url)

加载字体文件
Loads a font file.

Kind: static function

ParamTypeDescription
nameString字体的名称 / The face name of the font
urlString字体文件的 URL / The url of the font file

.isFontLoaded(name) ⇒ Boolean

检查字体文件是否已加载
Checks whether the font file is loaded.

Kind: static function
Returns: Boolean - 如果字体文件已加载则返回 true / True if the font file is loaded

ParamTypeDescription
nameString字体的名称 / The face name of the font

.playVideo(src)

开始播放视频
Starts playback of a video.

Kind: static function

ParamTypeDescription
srcString视频源路径 / The video source path

.isVideoPlaying() ⇒ Boolean

检查视频是否正在播放
Checks whether the video is playing.

Kind: static function
Returns: Boolean - 如果视频正在播放则返回 true / True if the video is playing


.canPlayVideoType(type) ⇒ Boolean

检查浏览器是否可以播放指定的视频类型
Checks whether the browser can play the specified video type.

Kind: static function
Returns: Boolean - 如果浏览器可以播放指定的视频类型则返回 true / True if the browser can play the specified video type

ParamTypeDescription
typeString要测试支持的视频类型 / The video type to test support for

.setVideoVolume(value)

设置视频的音量
Sets volume of a video.

Kind: static function

ParamTypeDescription
valueNumber音量值 / The volume value

.pageToCanvasX(x) ⇒ Number

将页面上的 x 坐标转换为画布区域上对应的 x 坐标
Converts an x coordinate on the page to the corresponding x coordinate on the canvas area.

Kind: static function
Returns: Number - 画布区域上的 x 坐标 / The x coordinate on the canvas area

ParamTypeDescription
xNumber要转换的页面 x 坐标 / The x coordinate on the page to be converted

.pageToCanvasY(y) ⇒ Number

将页面上的 y 坐标转换为画布区域上对应的 y 坐标
Converts a y coordinate on the page to the corresponding y coordinate on the canvas area.

Kind: static function
Returns: Number - 画布区域上的 y 坐标 / The y coordinate on the canvas area

ParamTypeDescription
yNumber要转换的页面 y 坐标 / The y coordinate on the page to be converted

.isInsideCanvas(x, y) ⇒ Boolean

检查指定的点是否在游戏画布区域内
Checks whether the specified point is inside the game canvas area.

Kind: static function
Returns: Boolean - 如果指定的点在游戏画布区域内则返回 true / True if the specified point is inside the game canvas area

ParamTypeDescription
xNumber画布区域上的 x 坐标 / The x coordinate on the canvas area
yNumber画布区域上的 y 坐标 / The y coordinate on the canvas area

.callGC()

调用 PIXI.js 垃圾回收器
Calls pixi.js garbage collector.

Kind: static function


贡献者

暂无相关贡献者

页面历史

暂无最近变更历史
最近更新