• 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 View align at the bottom of the screen.

Hi there,
I am trying to do screen adjustment by device, following Pixelated pope tutorial.

Everything works great, screen is adjusting, but the thing is that the screen is adjusting at the bottom, top of the view is at the top of the screen, but what I need to have is, that bottom of the view is at the bottom of the device screen (hope it makes sense :) )

Here is code I have at the moment

Thank you
EH

Code:
if (os_type ==  os_android) {

        // Display Properties
        ideal_width = 720;
        ideal_height = 0;
        aspect_ratio = display_get_width()/display_get_height();
        ideal_height = round(ideal_width/aspect_ratio);

        // Check for odd number
        if (ideal_height && 1) ideal_height++;

        // Create camera
        global.camera = camera_create_view(108, 67, ideal_width, ideal_height, 0, -1, -1, -1, 0, 0);

        for (var i = 1; i <= room_last; i++)
            {
                if(room_exists(i)){
    
                // enable view and setup viewport
                room_set_view_enabled(i, true)
                room_set_viewport(i, 0, true, 0, 0, ideal_width, ideal_height);
    
                // set camera for room
                room_set_camera(i, 0, global.camera);
            }
        }

        surface_resize(application_surface,ideal_width,ideal_height);
        window_set_size(ideal_width,ideal_height);
}
 
Ok to clarify it even more :)
If the resolution is bigger than lets say 720x1280, it should stick to the bottom of the screen, like in the middle picture, what its doing is on the left, always stick with the top of the screen.

Thank you
 

Attachments

AcrobatEpee

Member
You maybe need to ajust your elements to your room height.

If you want your element to be standing at 20% from the top, divide your room_height by 100 and then multiply by 80 and then :

Room_height - (room_height/100) * 80

And your elements will be placed at 20% of your screen as wanted
 
Top