Page 1 of 1

Resolution in view.php

Posted: 07 March 2024, 08:56
by AxeCrazy
Hi guys,
With my first game in alpha i get questions on why the board is only 740 px wide.
I did this to make it fit nicely in a mobile device to, but just wondering.
When i make special css rules for mobile i could upscale the board on desktop, but since i positiion several game elements absolute within the main board i need to know the resolution of the client playing the game, so i can apply a multiplier for this absolute positioning.

Is there a way to get this info within the view.php file?

Re: Resolution in view.php

Posted: 07 March 2024, 09:43
by firgon
I think it's a config in gameinfos.inc.php (you can change it but i guess 740 is default value)

so i guess $gameinfos in an array you can get in your view (but don't know exactly how)

Re: Resolution in view.php

Posted: 07 March 2024, 11:50
by RicardoRix
If this helps. You can hook into the onScreenWidthChange change event, simply by defining a function.
https://en.doc.boardgamearena.com/index ... arch&go=Go

I also manually call the function in setup just to be sure.

Code: Select all

	onScreenWidthChange: function()
	{					
		var offsetWidth = $('game_play_area').offsetWidth;
I had a feeling that 740 is fixed no matter what, but I could be wrong. But at least it's at this point that the player panels move to the top.