Blitz3D+ Command Reference

PauseTextureScroll texture[,paused]

Parameters

texture - texture handle

paused (optional) - True to pause (default), False to resume

Description

Freezes automatic texture movement configured with TextureScroll.

It remembers both speeds and resumes without adding the time spent paused. Textures start unpaused.

This pauses only this texture's automatic movement. It does not pause particles, entity animation or shader parameters such as Time. PositionTexture can still move the texture immediately while it is paused. You can also change its remembered speed before resuming.

All users of the same texture share its paused state. To stop and forget the velocity instead, use TextureScroll texture,0,0; that also keeps the reached position.

Requires Extended mode.

See also: TextureScroll, PositionTexture, LightCookie.

Example

; PauseTextureScroll Example
; --------------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,3,-4
RotateEntity camera,25,0,0
CameraClsColor camera,18,23,31

light=CreateLight()
RotateEntity light,55,-35,0

; A conveyor belt built from two triangles, UV-tiled four times
belt=CreateMesh()
surface=CreateSurface(belt)
AddVertex surface,-2,0,0,0,0
AddVertex surface,2,0,0,1,0
AddVertex surface,2,0,7,1,4
AddVertex surface,-2,0,7,0,4
AddTriangle surface,0,2,1
AddTriangle surface,0,3,2
UpdateNormals belt

; Draw a striped belt tile into an ordinary texture
texture=CreateTexture(64,64,1)
SetBuffer TextureBuffer(texture)
ClsColor 35,65,75
Cls
Color 220,175,55
Rect 0,0,64,12
Color 130,145,150
Rect 0,12,64,3
SetBuffer BackBuffer()
EntityTexture belt,texture

; The moving belt this example pauses and resumes
TextureScroll texture,0,0.3

paused=False

While Not KeyDown(1)

    ; Space freezes the movement; the speed is remembered for resume
    If KeyHit(57)
        paused=Not paused
        PauseTextureScroll texture,paused
    EndIf

    ; PositionTexture still works while paused
    If KeyHit(19) Then PositionTexture texture,0,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Color 240,240,240
    Text 0,0,"Arrow keys: move camera   Space: pause/resume   R: reset offset   Esc: exit"
    Text 0,20,"PauseTextureScroll texture,"+paused

    Flip

Wend

End

Index