ClearLines line_list
Parameters
| line_list - a line-list entity created with CreateLineList |
Description
|
Removes every segment from a line list, leaving the entity itself alive. ClearLines empties the list so you can rebuild it from scratch - restart a trail when the player respawns, redraw a path when the route changes, or wipe a debug drawing between level loads. After the call CountLines returns 0 and previously stored indexes are no longer valid. Only the segments go. The entity keeps its position, parent, colour, alpha, LineWidth and LineDepthMode settings, so the next AddLine picks up exactly where you left off. To destroy the line list completely, use FreeEntity instead. Passing an entity that is not a line list stops the program with a runtime error. Requires Extended mode. See also: AddLine, SetLine, CountLines, CreateLineList, FreeEntity. |
Example
; ClearLines Example ; ------------------ ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs() camera=CreateCamera() PositionEntity camera,0,1,-9 ; Fireworks drawn into one line list sparks=CreateLineList() EntityColor sparks,255,160,60 LineWidth sparks,2 While Not KeyDown(1) ; Space wipes every segment at once - the entity itself survives If KeyHit(57) Then ClearLines sparks ; Every 40 frames a new firework burst is added timer=timer+1 If timer=40 Then timer=0 bx#=Rnd(-3,3) by#=Rnd(0,2.5) For n=0 To 11 AddLine sparks,bx,by,0,bx+1.2*Cos(n*30),by+1.2*Sin(n*30),0 Next EndIf ; 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 Text 0,0,"Arrow keys: move camera Space: ClearLines Esc: exit" Text 0,20,"Segments in the list: "+CountLines(sparks) Flip Wend End
Index