cleolibrary / CLEO5

CLEO 5 for GTA San Andreas
https://cleo.li
MIT License
57 stars 6 forks source link

New opcode display_text_formatted #115

Closed MiranDMC closed 8 months ago

MiranDMC commented 8 months ago

Gives way to draw script texts without need to create new GXT entries. Test script:

{$CLEO .cs}
nop

{$OPCODE 2605=-1,display_text_formated offset_left %1d% offset_top %2d% format %3d% args }

while true
    wait 0
    use_text_commands {state} true

    float pos = 0.0
    int idx
    for idx = 0 to 59
        pos += 7.0

        set_text_scale {width} 0.3 {height} 0.9

        int c = idx * 4
        set_text_colour {rgb} c 255 c {alpha} 255

        2605: display_text_formated {offset_left} 50.0 {offset_top} pos {format} "txt %d at %0.1f" {args} idx pos
    end
end

terminate_this_custom_script