Jump to content

Recommended Posts

  • 10 months later...
Posted (edited)

Create lua file inside kneeboard folder. Call it 1.lua and it will show up as first kneeboard page. Now you can write lua stuff to output your text on the kneeboard page:

 

dofile(LockOn_Options.common_script_path.."elements_defs.lua")

 

local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 0, 0, 0, 255 }) 

 

    local txt = CreateElement "ceStringPoly"
    txt.value = "My text"
    txt.material = FONT
    txt.init_pos = { h_center, v_center }
    txt.alignment = "CenterCenter"
    txt.stringdefs = { 0.005, 0.0013, 0, 0 }
    txt.use_mipfilter = true
    txt.h_clip_relation = h_clip_relations.COMPARE
    txt.level = DEFAULT_LEVEL
    Add(txt) 

 

Define h_center and v_center with the position you want the text to appear on the kneeboard page.

Edited by dcs76
Posted

Yes, sure. Like this:

 

    local imageMaterial = MakeMaterial(path, { 255, 255, 255, 255 })

    local back = CreateElement "ceTexPoly"
    back.name = create_guid_string()
    back.material = imageMaterial
    back.init_pos = { x - 1, GetAspect() - y }
    back.vertices = {
        { 0, 0 },
        { width, 0 },
        { width, -height },
        { 0, -height }
    }
    back.indices = { 0, 1, 2; 0, 2, 3 }
    back.tex_coords = texture_box(0, 0, 1, 1)
    back.h_clip_relation = h_clip_relations.COMPARE
    back.level = DEFAULT_LEVEL
    Add(back) 

 

This basically defines two triangles building a rectangle. The texture(material) of that rectangle is the picture loaded from "path". You need to define x, y, width and height to define where the rectangle/image should be drawn inside of the kneeboard page.

Posted

very cool thanks, so path is one path in computer like "D:\...\image.png" ?

 

Another question, is it possible to link that lua file with one mission script lua file to put some dynamic variables depending of the mission and insert new pages during the mission ?

Posted (edited)

Hi,

 

I tried the single message text, add 1.lua file in F18 KNEEBOARD. I see a new page but empty, no background no text !

 

I remplaced  txt.init_pos = { h_center, v_center } with txt.init_pos = { 0, 0}  et set 

local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 0, 0, 0, 255 })  with 

local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 255,255,255, 255 }) 

 

And no change !

 

Help !

 

 

Edited by sunski34
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...