HU/dxDrawRectangle
		
		
		
		Jump to navigation
		Jump to search
		
Ez a function egy 2D-s négyszöget rajzol a képernyőre - egy képkocka erejéig van kirajzolva. Ezt az onClientRender segítségével együtt kell használni annak érdekében, hogy folyamatosan jelenjen meg.
Szintaxis
bool dxDrawRectangle ( float startX, float startY, float width, float height [, int color = white, bool postGUI = false, bool subPixelPositioning = false ] )
Kötelező paraméterek
- startX: An float representing the absolute origin X position of the rectangle, represented by pixels on the screen.
 - startY: An float representing the absolute origin Y position of the rectangle, represented by pixels on the screen.
 - width: An float representing the width of the rectangle, drawn in a right direction from the origin.
 - height: An float representing the height of the rectangle, drawn in a downwards direction from the origin.
 
Tetszőleges paraméterek
- color: A négyszög hexadecimális színe, az értéket megadhatja tocolor vagy 0xAARRGGBB használatával (AA = átlátszóság, RR = red, GG = green, BB = blue)..
 - postGUI: Egy igaz/hamis érték mutatja, hogy a szöveget a GUI kép elé, vagy mögé rajzolja-e ki .
 
Visszatérési érték
Visszatérési értéke true, ha a művelet sikeres volt, egyébként false.
Példa
Click to collapse [-]
ClientPélda a MOTD-re (napi üzenet), a DxDrawText, -Line és -Rectangle használatával készült.
local x,y = guiGetScreenSize()  -- Get players resolution.
local playerName = getPlayerName ( localPlayer )  -- Get players name.
local MOTDText = "Welcome to our server, this is a test MOTD script for MTA's Wiki."  -- Example of MOTD message.
function drawStuff()
	dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) -- Create our black transparent MOTD background Rectangle.
	dxDrawText ( "Welcome " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) -- Create Welcome title.
        dxDrawText ( "Welcome " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) -- Create Welcome title shadow.
	dxDrawLine ( x/3.6, y/3.3, x/1.35, y/3.3, tocolor ( 255, 255, 255, 255 ), 2 ) -- Create underline for title.
	dxDrawLine ( x/3.59, y/3.275, x/1.348, y/3.275, tocolor ( 0, 0, 0, 255 ), 2 ) -- Create underline shadow.
	dxDrawText ( MOTDText, x/3.6, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 1, "clear" ) -- Create MOTD text.
end
addEventHandler("onClientRender", root, drawStuff)  -- Keep everything visible with onClientRender.
Changelog
| Version | Description | 
|---|
| 1.4.0-9.06931 | Added subPixelPositioning argument | 
Lásd még
- HU/dxConvertPixels
 - HU/dxCreateFont
 - HU/dxCreateRenderTarget
 - HU/dxCreateScreenSource
 - HU/dxCreateShader
 - HU/dxCreateTexture
 
- HU/dxDrawCircle
 - HU/dxDrawImage
 - HU/dxDrawImageSection
 - HU/dxDrawLine
 - HU/dxDrawLine3D
 - HU/dxDrawMaterialLine3D
 
- HU/dxDrawMaterialPrimitive
 - HU/dxDrawPrimitive
 - HU/dxDrawMaterialSectionLine3D
 - HU/dxDrawRectangle
 - HU/dxDrawText
 - HU/dxGetBlendMode
 - HU/dxGetFontHeight
 - HU/dxGetMaterialSize
 - HU/dxGetPixelColor
 - HU/dxGetPixelsSize
 - HU/dxGetPixelsFormat
 - HU/dxGetStatus
 - HU/dxGetTextWidth
 - HU/dxGetTexturePixels
 - HU/dxSetAspectRatioAdjustmentEnabled
 - HU/dxSetBlendMode
 - HU/dxSetPixelColor
 - HU/dxSetRenderTarget
 - HU/dxSetShaderValue
 - HU/dxSetShaderTessellation
 - HU/dxSetShaderTransform
 - HU/dxSetTestMode
 - HU/dxSetTextureEdge
 - HU/dxSetTexturePixels
 - HU/dxUpdateScreenSource
 
Fordította
2018.11.27. Surge