CLEO Help Texture Drawing problem

CLEO related
Status
Not open for further replies.

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
Code:
while true
    wait 0
    
    if and
        0AB0: key_pressed X
    then
        while 0AB0: key_pressed X
        wait 0
        end
        // Toggle the switch
        0B12: 8@ = 8@ XOR 1
        end
    end
    
    if 0039: 8@ == 1
    then
        gosub @drawTexture
    end
end
        
:drawTexture
    03F0: enable_text_draw 1
    03E3: set_texture_to_be_drawn_antialiased true
    038D: draw_texture TEXTURE position 320.0 224.0 size 300.0 300.0 RGBA 255 255 255 175 
return

Morning,

I have this extremely simple code that I expected to work a a certain way, but it doesn't.
More precisely, the problem is that the "alpha" channel will not work. My guess is that too many pictures overlay and the transparency dissapears.
I've tried giving up gosub, although it has no sense. Also tried to use enable_text_draw 0 (read somewhere that 1 = permanent, 0 = just once. Anyways, it shouldn't make any difference).

What actually did something was adding a wait in my sub-routine. But it also induced a flicker.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Ok so I tried to replicate this and when I was changing around the "enable_text_draw" it spammed the texture draw overlaying to the point where the "ALPHA" didn't matter anymore. This doesn't point towards the issue however as I basically forced this bug by having multiple "enable_text_draw" opcodes (one at the top of the script, and one in the loop) I mean maybe you do have multiple "enable_text_draw" really you would only need one even just for optimisation and simplicity purposes. I tried your code and it works perfectly fine, although you clearly haven't posted the entire thing the concept of gosubing "draw_texture" is perfectly fine.
You can even see and test for yourself (used a default gtasa TXD)
C++:
{$CLEO .cs}

THREAD 'TXD'

0390: load_txd_dictionary 'LD_BEAT'
038F: load_texture "upr" as 5

CONST
    TEXTURE = 5
END

WHILE TRUE
    WAIT 0
    
    IF
        0ADC:   test_cheat "XD"
    THEN
        0B12: 0@ = 0@ XOR 1     
    END
    
    IF
        0@ == TRUE
    THEN
        gosub @DRAW
    END
        
END

:DRAW
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture TEXTURE position 320.0 224.0 size 300.0 300.0 RGBA 255 255 255 175
return
 

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
Ok so I tried to replicate this and when I was changing around the "enable_text_draw" it spammed the texture draw overlaying to the point where the "ALPHA" didn't matter anymore. This doesn't point towards the issue however as I basically forced this bug by having multiple "enable_text_draw" opcodes (one at the top of the script, and one in the loop) I mean maybe you do have multiple "enable_text_draw" really you would only need one even just for optimisation and simplicity purposes. I tried your code and it works perfectly fine, although you clearly haven't posted the entire thing the concept of gosubing "draw_texture" is perfectly fine.
You can even see and test for yourself (used a default gtasa TXD)
C++:
{$CLEO .cs}

THREAD 'TXD'

0390: load_txd_dictionary 'LD_BEAT'
038F: load_texture "upr" as 5

CONST
    TEXTURE = 5
END

WHILE TRUE
    WAIT 0
  
    IF
        0ADC:   test_cheat "XD"
    THEN
        0B12: 0@ = 0@ XOR 1   
    END
  
    IF
        0@ == TRUE
    THEN
        gosub @DRAW
    END
      
END

:DRAW
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture TEXTURE position 320.0 224.0 size 300.0 300.0 RGBA 255 255 255 175
return

Thank you for trying. My initial thought was that there is something wrong with the gosub idea.
Two things I'd like to mention: the problem is intermittent, so further testing is required (I am going to try your code when I wake up).
Second thing: I thought that enable_text_draw just sets a flag. If that's the case, then a call in the header might not be enough, as it can be disabled by some other thread. Moreover, other scripts might interfere (I remember one time a script was only working simultaneously with a secondary script that had the text_draw enabled, otherwise it crashed).

EDIT: Even with a single "enable_text_draw 1" in the header, it still overlays. I might just give up and write it in C++
 
Last edited:
Status
Not open for further replies.
Top