[Free][Utility] nbk_scaleform_draw2d | Draw Rect,Sprite,Text,Circle with scaleform

A script by negbook

No reviews yet.
[Free][Utility] nbk_scaleform_draw2d | Draw Rect,Sprite,Text,Circle with scaleform main image

Full Description

Github
Wiki

Intro

With this utility, You can draw everything just like before but without a loop thread.
Draw Texture without RequestStreamedTextureDict
Draw Scaleform Page without RequestScaleformMovie (just like the OL-WebBroswer)

A native drawing menu would be turn to 0.03~0.04ms from 0.15~0.17ms


Preview:

Preview

Free

It is free, if it help you a lot,You can buy some Coffee/Bread to me on the Tebex

Functions

Welcome to the nbk_scaleform_draw2d Wiki!

Import(make sure put it into a thread that before all you draws):

load(LoadResourceFile("nbk_scaleform_draw2d", 'import'))()

Basic Functions:

--automatic namespace
DrawRectS(x, y, width, height, r, g, b, a)
DrawCircleS(x, y, width, height, r, g, b, a)
DrawSpriteS(txDict, txName, x, y, w, h,heading, r, g, b, a)
DrawPageS(gfxFile, x, y, w, h,heading, r, g, b, a)
DrawTextS(strText, x, y, scale, r, g, b, a)
--custom namespace
DrawRectSF(NAME,x, y, width, height, r, g, b, a)
DrawCircleSF(NAME,x, y, width, height, r, g, b, a)
DrawSpriteSF(NAME,txDict, txName, x, y, w, h,heading, r, g, b, a)
DrawPageSF(NAME,gfxFile, x, y, w, h,heading, r, g, b, a)
DrawTextSF(NAME,strText, x, y, scale, r, g, b, a)

return handle -- All of them return a handle which can be used to remove or update textwrap something.

--Remove
DeleteRectSF(handle)
DeleteRectS(handle)
DeleteSpriteSF(handle)
DeleteSpriteS(handle)
DeletePageSF(handle)
DeletePageS(handle)
DeleteTextSF(handle)
DeleteTextS(handle)

Text Update

TextDrawShow (handle)
TextDrawHide (handle)
TextDrawPosition (handle,x,y)
TextDrawSetPosition = TextDrawPosition 
TextDrawString (handle, str)
TextDrawSetString = TextDrawString 
TextDrawColor (handle, r, g, b, a)
TextDrawAlpha (handle, a)
TextDrawTextScale (handle, scale)
TextDrawTextSize = TextDrawTextScale 
TextDrawFont(handle, fontstr) -- "$Font2", "$Font_cond" etc...
TextDrawBoxColour (handle, r, g, b, a)
TextDrawOutline (handle, isoutline)
TextDrawShadow (handle,  r, g, b, a, blurX, blurY, strength)
TextDrawCenter (handle, iscenter)
TextDrawRight(handle, isright)
TextDrawWrap (handle, wrapL, wrapR)
TextDrawDestroy (handle)
TextDrawCreate = DrawTextS + TextDrawHide 

Advance Functions:

--set colour if mouse hover the element
SetHoverColourBegin(r,g,b,a)
SetHoverColourEnd()

--set rainbow-color 
SetAutoColourBegin(speed)
SetAutoColourEnd()

--set fade-in ready
SetFadeInBegin(fadegroup,inspeed, outspeed, isoutafterduration, outduration)
SetFadeInEnd()

--show the fade-in-ready group
SetFadeInShow(fadegroup)
SetFadeOut(fadegroup)

--automatic namespace with callback
DrawRectS(x, y, width, height, r, g, b, a, borderLength, br, bg, bb, ba, nobackground, cb)
DrawCircleS(x, y, width, height, r, g, b, a, cb)
DrawSpriteS(txDict, txName, x, y, w, h,heading, r, g, b, a, cb)
DrawPageS(gfxFile, x, y, w, h,heading, r, g, b, a, cb)
DrawTextS(strText, x, y, scale, r, g, b, a, cb)

--custom namespace with callback
DrawRectSF(NAME,x, y, width, height, r, g, b, a, cb)
DrawCircleSF(NAME,x, y, width, height, r, g, b, a, cb)
DrawSpriteSF(NAME,txDict, txName, x, y, w, h,heading, r, g, b, a, cb)
DrawPageSF(NAME,gfxFile, x, y, w, h,heading, r, g, b, a, cb)
DrawTextSF(NAME,strText, x, y, scale, r, g, b, a, cb)

--others 
DrawCursorState("hand")
DrawCursorState("arrow")
DrawCursorState("text")
DrawCursorState("busy")
SetDebugMode(true) --  / false --drawing helper,I have no mention about this
DrawSelectionHook(true,cb) --Global Callback

Global Callback:

DrawSelectionHook(true,function(info) 
    print(json.encode(info))
end)

Private Callback:

-- put cb at the last params of elements
DrawTextSF("hello","hello",0.09,0.42000003679297,0.36500004290554,255,255,255,255,function(on)
	on.click = function(selection)
		print("wow this is hello click",selection)
		DrawCursorState("busy")
	end 
	on.hover = function(selection)
		--print("wow this is hello hover",selection)
		DrawCursorState("hand")
	end 
	on.unhover = function(selection)
		print("wow this is hello unhover",selection)
		DrawCursorState("arrow")
	end 
end)

Text Format

Auto Labels (Not suggest but good to use)

DrawTextS("~y~~h~he %NBK_CUSTOM1% %NBK_CUSTOM2% %NBK_CUSTOM3% ~n~ %FACE_TITLE% ~ws~ ~ws~ ~ws~",0.09,0.30000002339233,0.36500004290554)
Wait(5000)
AddTextEntry("NBK_CUSTOM2","HELLO2"..math.random(15,666))
Wait(5000)
AddTextEntry("FACE_TITLE","HELLO2"..math.random(15,666))
CreateThread(function()
	while true do Wait(100)
		
		AddTextEntry("NBK_CUSTOM1","HELLO"..math.random(0,150))
		AddTextEntry("NBK_CUSTOM2","HELLO2"..math.random(15,666))
		AddTextEntry("NBK_CUSTOM3","HELLO3"..math.random(32,1523))
	end 
end)