| None. |
|
Returns the width of the current graphics display, in pixels. This is the width passed to Graphics (or Graphics3D). Use it instead of hard-coding the number, and code like x=GraphicsWidth()/2 keeps HUDs centred and clamps player positions correctly at any resolution you later switch to. See also: GraphicsHeight, GraphicsDepth, Graphics. |
; GraphicsWidth Example
; ---------------------
Graphics 640,480,0,2
SetBuffer BackBuffer()
x#=100
vx#=4
While Not KeyDown(1)
Cls
; The ball bounces off the edges reported by GraphicsWidth
x=x+vx
If x<0 Or x>GraphicsWidth()-40 Then vx=-vx
Color 0,255,128
Oval x,220,40,40,1
Color 255,255,255
Text 0,0,"Esc: exit"
Text 0,20,"GraphicsWidth() = "+GraphicsWidth()+" - the ball turns round at that x"
Flip
Wend
End