It seems to be not working for me with sprites what created from surface. Is there any chance to explain what you modified? Thanks.
Viewing post in Draw Sprite Pos Fixed for GameMaker: Studio comments
Just tested it in the project file and it seems working. Here is an example code:
surf = surface_create(512, 512); surface_set_target(surf); draw_clear_alpha(c_black, 0); draw_sprite(s_texture, 0, 0, 0); surface_reset_target(); sprite = sprite_create_from_surface(surf, 0, 0, 512, 512, false, false, 0, 0);
Are you trying to draw the surface itself? If so, change sprite_get_texture on surface_get_texture and sprite_get_uvs on [0, 0, 1, 1], should be working then.
Thanks for your quick reply and confirmation.
Basically I did the same (create sprite from surface), but just made a simple mistake when used draw_sprite_pos_fixed. I switched y3 and y4, and interestingly the normal draw_sprite_pos gave a twisted sprite (what was not an intention basically), however this fixed one had no outcome at all just a black screen, and I just thought it is surface related...
But I just corrected it, thanks for your help, your asset is working perfectly.
I wouldn't recommend using sprite_create_from_surface in this way, as I *think* it will infinitely create sprites and fill up memory.
this is what I did...
instead of:
var texture = sprite_get_texture(sprite, subimg) var uvs = sprite_get_uvs(sprite, subimg)
just do:
var texture = surface_get_texture(surface) var uvs = texture_get_uvs(texture)