I have no idea. I didn't even find the issue. I had help from the amazing @Juju.Why does adding a font make the difference?
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.As a side note to everyone, you'll need to somehow dynamically change the font size as you scale the window up.
How did you find out about my magic act?the amazing @Juju.
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).several other people had html5 problems something to do with this last update where they didn't before.
You need to right click on your objects folder and say "add existing" then find the object in the other project's folder.I'm trying to figure out how to move the display object to my own project
there is my project@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.
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.there is my project
///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));
window_set_fullscreen(!window_get_fullscreen());how I do the code to switch fullscreen in normal window mode?
but when I do the menu Huds are out of placewindow_set_fullscreen(!window_get_fullscreen());
Or you can just press Alt+Enter on windows.
What?I have to use the same code number of video 3
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:
With a game that looks like this: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));
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... ¯\_(ツ)_/¯
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.so i need to make a portrait game
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 wannaSo 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.
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:1) Scale the game maintain the view/port "zoom"
2) IF there are some black bars, fix these.
aspect_ratio = clamp(display_get_height() / display_get_width(),9/17,1);
ideal_width=350;
ideal_height=ideal_width/aspect_ratio;
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).Thanks Man for sharing your knowledge!
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.Emh i think there is something wrong xD
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.my game need to use draw_gui in Huds
buttons A = full screen and S = window
http://www.4shared.com/rar/0om9Xks6ce/Project_rpg.html
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.But could you actully make the tut you made easier to understand for samall brains. (Not including me, haha...)
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.
@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.
Glad you found it useful!THANKS A LOT
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
///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);
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;
}
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.@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.