SpeedText ( Beta )

Blitz3D Forums/Blitz3D Userlibs/SpeedText ( Beta )

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Nice!

Note, these also exist in fastText, which is pretty popular:

TextRect%(x%,y%,w%,h%,text$,format%,encoding%)
TextBackground(r%,g%,b%)

I removed them and it works fine. The 3 declarations on the blank lib name are more trouble to me than not having them.

I found that rendering direct to the texdture buffer is the nicest feature here. I copied the portion where it render the text to the texture buffer in the main loop, and I still had 60 fps! Nice!

; SpeedText - Sample 2
; Rendering To Buffers

Include "include/SpeedText.bb"

Graphics3D 800, 600, 0, 2
ST_Initialize( BackBuffer( ) )

Local font = LoadFont( "media/bolton sans.ttf", 22 )
SetFont font

Local cam = CreateCamera( )
	CameraClsColor cam, 30, 35, 35
	PositionEntity cam, 0, 0, -3

Local light = CreateLight( )
	LightColor light, 50, 50, 50

Local cube = CreateCube( )

Local tex = CreateTexture( 256, 256 )
	EntityTexture cube, tex
	
	SetBuffer TextureBuffer( tex )
		ClsColor 30, 60, 100 : Cls
	SetBuffer BackBuffer( )
	
	ST_SetBuffer TextureBuffer( tex )
		Text 10, 10, "This text was rendered"
		Text 10, 40, "directly to the"
		Text 10, 70, "texture's buffer."
		
		Text 10, 120, "Thank you,"
		Text 10, 150, "SpeedText!"		
	ST_SetBuffer BackBuffer( )
	
	a = 0
While Not KeyDown( 1 )
	TurnEntity cube, 1, 1, 1

	RenderWorld
	Flip
	SetBuffer TextureBuffer( tex )
		ClsColor 30, 60, 100 : Cls
	SetBuffer BackBuffer( )
	
	ST_SetBuffer TextureBuffer( tex )
		Text 10, 10, "This text was rendered"
		Text 10, 40, "directly to the"
		Text 10, 70, "texture's buffer."
		
		Text 10, 120, "Thank you,"
		Text 10, 150, "SpeedText! " + Str$(a)
	ST_SetBuffer BackBuffer( )
a = a + 1
Wend