Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to subtitle dialogs in Leadwerks...

Recommended Posts

Hello team!!

It has been a long time since I was connected here. I hope you are all OK. That no one has been touched by the damn COVID.

This week I have finally resumed my work with LEADWERKS, and I want ask you if there is a tutorial, or a site in the WIKI (Learn) that shows how create and display SUBTITLES on the screen inside our games. Is possible?
I want to subtitle in English all the dialogues that I have recorded in Spanish in my game. But I can't find anything in GOOGLE, or in the WIKI (Learn), or here in the FORUM.

Thank you, and I hope you are doing well!


  • Like 1
Link to post

I'm trying do this using LABEL pressing a BUTTON. If I can do something useful and functional I will let you know.

In the meantime, it would be helpful if someone gives me a clue of how make this success.

Thanks a lot.

Link to post
2 hours ago, Josh said:

What part are you having trouble with?

At this moment in my game i have a simple subtitle system using 4 elements:

  • A button.
  • An audio message.
  • An alpha texture with the subtitle in.
  • A timer with X seconds. (Where X is the lenght of the audio message)

When we push the button, the audio message plays, the texture with the Subtitle appears on screen and the timer is ENABLED, and the the Button is DISABLED.

After the timer is over, the subtitle texture hiddes.

This is my WORKFLOW working ok:



And this is my result using my own DESIGN of the HUD and SUBTITLES writen inside:


This is my SCRIPT CODE for show the subtitles:

Script.enabled = true --bool "Enabled"
Script.HudTextura=""--string "Nombre Textura"

local MostradaImagen="No"

function Script:Start()
	if self.enabled==true then
	textureVacia = Texture:Load("Materials/MisTexturas/TexturaVacia.tex")

function Script:Enable()--in
	if self.enabled==false then
		ImagenTextura = Texture:Load("Materials/MisTexturas/Subtitulos/"..self.HudTextura..".tex")

function Script:Disable()--in
	if self.enabled==true then
		ImagenTextura = Texture:Load("Materials/MisTexturas/TexturaVacia.tex")

function Script:PostRender(context)
	if MostradaImagen=="Yes" then
	if MostradaImagen=="No" then


My trouble at this point is, i'm using one image for each subtitle, for each dialog. The only change in all of the images i'm using is the TEXT in Spanish or English for each subtitles and for each dialog appear in my game.

I want use ONE single image with the FRAME of the SUBTITLES (like the screenshot but WITHOUT text). And then use LABEL ENTITY (or another) with LABEL_WRAP property for SHOW all of each subtitles i want write inside.

I have tried using LABEL, using DRAWTEXT on Context. But i don't know how code them to make succesfull the APPEAR and HIDDE of the TEXT for each subtitle.

I don't know how use them...

Thanks a lot Josh!! Nice to read you again after my absence these last months.

Link to post

Hello Russel

This is pretty simple: Leave a transparent place in your texture where the text should be written. Draw the texture in blend mode.

Then write the text with Context:DrawText() after declaring a Font:Load() varaible. So you can write and change your text as you want.



  • Like 1
Link to post
58 minutes ago, Marcousik said:

Hello Russel

This is pretty simple: Leave a transparent place in your texture where the text should be written. Draw the texture in blend mode.

Then write the text with Context:DrawText() after declaring a Font:Load() varaible. So you can write and change your text as you want.

Hello Marcousik!! Nice to read you again!!

Despite being simple, I can't create a script to write text in the frame that I have designed for our character's dialogues. (Dialogs of several lines that fit the designed box)


As you can see in the screenshot, I have already used DrawText () for the texts that are at the bottom left:
"Outside of the FotoMuseo"
"FotoMuseo 3D - Exterior FotoMuseo"

But if I want to write text inside that Frame box, I don't know how can align it, nor how I use the WRAP parameter and make it look good and fixed to the inside of the frame.

At this moment, and until I learn how to program a Script that fits the text in this FRAME, I am using transparent images with text (for each dialog).

So I can leave it like this:



Or even display images in the text box like this too:



But no idea how write any TEXT in the Frame using CODE (which is what I want to do) and make it look good and fixed to the inside of the frame.

Thanks a lot!!

Link to post
4 minutes ago, Marcousik said:

Ok look at the function description, I think you forgot something very easy:


  • DrawText(string text, number x, number y, number kerning=1.0)

> The x,y are what you are seeking I suppose, coordinates place  on the screen.

Thanks for your answer.

But this ist not a working solution for me, since depending on the resolution of the game on the user's computer, those coordinates change, and text could go out of frame.

Also I need to use the WRAP option to wrap the text in several lines for long texts, with Drawtext I don't know how to control that. Based on what i know i think only LABEL has that property. But i have the same problem. If i adjust X and Y on in FULL HD using context.GetHeight() or context.GetWidth(), if I change the resolution to HD or less, the text doesn't appear in place. Appears out of frame.

Even if I don't use any frames and i leave the text free on the screen, i don't know how center down in the screen in all resolutions.

This drive me crazy. 😵 XD

Link to post

Here... This is my discarded code using LABEL for large subtitles with WRAP option:

Script.FuenteHud = nil

local gui = GUI:Create(context)
local base = gui:GetBase()

Script.TextoSubtitulo=""--string "Texto: "

function Script:Start()
	self.FuenteHud = Font:Load("Fonts/monotypecursiva.ttf",14)

	widget = Widget:Label("",x,y,800,200,base)

function Script:ModificaTexto()--in
	widget = Widget:Label(""..self.TextoSubtitulo,x,y,800,200,base)

function Script:LimpiaTexto()--in


And this is the result using this code:


Is not a bad start, but i don't like the result, or how improve this...

At this moment, my best option is to continue using images to design the texts (5-10 kbs per image):


I know is not the best solution, but until I control by code how to place the subtitles in the designated place regardless of the resolution chosen, I will continue using this system.

Thanks for your answers team!!

Link to post
41 minutes ago, Slastraf said:

Hey, just wanted to say that game looks really cool. Did you post more about it in showcase ? 

No, I have not published anything in Showcase about FotoMuseo 3D. But thanks for letting me know.
As soon as I post the new in-game content on Steam, I'll share it there.

At the moment, i'm still working on the the new content. This will be:

  • Spanish/English - Dialog/subtitle System.
  • More secret areas.
  • One new EXPO to visit it.

Thanks for your words Slastraf!!

  • Like 1
Link to post
14 hours ago, Angelwolf said:

I want to echo Slastraf's comment. This looks really cool and looks similar to what I was working on before Leadwerks stopped running on my system. Good luck with your project, it looks very promising!

Many thanks Angelwolf!!! 🤗

  • Like 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...