• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Drawing text shows random sprite pieces instead

AnalogF6

Member
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
 

AnalogF6

Member
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.
 
K

Kasra_n

Guest
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.
View attachment 25779

And when not using a font:
View attachment 25780


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
i had the same issue with gms, try to clear target cache before compile, it works fine for me
 
Top