#Trying to understand how to make window borders, in fullscreen as well

1 messages · Page 1 of 1 (latest)

analog pollen
#

Note, i've been looking at surfaces and game scaling blogs, but still not sure or not understanding what or how to do this. So i'd like if someone could explain how things should work.

Basically, as of first i'm trying to understand if i can scale the window to be bigger, but while keeping the draw surfaces the same size, so i can have borders around the game. Then, if this would work when setting fullscreen, or if i need to use something else.

For now i only understood that i could play around with application surface? and also the window size.

(Hope the image explains better the situation i'm looking for)

shy garnet
#

So the application surface is just a surface that is automatically drawn for you, but you can disable that with application_surface_draw_enable(false), then you can resize your window to be size of the borders, both on a create event (ideally make an object that handles that). Finally on a post draw event you can just draw the application surface with draw_surface_stretched() to the desired position and dimensions

#

The x position will be (window_get_width() - surface_get_width(application_surface)*scale)*0.5;

The width to draw the surface will be: surface_get_width(application_surface)*scale;

scale will be an integer number, whatever works best in your case, start at 1 and go up

y/height are similar just change width to height there.

#

You can draw a background for the borders in the pre draw event

#

This is a very basic implementation tho, eventually you will wanna let the user resize the window on a menu and scale will need to be recalculate based on that

analog pollen
#

Oooh! Thank you man!
I'll try this whenever i'm able to, but thank you for explaining!! :D

analog pollen
#

Ok, so everything works. And thank you very much for the explanation once again. I've been able to find my way around these, but i still have one problem.

Since i've been using the GUI layer to draw the menus and such, i wanted to know if i could change where the GUI layer origin starts since from what i'm aware it is always set to start from the top of the window/display and the width depends, but usually it is always centered as a whole to the window/screen.

hot nova
#

Because otherwise it inherits application surface stuff

analog pollen
shy garnet
#

personally i like to position things in the gui by doing stuff like 0.5*display_get_gui_width();

#

this will always position it at 50% of the gui, even if it ever changes size

analog pollen
#

Yeah, tho i have things that pop up from the sides, so it's a mess until i manage to get the right multiplier, but i think i found it, phew

#

Like, not fixed. It uses the screen and window sized.