Struggling with "Surfaces" . ( GONNA FREAK OUT )

I was working on a "digital design software" project on GMS2 and it requires a surface system as a matter of course but after a few failure in this project i've decided to create a brand new document and try learning how "Surfaces" actually work . i have a default room and an object in this new document .

The object in new document stores following codes in the draw evet.

GML:
#draw

if !surface_exists(canvas){canvas=surface_create(room_width,room_height);}    //checks for surface's existence
else{draw_surface(canvas,50,50)}                         //draws surface

surface_set_target(canvas)          //sets surface as target surface

var h =surface_get_height(canvas)         //gets surface height ans stores in canvas

draw_set_color(c_red)                                      //sets color to red
draw_circle(surface_get_width(canvas)/2,h/2,h/2,false)                //draws circle
draw_set_color(c_white)                                 //resets color to white

surface_reset_target()       //resets target surface

The problem is , i was expecting the red circle to get located in the middle of white surface stored in "canvas" variable but eventually it didn't .

I really don't know why and i wanna know .

EDIT: i tried to remove draw_surface(canvas) to see which canvas does it draw circle to and as i saw it draws the big red circle to the application surface which i don't want it to.
 

Attachments

Last edited:
Top