Scaling, Resolution, and Aspect Ratio Management for GMS1 & GMS2

Discussion in 'Tutorials' started by Pixelated_Pope, Sep 12, 2016.

  1. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Uhfgood did you turn off interpolate colors between pixels in the HTML global game options?
     
  2. Uhfgood

    Uhfgood Member

    Joined:
    Sep 26, 2016
    Posts:
    87
    @Pixelated_Pope - It's funny, I kept looking through settings and preferences trying to find if there was some setting I needed to change. I didn't realize the side tabs (I had seen them before but I guess I didn't really notice them there this time). So apparently that was the problem and now it works great :)

    Thanks a bunch!

    As a side note to everyone, you'll need to somehow dynamically change the font size as you scale the window up. (I don't know if you can do this using GML, but I'm assuming possibly you can).

    And now the question is: Why does adding a font make the difference? If you look through other posts you'll notice that several other people had html5 problems something to do with this last update where they didn't before. So something is broke somewhere.
     
  3. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    I have no idea. I didn't even find the issue. I had help from the amazing @Juju.

    Ideally, you'd be drawing your text in a draw gui event. If you make your gui size the same as your ideal width and height, as the window increases in size your text will stay the same size. However if you've selected a font that just doesn't look good when scaled up for some reason, yeah, you'll need multiple copies of the same font with different sizes. So I recommend trying to find a font that you like when zoomed in.
     
  4. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @fedyfausto I would probably need to see your code. The fact that your window isn't respecting your aspect ratio suggests that something odd is going on. If you want, you can send your project and I could probably quickly debug it, or you can just paste all the relevant code in here and I'll see if I notice anything out of place. It is strange that it works in windows mode but not HTML... this could be do to the real time changing sizes of the browser window.
     
  5. Juju

    Juju Member

    Joined:
    Jun 20, 2016
    Posts:
    380
    How did you find out about my magic act?

    This particular behaviour has been observed, in different ways, for quite a while. HTML5 doesn't add any fonts - not even the default font - to the export package unless you explicitly add them to the project. This is because font pages are typically quite large and you want to keep web games as lightweight as possible. I suspect GM is failing when you try to draw text without a font available for GM to use (disclaimer: not tested for this at all).
     
  6. Uhfgood

    Uhfgood Member

    Joined:
    Sep 26, 2016
    Posts:
    87
    BTW although this isn't a question about the project itself, I'm trying to figure out how to move the display object to my own project, can I just move it from the objects folder into my new project's objects folder? Or do I need to do something special?
     
  7. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    You need to right click on your objects folder and say "add existing" then find the object in the other project's folder.
     
  8. Uhfgood

    Uhfgood Member

    Joined:
    Sep 26, 2016
    Posts:
    87
    Thanks much!
     
  9. fedyfausto

    fedyfausto Member

    Joined:
    Sep 17, 2016
    Posts:
    20
    there is my project :D

    http://www.filedropper.com/telegramtest
     
  10. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    Okay. First off, what are you trying to do? Because this display manager is sort of all about "getting rid of the black bars" and it seems like you really want a portrait game. If so, you need to clamp your aspect ratio to screen ratio you want to support. This will create black bars on any screen (or browser window) that isn't the expect aspect ratio.

    That's totally fine if that's what you want to do... but you need to fix some things.

    First, you are calculating both your ideal width and ideal height. You shouldn't be doing that. Just set one and calculate the other. This is how you allow the game to change its size within the bounds of your supported aspect ratios.

    So, let's say your game only supports 9:16 portrait aspect ratio. This is what your code should look like:

    Code:
    ///DISPLAY PROPRIETIES
    
    ideal_width=0;
    ideal_height=640;
    zoom=1;
    max_zooom=1;
    
    
    aspect_ratio = clamp(display_get_height() / display_get_width(),9/16,9/16);
    
    ideal_width = round(ideal_height*aspect_ratio);
    
    
    if(ideal_width & 1){
        ideal_width++;
    }
    
    if(ideal_height & 1){
        ideal_height++;
    }
    
    //Calculate Max Zoom
    max_zoom=floor(display_width/ideal_width);
    
    for (var i=1; i <=room_last; i++){
        if(room_exists(i)){
            room_set_view(i,0,true,0,0,ideal_width*.5,ideal_height*.5,0,0,ideal_width,ideal_height,0,0,0,0,-1);
            room_set_view_enabled(i,true);
        }
    }
    
    
    surface_resize(application_surface,ideal_width,ideal_height);
    display_set_gui_size(ideal_width,ideal_height);
    window_set_size(ideal_width,ideal_height);
    alarm[0]=1; //windows center
    room_goto(room_next(room));
    With a game that looks like this:

    https://gyazo.com/ee8c261728bedb7df566c5e85e330d46

    I guess I really don't understand what you are hoping to get out of the display manager. Your game seems to be designed for a very specific width and height and you don't want to support anything outside of that, and you certainly aren't trying to get rid of the black bars when on a landscape display... so... ¯\_(ツ)_/¯
     
  11. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    how I do the code to switch fullscreen in normal window mode?
     
  12. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    window_set_fullscreen(!window_get_fullscreen());

    Or you can just press Alt+Enter on windows.
     
  13. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    but when I do the menu Huds are out of place
    I have to use the same code number of video 3
     
  14. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    What?
     
  15. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    this problem



    fora.png
     
    Last edited: Oct 27, 2016
  16. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Pmo121085 I'm sorry, but that really doesn't help me help you. If you can explain the problem in detail and maybe provide me with a link to your exported GMZ (PM it to me), I'd be happy to take a look and help you figure out what's going on.
     
    Pmo121085 likes this.
  17. fedyfausto

    fedyfausto Member

    Joined:
    Sep 17, 2016
    Posts:
    20

    oh yeah i'm tring to make some game for new Telegram Bot so i need to make a portrait game :D
     
  18. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    So the question is: do you only want to support ONE portrait aspect ratio? 9:16 for example? Or do you need to support 10:16? 9:17? Maybe something even weirder? If so, I think the display manager can still work for you, but if you want me to help, I sorta need to know what you want to accomplish.
     
  19. fedyfausto

    fedyfausto Member

    Joined:
    Sep 17, 2016
    Posts:
    20
    i want to support some portrait ratio /resolution but i want to maintain the original "zoom" of my game (the View size and port size). So i wanna
    1) Scale the game maintain the view/port "zoom"
    2) IF there are some black bars, fix these.
     
  20. birdog

    birdog Member

    Joined:
    Oct 26, 2016
    Posts:
    3
    Amazing stuff, I remember back when yoyo team posted the scaling tut on the blog it took me half a day to go through all the material ans in the end I just didn't get it to work like I needed(GUI+scale) :( Now, saw this post wanted to get one more try and it only took me less than 1h to go through the videos + implementing it to my game, and everything is perfect like it should be, and it's actually so simple!
    Thanks Man for sharing your knowledge!
     
    Pixelated_Pope likes this.
  21. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    Okay. So yeah, look at the code I pasted for you above. That will do what you want. But you need to replace the two 9/16 with the range of aspect ratios you want to support. So you could say 9/17 to 1. And that will cover all portrait resolutions from 9/17 down to full. Then you need to decide which side of your game needs to be consistent: your width or your height. Type in the one you want to maintain and then calculate the other. So say you want your width to always be the same number of pixels, do this:

    Code:
    aspect_ratio = clamp(display_get_height() / display_get_width(),9/17,1);
    ideal_width=350;
    ideal_height=ideal_width/aspect_ratio;
    
    Don't calculate BOTH your ideal width and ideal height.

    So happy it helped you! I did the exact same thing. I think I went through those tutorials like... 4 or 5 times trying to understand them and it never really clicked for me either. I spent like 4 weeks researching how all of this stuff works for this video series, so it really feels good to be able to help people who have been struggling with it (especially those who have gone through the built in tutorials).
     
  22. fedyfausto

    fedyfausto Member

    Joined:
    Sep 17, 2016
    Posts:
    20
    Emh i think there is something wrong xD (if i open the game in fullscreen browser i see the game correctly)

    [​IMG]

    UPDATE:
    There is my Bot for telegram games, type /kingbox for get the game (with this you can test on your device)
    https://telegram.me/pixelgames_bot

    this is my current project if you can try on your computer:
    https://ufile.io/2c116


    UPDATE 2:
    i fixed little bit forced the aspectratio max

    aspect_ratio = clamp(display_get_height() / display_get_width(),9/16,.63);

    and i fixed my obj_scale_controller for html resize (if can you test my game on your phone pls post a screen xD )
     
    Last edited: Oct 29, 2016
  23. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    Okay, dude, I gotta be honest. This tutorial was never really intended to give you a manager that would be the end all be all of resolution and aspect ratio management for any game on any platform, etc, etc. If that was the purpose, I would have spent all 3 or 4 parts writing that manager and giving it to you. The purpose was to help you understand why black bars occur, why pixel distortion happens, and what parts of gamemaker can be manipulated to reduce the problems. I'm beginning to question whether you watched parts 1 and 2 at all, or if you are just allergic to critical thinking.

    This is not rocket science.

    If you got that screenshot as a result of resizing the window after the game started running, MAYBE you need to react to the display size changing as your game is running instead of just in the create event? Maybe in the step event? Regardless, I'm not going to write that for you. You know which parts are not working: your view's aspect ratio is not resizing according to the display's new aspect ratio, and your application surface probably has the same problem. You have all the pieces to your puzzle. Put them together.

    That being said, if you try to get it to work, and honestly, TRULY try your hardest and it just isn't working... I'll take a look and show you what you are doing wrong, but I'm going to want you to get on Skype with me, and we will go through the code together and actually figure it out so we can stop this back and forth of "this isn't working".

    But let me tell you, you are not going to get far in this game programming thing if you can't take all the pieces to the puzzle and put it together yourself.
     
  24. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
  25. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
  26. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    If you want me to help, I need you to give me the code for your game. Don't export an exe, you need to do a file > export to get a GMZ file and give me the link to that.

    @fedyfausto Looks like you've made some progress. Get it all worked out or are you still having issues?
     
  27. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    Ready
    I created the gmz file
    In the game I use drag drop to change the resolution Window / fullscreen (buttons A and S)
    the code for hus is that in Draw_gui

    draw_sprite(Moldure,0,650,287);
    draw_set_color(c_black);

    if Player.controle = true
    {
    draw_text(742,37,string(nome));
    draw_sprite(spr_life,0,708,82);
    draw_text(742,87,string(hp));
    draw_sprite(spr_mana,0,708,112);
    draw_text(742,117,string(mana));
    draw_sprite(spr_level,0,708,142);
    draw_text(742,147,string(levelup));
    }
    else
    {
    draw_text(742,37,string(nome2));
    draw_sprite(spr_life,0,708,82);
    draw_text(742,87,string(hp2));
    draw_sprite(spr_mana,0,708,112);
    draw_text(742,117,string(mana2));
    draw_sprite(spr_level,0,708,112);
    draw_text(742,117,string(levelup2));
    }


    File GMZ
    http://www.4shared.com/rar/oMWNC2K0ba/Project_rpg.html
     
  28. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Pmo121085 Well, there's your problem, man. You can't use hard coded values when using dynamic resolutions. You need to dynamically positions all of those numbers you've typed in. ALL OF THEM. Use display_get_gui_width() and display_get_gui_height() to position things relative to the right side and the bottom of the GUI.
     
  29. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    I think I've made it about as basic as possible. This is an advanced problem, and as I mention in the FAQ video, if it's too difficult, then just don't worry about it. Make the best game you can for whatever resolution you decide to make your game for. If it's a good game, people won't care about black bars or a bit of pixel distortion.
     
    Guest User likes this.
  30. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32

    It should be used to draw Gui same?

    like this?

    draw_sprite(Hud_spr0,0, display_get_gui_width(),display_get_gui_height());
    draw_set_color(c_black);
     
  31. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    you can change the code for me?
     
  32. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Pmo121085 No. I will not write your GUI for you. If you are having a hard time figuring out how to design and write your gui for dynamic sizes, I recommend ignoring all this nonsense and just making a game for a static resolution with black bars and pixel distortion. Make the best game you can and worry about it when you gain more experience and learn more about working with dynamic sized elements in game development.
     
  33. Pmo121085

    Pmo121085 Member

    Joined:
    Oct 9, 2016
    Posts:
    32
    OK, thank you
     
  34. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    I'm having a really hard time with ideal_height. 256 is just a little box at the top left hand corner of my screen. 786 covers the whole screen and 640 show at the mid center of the screen and trails off to the right bottom.

    What I'm trying to say is, I looked at OP's tutorial so as the game can be played correctly on androids, and tablets. So what ideal_height should I use for android, and tablet users? In other words, I don't know what ideal_height to use. =/

    EDIT: Okay so it doesn't seem to matter what ideal_height I set it at, the game is appearing in the center of the screen and trailing off to the bottom right. I'm gonna tweak on it some more.
     
    Last edited: Nov 22, 2016
  35. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    My problems:
    1.) I thought the code was going to make the window of the game fit to any scale size.
    2.) The image below is what is happening to my game and it's because of the ideal_height and ideal_width.
    3.) The rooms are 1024 by 768
    4.)The game is set for HTML5
    5.)I'd like my players to be able to play the game on all screens such as phones and tablets.
    6.)Why is my screen small a square box no matter what number I use? Test GameMaker Screen.png
     
  36. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    The game isn't fitting my screen. I tweeked it so as the room that contains the 'display_manager' is the same room as my other rooms which is 1024x768 and that fixed the room...kind of. Why is this code:

    ideal_width=0;
    ideal_height=640;

    not working? Why are none of the heights working? Is it because I'm working in HTML5?
     
  37. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    My views per room are also in 1024x768.
     
  38. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Tenten2016
    Whoa. Okay. So, seems you are having a lot of problems. So first off, let's eliminate HTML5 for now, since you will have to do extra work to get this to work WELL in HTML5 (such as resizing as the user changes their browser).

    So what happens when you run the game in windows? How does it look? What happens when you switch to full screen? Does that look better?

    You shouldn't be setting up "views" in your rooms at all. The manager automatically sets the view sizes for all of your rooms using your ideal height and width.

    Also, I don't know about you specifically, but my view numbers don't lie: many, MANY people watch some of part 1, skip part 2, and then just use the code from part 3. The display manager is NOT an end all, be all, perfect solution, and the bulk of this tutorial is intended to teach you how to solve these problems on your own. I'm tempted to take down part 3, as it seems a lot of people just copy the code and have no idea how it works or why I did it the way I did. So, please, if you haven't already, watch ALL of part 1 and 2. Try to understand how all of this works, and then you will have an easier time understand what's going on when you don't see the results you expected.
     
  39. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    I learn by manipulating basic code. I was never one for just sitting and reading, or watching. I like to dive on in! The only reason why I'm having a difficult time because I thought your tutorial was going to work for HTML5 but it's only works for Windows.

    This code messed up the entire game lol and I'm really glad that I saved it as a new file before beginning this process. Everything is every where now.

    I'm going to try and nick pick this code apart and to get it to work on HTML5; one thing I like about Game Maker is that there's always more than one way to do things and I usually(don't want to say always) find a solution for a code if I have a problem.

    We'll see what happens =D
     
  40. Tenten2016

    Tenten2016 Member

    Joined:
    Aug 30, 2016
    Posts:
    73
    PROBLEM SOLVED!!!! Here's what I did differently for those of you working with HTML5. Also you can still test on Windows as well. This is of course not the full on code because I too want you guys to problem solve but here are the basics for what I used

    Test Mode= 0 or 1 // Set this to 1 when testing on computer, 0 for deployed device

    var test_width and height // default aspect ratio

    if test mode = 0 or 1 then display width for window and display height for window follow by displace aspect ration with display height and width else display w and display h follow by test w and test h.

    Then set the vertical view and ports to our new aspect ratio and resize display GUI and set application surface to your new aspect ratio.

    Be sure to put the script in a object and then place the object in every room you have. =D
     
  41. MEX_XIII

    MEX_XIII Member

    Joined:
    Jul 18, 2016
    Posts:
    4
    I was looking for a way to go fullscreen with my game without loosing the PIxel Perfect aspect for months. I dind't found anything aside mantaining resolutions that were directly multiples of my game's original resolution. This will come so much in handy that you don't even know. THANKS A LOT <3
     
  42. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    Glad you found it useful!
     
  43. Wraithious

    Wraithious Member

    Joined:
    Jun 24, 2016
    Posts:
    1,166
    Hi Pixelated_Pope I have a question, I've been using the advice in your tutorial and it has been working great for my Android games, but in my new game I use views and things got weird and I can't figure out why, it involves the positioning of virtual keys, they won't line up with my controller sprites. any Idea what I'm doing wrong or not doing? this is how I have it set up:
    Room creation code:
    Code:
    var base_w = 950;//width of original game
    var base_h = 726;//height of original game
    var aspect = base_w / base_h ; // get the GAME aspect ratio
    global.dw=display_get_width();
    global.dh=display_get_height();//get the actual display size
    if (global.dw < global.dh)
        {
        //portrait
        var ww = min(base_w, global.dw);
        var hh = ww / aspect;
        if(global.dw & 1)
        global.dw++;
        if(global.dh & 1)
        global.dh++;
        global.sx=ww/base_w;//Sets up scale ratio for width
        global.sy=hh/base_h;//Sets up scale ratio for height
        }
    else
        {
        //landscape
        var hh = min(base_h, global.dh);
        var ww = hh * aspect;
        if(global.dw & 1)
        global.dw++;
        if(global.dh & 1)
        global.dh++;
        global.sx=ww/base_w;//Sets up scale ratio for width
        global.sy=hh/base_h;//Sets up scale ratio for height
        }
    surface_resize(application_surface, ww, hh);//resize the game
    display_set_gui_size(ww,hh);//resize the drawing canvas
    Note: All rooms are the same size (950 x 726) and views are enabled in all rooms and are set up the same: view size 640 x 480 with x and y set to 0 and 0

    Create event for directional arrows controller:
    Code:
    ///Set up the virtual arrow keys
    canchoi=1;image_single=0;
    x = view_xview[0] + 16;
    y = view_yview[0] + 344;
    vikey0=virtual_key_add(x+88*global.sx,y,33*global.sx,119*global.sy,vk_right);//right
    vikey1=virtual_key_add(x+6*global.sx,y+86*global.sy,115*global.sx,33*global.sy,vk_down);//down
    vikey2=virtual_key_add(x+6*global.sx,y,33*global.sx,119*global.sy,vk_left);//left
    vikey3=virtual_key_add(x+6*global.sx,y,115*global.sx,33*global.sy,vk_up);//up
    virtual_key_show(vikey0);
    virtual_key_show(vikey1);
    virtual_key_show(vikey2);
    virtual_key_show(vikey3);
    Step event:
    Code:
    if(keyboard_check(vk_left)&& !(keyboard_check(vk_up)|| keyboard_check(vk_down))){global.lt=1;
    global.rt=0;global.up=0;global.dn=0;global.dl=0;global.ul=0;global.ur=0;global.dr=0;global.st=0;}else//Left
    {if(keyboard_check(vk_right)&& !(keyboard_check(vk_up)|| keyboard_check(vk_down))){global.rt=1;
    global.lt=0;global.up=0;global.dn=0;global.dl=0;global.ul=0;global.ur=0;global.dr=0;global.st=0;}else//Right
    {if(keyboard_check(vk_up)&& !(keyboard_check(vk_left)|| keyboard_check(vk_right))){global.up=1;
    global.lt=0;global.rt=0;global.dn=0;global.dl=0;global.ul=0;global.ur=0;global.dr=0;global.st=0;}else//Up
    {if(keyboard_check(vk_down)&& !(keyboard_check(vk_left)|| keyboard_check(vk_right))){global.dn=1;
    global.lt=0;global.rt=0;global.up=0;global.dl=0;global.ul=0;global.ur=0;global.dr=0;global.st=0;}else//Down
    if( !keyboard_check(vk_right)&& !keyboard_check(vk_up)&& !keyboard_check(vk_left)&& !keyboard_check(vk_down)){global.st=1;
    global.lt=0;global.rt=0;global.up=0;global.dn=0;global.dl=0;global.ul=0;global.ur=0;global.dr=0;}else//stop
    {if(keyboard_check(vk_down)&& keyboard_check(vk_right)){global.dr=1;
    global.lt=0;global.rt=0;global.up=0;global.dn=0;global.dl=0;global.ul=0;global.ur=0;global.st=0;}else//Down Right
    {if(keyboard_check(vk_down)&& keyboard_check(vk_left)){global.dl=1;
    global.lt=0;global.rt=0;global.up=0;global.dn=0;global.ul=0;global.ur=0;global.dr=0;global.st=0;}else//Down Left
    {if(keyboard_check(vk_up)&& keyboard_check(vk_right)){global.ur=1;
    global.lt=0;global.rt=0;global.up=0;global.dn=0;global.dl=0;global.ul=0;global.dr=0;global.st=0;}else//Up Right
    {if(keyboard_check(vk_up)&& keyboard_check(vk_left)){global.ul=1;
    global.lt=0;global.rt=0;global.up=0;global.dn=0;global.dl=0;global.ur=0;global.dr=0;global.st=0;}}}}}}}}//Up left
    if(global.osys=1)
    {if(visible=0){visible=1;}
    if global.lt=1 image_single=5;
    if global.rt=1 image_single=1;
    if global.up=1 image_single=7;
    if global.dn=1 image_single=3;
    if global.st=1 image_single=0;
    if global.dr=1 image_single=2;
    if global.dl=1 image_single=4;
    if global.ur=1 image_single=8;
    if global.ul=1 image_single=6;
    }
    if(visible=1 && global.osys=0){visible=0;}
    if(global.osys=1 && global.st !=1)
    {x = view_xview[0] + 16;
    y = view_yview[0] + 344;
    }
    And so this is the result I get when running the game:

    Screenshot.png
     
    Pixelated_Pope likes this.
  44. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @Wraithious Wow. First off, great job on watching the tutorial and actually applying it rather than just copying and pasting it into your project. Gold star.

    So, there's a lot of code there, and I'm not sure exactly what your problem is, but I would like to make one suggestion to try and eliminate a possibility.

    It seems you are using the default draw behavior for your buttons, which draws them in the view. Why not use the draw_gui event and draw them relative to the screen instead of the view? This is how virtual keys work in the first place, so if you draw the sprite for the key exactly where you created the virtual key (again, ignore your view position, it's irrelevant) in a GUI event, then I have a feeling everything will line up perfectly. But if not, we can look at it a bit further from there. Don't forget to add an empty code block or comment in the standard draw event to prevent the sprite from drawing using the draw event.
     
    Wraithious likes this.
  45. Wraithious

    Wraithious Member

    Joined:
    Jun 24, 2016
    Posts:
    1,166
    Thanks that seems to have solved my problem, and I also changed the initial base_width and base_height from 950, 726 to the view size of 640 and 480 in the beginning of the room creation code, I think the combination of switching to gui and sizing according to my view worked, thanks again and your tutorial is really great!
     
  46. TheMatrixHasMe

    TheMatrixHasMe Member

    Joined:
    Jun 22, 2016
    Posts:
    176
    Super great tutorial Pixelated_Pope has put together for us. I can't wait to master all the techniques used here. It already gave me a presentation idea when entering the game room. Thanks for this!
     
  47. TheMatrixHasMe

    TheMatrixHasMe Member

    Joined:
    Jun 22, 2016
    Posts:
    176
    @Pixelated_Pope I'm getting a strange ghost remnant. It's almost as if the application_surface isn't clearing the remnant but this would almost be a surface outside of gamemaker since it's outside the window no?

    Anyone know what is happening and how I can rid of it?

     
  48. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    @TheMatrixHasMe I'm not really sure what I'm looking at. Is the full screen your game or your desktop? This looks like a video card issue if that's the case.
     
  49. TheMatrixHasMe

    TheMatrixHasMe Member

    Joined:
    Jun 22, 2016
    Posts:
    176
    My apologies. I should have explained more. It's a black desktop background and then the game window over it. A couple of times I hit the "Z" for zoom as you did in your video and then there are also a few instances where I'm holding down "w" for width and then hitting the "+" key and adding 20 pixels to the display_width variable. The point is, when it re-centers the game window it leaves a weird surface remnant.
     
  50. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    766
    Yeah, if that's showing up outside of the game window and on your desktop, that is most definitely a video card related issue and not a GM related issue.

    [Edit] I'd be curious to see what this looks like with a desktop wallpaper. Just add any default image to your desktop and see if this still occurs.
     
    TheMatrixHasMe likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice