GMS 2 Drawing text shows random sprite pieces instead

Discussion in 'Programming' started by AnalogF6, Jul 16, 2019.

  1. AnalogF6

    AnalogF6 Member

    Joined:
    Jan 12, 2018
    Posts:
    18
    Any time I draw text normally, I get the normal result. As soon as text is drawn with a loaded font, though, it shows a garbled mess of sprite segments. I think it may be getting parts of the surface layer, but trying different fonts, files, and sizes make no difference.



    A picture, when using a font.
    upload_2019-7-16_7-55-33.png

    And when not using a font:
    upload_2019-7-16_7-56-25.png


    For more information, here is a segment from another object where I'm drawing to the surface.

    Code:
    var lay_id = layer_get_id("Wall_Layer");
       var map_id = layer_tilemap_get_id(lay_id);
       if ds_grid_get(wallgrid,xcheck,ycheck) != 0
       {
           draw_self()
           surface_set_target(shadow)
           draw_tilemap(map_id,0,0)
           gpu_set_colorwriteenable(false,false,false,true)
           draw_tilemap(map_id,0,0)
           gpu_set_colorwriteenable(true,true,true,false)
           draw_sprite_part_ext(spr_cap_walktest,image_index,0,0,16,16,x,y,1,1,c_black,.5)
           surface_reset_target()
    
           draw_surface(shadow,0,0)
    
       }
       else
           draw_self()
    
    I assume the problem is that the surface texture memory is used when text is drawn somehow. The drawing of the text is happening in a separate object in the GUI event. Do I need to draw text inside the surface procedure?

    Thanks in advance,

    AnalogF6
     
  2. AnalogF6

    AnalogF6 Member

    Joined:
    Jan 12, 2018
    Posts:
    18
    I identified the issue. Looks like it was a bug in an older version of GMS 2.0. Once I updated the issue was resolved.
     
  3. Kasra_n

    Kasra_n Member

    Joined:
    Jun 19, 2019
    Posts:
    26
    i had the same issue with gms, try to clear target cache before compile, it works fine for me
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice