Android Really weird GUI distortion

Erayd

Member
So I'm setting up buttons that render on the GUI layer in the bottom two corners of the screen. I set the GUI width and height to not exceed the black bars around the game screen. Basically the whole button is just a rendering of a sprite at a spot on the GUI layer which looks nice. Everything to this point has been great, here's where it gets weird and stops making sense to me.

The goal is to make another object to put in the background at about the same size and shape as the two buttons, which moves along with the buttons. Then I can use this new object in my position_meeting method to check if the user just touched it. I do this because if I were to draw the object normally then I get "laggy" buttons when I move which is just bad.

I've done this before in other games, but THIS time, just by putting in a step event in to the background object and then putting in the relocation code for the movements, causes my entire GUI layer to become distorted. Basically everything gets taller. I don't even have to put the object in the room, it doesn't even have a sprite or any draw events, but somehow by commenting out the x and y movement code, the GUI goes back to normal.

Any thoughts? I'm at a loss right now, a good nights sleep just might be the only answer to this. Also if anyone has an easier way to add buttons that look nice in screen and that can just be easily clicked, let me know, cause this was sucks.

Draw GUI Event inside of obj_GameState
Code:
///Draw In-Game GUI
if(state == "game"){
    for(i = 0; i < obj_Player.maxHp; i++){
        if(obj_Player.hp - 1 >= i) draw_sprite_ext(spr_HPFull, 0, 20 + i*105, 10, 1, 1, 0, c_white, 1);
        else draw_sprite_ext(spr_HPEmp, 0, 20 + i*105, 10, 1, 1, 0, c_white, 1);
    }
   
    draw_sprite_ext(spr_Attack, 0, 0, display_get_gui_height() - 300, 1.5, 1.5, 0, c_white, 1);
    draw_sprite_ext(spr_Attack, 0, display_get_gui_width(), display_get_gui_height() - 300, -1.5, 1.5, 0, c_white, 1);
}

Step event inside obj_Attack
Code:
///Movement
if(left){
    x = view_xview;
    y = view_yview;
}

if(right){
    x = view_xview;
    y = view_yview;
}
 
Last edited:
A

Aura

Guest
Welcome to the GMC!

Please post the complete code with context, that is, the events you're putting it in.
 

Erayd

Member
Updated, sorry about that, I wasn't really sure it would help but it doesn't hurt anyway, all part of providing the whole scope of the situation for a full investigation.
 

Yal

šŸ§ *penguin noises*
GMC Elder
I've done this before in other games, but THIS time, just by putting in a step event in to the background object and then putting in the relocation code for the movements, causes my entire GUI layer to become distorted. Basically everything gets taller. I don't even have to put the object in the room, it doesn't even have a sprite or any draw events, but somehow by commenting out the x and y movement code, the GUI goes back to normal.
That doesn't sound like something that WOULD affect the drawing code, so I'd guess it might be a cache corruption or something. Have you tried using display_set_gui_size() to lock the size of the GUI?
 
I

icuurd12b42

Guest
1) Call display_set_gui_size() to emulate a resolution for you gui. Use the size you designed your gui for. that is what this function is for. for example, I set the gui size to emulate 1080p because I designed my UI at 1080p
2) I dont see how your x,y code would break stuff.
3) Make sure you have clear the window and the view or room with background color checked in your room/view settings... without those some device freak out in the render
 

Erayd

Member
I do have the clear with background color box checked. And I also do have the display_set_gui_size() method already, to make sure the gui only rendered inside of the game screen and not on the black bars.

@Yal It does sound like something in the background is getting confused, is there a way to clean the game well?

Want to hear something even weirder than this? By adding a sprite in to the attack trigger object instead of just leaving it blank, the gui goes back to normal... I'm assuming this is a bug?
 
Last edited:
Top