LineWidth line_list[,pixels#]
Parameters
|
line_list - a line-list entity created with CreateLineList pixels# (optional) - width of every line in the list, in physical pixels; greater than 0 and at most 256; 1 (default) |
Description
|
Sets the on-screen width, in pixels, of every line in a line list. The width applies to the whole list and is measured in physical pixels on screen, not world units: a 3-pixel path stays 3 pixels wide whether the camera is right on top of it or across the map. Lines never thin out or fatten with distance and perspective, which keeps editor grids, paths and HUD-style world markers readable at any range. Because it is a per-list setting, use separate line lists when you want mixed widths - say, a bold 4-pixel route over a faint 1-pixel grid. The width must be finite, greater than zero and no more than 256 pixels; anything else stops the program with a runtime error. New line lists start at 1 pixel. Requires Extended mode. See also: LineDepthMode, CreateLineList, AddLine. |
Example
; LineWidth Example ; ----------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-8 light=CreateLight() RotateEntity light,45,45,0 ; Two pylons with an energy beam between them pylon1=CreateCylinder() PositionEntity pylon1,-3,0,0 EntityColor pylon1,120,140,160 pylon2=CreateCylinder() PositionEntity pylon2,3,0,0 EntityColor pylon2,120,140,160 beam=CreateLineList() AddLine beam,-3,1,0,3,1,0 EntityColor beam,255,210,40 width=6 While Not KeyDown(1) ; [ and ] change the beam width in pixels If KeyHit(26) And width>1 Then width=width-1 If KeyHit(27) And width<24 Then width=width+1 ; LineWidth sets the raster width - constant on screen at any distance LineWidth beam,width ; Pulse the beam colour so the scene animates angle#=angle+4 EntityColor beam,255,160+80*Sin(angle),40 ; 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 [ / ] : beam width Esc: exit" Text 0,20,"LineWidth beam,"+width+" (move closer - the width stays "+width+" pixels)" Flip Wend End
Index