Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text Effect
#6
Here you go Smile

Code:
include "s3d.n7"

set window "Cool text", 640, 480, false
set redraw off

' create font and a texture (image).
set font createfont("arial", 16, true)
tex = createimage(256, 512)
' set target image to the one we created and write some
' text to it.
set image tex
set color 255, 200, 0
set caret 128, 0
center "Episode VII"
set caret 0, fheight()*2
for i = 0 to 28  wln "This is text. This is text. This is text. Yes."
wln "The end."
' set image to primary (window) again.
set image primary

' Init s3d.
S3D_SetView(primary, rad(90), 0.1, 2)
S3D_SetPerspectiveCorrection(S3D_NORMAL)

' text z, scroll value.
textZ = 0
' size of text quad.
sizeX = 1
sizeZ = height(tex)/width(tex)

do
    ' scroll.
    textZ = textZ + 0.001
    ' clear screen and render text as a single quad.
    set color 0, 0, 0
    cls
    S3D_Clear()
    S3D_Texture(tex)
    S3D_Color(255, 255, 255)
    S3D_RotateX(rad(40))
    S3D_Translate(0, 0.5, textZ)
    S3D_Begin(S3D_QUADS)
        S3D_Vertex(-sizeX*0.5, 0, 0, 0, 0)
        S3D_Vertex(sizeX*0.5, 0, 0, 1, 0)
        S3D_Vertex(sizeX*0.5, 0, -sizeZ, 1, 1)
        S3D_Vertex(-sizeX*0.5, 0, -sizeZ, 0, 1)
    S3D_End()
    S3D_Render()
    S3D_RenderFog(0, 0, 0, false)
 
    redraw
    fwait 60
until keydown(KEY_ESCAPE, true)

Edit: A version higher texture resolution:

Code:
include "s3d.n7"

set window "Cool text", 640, 480, false
set redraw off

' create font and a texture (image).
set font createfont("arial", 31, true)
tex = createimage(512, 1024)
' set target image to the one we created and write some
' text to it.
set image tex
set color 255, 200, 0
set caret 256, 0
center "Episode VII"
set caret 0, fheight()*2
for i = 0 to 28  wln "This is text. This is text. This is text. Yes."
wln "The end."
' set image to primary (window) again.
set image primary

' Init s3d.
S3D_SetView(primary, rad(90), 0.1, 1.5)
S3D_SetPerspectiveCorrection(S3D_NORMAL)

' text z, scroll value.
textZ = 0
' size of text quad.
sizeX = 1
sizeZ = height(tex)/width(tex)

do
    ' scroll.
    textZ = textZ + 0.001
    ' clear screen and render text as a single quad.
    set color 0, 0, 0
    cls
    S3D_Clear()
    S3D_Texture(tex)
    S3D_Color(255, 255, 255)
    S3D_RotateX(rad(40))
    S3D_Translate(0, 0.5, textZ)
    S3D_Begin(S3D_QUADS)
        S3D_Vertex(-sizeX*0.5, 0, 0, 0, 0)
        S3D_Vertex(sizeX*0.5, 0, 0, 1, 0)
        S3D_Vertex(sizeX*0.5, 0, -sizeZ, 1, 1)
        S3D_Vertex(-sizeX*0.5, 0, -sizeZ, 0, 1)
    S3D_End()
    S3D_Render()
    S3D_RenderFog(0, 0, 0, false)
  
    redraw
    fwait 60
until keydown(KEY_ESCAPE, true)
Reply


Messages In This Thread
Text Effect - by 1micha.elok - 12-08-2024, 03:49 PM
RE: Text Effect - by johnno56 - 12-08-2024, 05:49 PM
RE: Text Effect - by kevin - 12-09-2024, 11:19 AM
RE: Text Effect - by 1micha.elok - 12-09-2024, 01:40 PM
RE: Text Effect - by Marcus - 12-09-2024, 04:40 PM
RE: Text Effect - by Marcus - 12-09-2024, 05:41 PM
RE: Text Effect - by johnno56 - 12-09-2024, 06:45 PM
RE: Text Effect - by 1micha.elok - 12-09-2024, 11:01 PM
RE: Text Effect - by johnno56 - 12-10-2024, 06:02 AM
RE: Text Effect - by 1micha.elok - 12-11-2024, 04:25 AM
RE: Text Effect - by johnno56 - 12-11-2024, 06:52 AM
RE: Text Effect - by 1micha.elok - 12-11-2024, 08:10 AM

Forum Jump:


Users browsing this thread: 6 Guest(s)