ID:1420081
 
I was wondering about how would I be able to use full-screen.

At first I thought I'll adjust the window size to Full HD resolution, disable the tilebar and disable resizability and movability of the window. It would work well if everyone the same resolution, however for the others the screen would be cut-off and mouse actions would be shifted.

I guess it wouldn't be nice to ignore these players and I'm still not sure if this is the how maximized windows work.

So the question is:
How could one program fullscreen/maximized window?

EDIT: So I tried doing maximized window the way described above but the map and the sides of the screen didn't match. There is also empty space in the position of interface menus so it's not usable at all.
What I would do is pretty much what you mentioned.

  • disable the window border
  • disable resize
  • set map control to stretch the map, not fixed icon
  • use winset() to set the window's is-maximized to true
In response to Makeii
Wouldn't this leave a lot of black space on his map though? Width wise, at least. It always seems to on mine in the tests I did.

You could add two more steps, one for acquiring the resolution and/or size, and one for altering the client view of course, but that may or may not be suitable for the type of game he is creating. That's pretty unacceptable in PvP games, for example. At least as far as I know, anyway.
Yes, acquiring resolution would be fine, however, I don't think I could do this here, in BYOND. But that's the least, you can always manually adjust it.

Toddab503 wrote:
Wouldn't this leave a lot of black space on his map though?

Do you mean 'black space' behind the view/sight? If so I will be able handle this on my own ;)
client
var
tmp
get_screen = {"<html><head></head><body><script type="text/javascript">window.location="?Action=ScreenResolution&Width="+screen.width+"&Height="+screen.height</script></body></html>"}
sx=32//change the window name above this line as well to your window's name
sy=22//sx and sy by default are my view x and y
screen_resolution = ""
full_screen = 0

Topic(Href, HrefList[])
if(HrefList["Action"] == "ScreenResolution")
usr.client.sx = text2num(HrefList["Width"])
usr.client.sy = text2num(HrefList["Height"])
if(usr.client.full_screen)
usr.client.screen_resolution = "[sx]x[sy]"
else
usr.client.screen_resolution = "1204x704"//change to whatever you please
..()

proc
screen_res()
src << browse(get_screen, "window=MainWindow&titlebar=0&can_resize=0&can_minimize=0")//change window name to whatever your window's name is
while(!screen_resolution) sleep(1)
src << browse(null, "window=MainWindow")

fullscreen()
if(src.full_screen)
winset(src,"MainWindow","pos=0,0;is-maximized=true;size=[screen_resolution]")
winset(src,"MainWindow.MapMain","pos=0,0;size=[screen_resolution]")
src << output("<font color=#3078A1>Your screen resolution is [sx]x[sy]","worldchatoutput")//if you want it to display the resolution to an output.
else
winset(src,"MainWindow","pos=[text2num(sx/8)],[text2num(sy/9)];is-maximized=false;size=1034x760")//set window back to your default
winset(src,"MainWindow.MapMain","pos=5,46;size=1024x704")//set your map back to where it was and whatever size
return


This is what I wrote to get the game to check a player's screen resolution and it works very well. Depending on the screen resolution and your view size there will be black edges but you can take those off by disabling letterboxing. That will cut off a little bit of the view though but it's up to you how you want it. The black spaces don't look that bad to me.
In response to Toddab503
The effective resolution is the size of the map control after it's been maximized/resized, found with winget().

The black space (you can change the color, by the way) comes from letterboxing, which is a toggleable map parameter, letterbox, as well as opacity (which can also be changed with a low-layer screen object but defaults to the map's background color).
In response to Kaiochao
Huh, that's really interesting. I'm surprised I haven't noticed anything about that on the forums sooner than this.

I wonder, then, though. Would that be a more suitable alternative for games that should not adjust the view size? or is it best to just stick with a fixed size design with no full screen mode available?

I'm mostly just curious myself, since I often struggle with that decision on projects, but I think it would be useful for the OP to know too.
In response to MDC
I didn't want to bother much with interface and I prefer maximized windows so this helped me a lot. It's great and works really well, thanks!
In response to Balborg
You're very welcome! :)
So here's the simple copy-paste code for forced full-screen:

client
New()
..()
spawn()
winset(src,"default","pos=0,0;is-maximized=true")
winset(src,"default.MapMain","pos=0,0")


I recommend to use MDC's for its integrity but this I conclude to be the simplest way to make maximized window.