# Error in DRAW GUI event on android. (GameMaker)

Image of the game on a mobile phone:

As you can see the maze (draw event) has been resized correctly.

But the yellow post-it (draw GUI event) has not been scaled or displayed in the correct location (center of the screen). Same thing with GUI layout (draw GUI event).

Because this is a small stage/room (size) I do not use the artifice of views, I thought that could be because of that the problem, but I enabled the views and did not get any different result.

Picture of the game on a computer (like it should be on the phone):

OBS - One information that can help you to help me solve the problem, is that to draw the post- it I use the following code: draw GUI event draw_sprite(spr_Post,0,640,360);.

640 is the half screen width of the game and also the room, 360 is half the height of the game screen and also the room.

It seems that somehow the room on the cell phone is different size than 1280x720.

I do not put the following code: draw GUI event draw_sprite(spr_Post,0,room_width/2,room_height/2), because there are much larger phases that need views, so the post-it needs to be in the center of the screen of the player, and with this code it ends up being in the center of the phase.

I tested the game on Bluestacks and it did not happen the same as on the phone.

• This sounds like a game maker bug. I would send an email to yoyogames asking for more details. – user64742 Dec 28 '18 at 4:42

Here I am again to the rescue XD

Instead of using room_width or room_height that are the size of the room, use the size of the view, the variables are view_xview, view_yview, view_wview and view_hview that are related to the current view so use the index [0] with the number of the view on all variables.

draw_sprite(sprite_index, view_xview[0]+view_wview[0]/2, view_yview[0]+view_hview[0]/2);

It will make the object origin to be in the center of the screen/view.

Edit: The Draw_GUI event is relative to the view coordinate system. Edit2: added some code to try

Check them in the manual to see examples.

• I changed the code to draw_sprite(spr_Post,0,view_wview[view_object]/2,view_hview[view_object]/2); and did not change the result. – Boneco Sinforoso Feb 18 '19 at 13:47
• Before I tried with the number of the vision, but also with no result. – Boneco Sinforoso Feb 18 '19 at 13:48
• I've added some code, it is typically used to fix healthbars to the view – Juanpa Feb 18 '19 at 15:41
• For me it worked as follows: display_set_gui_size(1280,720);. In the next line just put: draw_sprite(spr_Post,0,640,360); – Boneco Sinforoso Feb 19 '19 at 12:35
• @BonecoSinforoso If that worked for you, please consider sharing it as an answer that you can mark Accepted. – DMGregory Mar 20 '19 at 16:56

display_set_gui_size(1280,720);
draw_sprite(spr_Post,0,640,360);