This is a documentation for Board Game Arena: play board games online !

ผลต่างระหว่างรุ่นของ "Your game mobile version"

จาก Board Game Arena
ไปยังการนำทาง ไปยังการค้นหา
ไม่มีความย่อการแก้ไข
 
(ไม่แสดง 6 รุ่นระหว่างกลางโดยผู้ใช้ 2 คน)
บรรทัดที่ 2: บรรทัดที่ 2:
Board Game Arena is now adaptated for Mobiles and Tablets too.
Board Game Arena is now adaptated for Mobiles and Tablets too.


This is very easy to have a mobile version of the game you developed with BGA Studio. In fact, your game is probably already 100% playable on mobile.
It is very easy to have a mobile version of the game you developed with BGA Studio. In fact, your game is probably already 100% playable on mobile.


However, to provide your players the best experience, you should follow the 2 advices below.
However, to provide your players the best experience, you should follow the 2 advices below.
บรรทัดที่ 23: บรรทัดที่ 23:
    
    
     // Minimum width
     // Minimum width
     //  default: 760
     //  default: 740
     //  maximum possible value: 760 (ie: your game interface should fit with a 760px width (correspond to a 1024px screen)
     //  maximum possible value: 740 (ie: your game interface should fit with a 740px width (correspond to a 1024px screen)
     //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
     //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
     'min' => 540,
     'min' => 540,
บรรทัดที่ 31: บรรทัดที่ 31:
     //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
     //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
     //  maximum possible value: unlimited
     //  maximum possible value: unlimited
     //  minimum possible value: 760
     //  minimum possible value: 740
     'max' => null
     'max' => null
   ),
   ),
บรรทัดที่ 42: บรรทัดที่ 42:
If you declare that your interface can run with a 540 pixels width, it must effectively run on an interface with 540 pixels width.
If you declare that your interface can run with a 540 pixels width, it must effectively run on an interface with 540 pixels width.


Note that it doesn't mean that your interface must ALWAYS be 540 pixels width : you just have to make your interface fluid and/or to use CSS media query to fit in any width.
Note that this doesn't mean that your interface must ALWAYS be 540 pixels width: you just have to make your interface fluid and/or to use CSS media query to fit in any width.


Examples :
Examples :


* On Can't Stop, when the screen is too wide, we move the dices on another position (below the main board) to fit in the width :
* On Can't Stop, when the screen is too narrow, we move the dices on another position (below the main board) to fit in the width :


   @media only screen and (max-width: 990px) {
   @media only screen and (max-width: 990px) {
บรรทัดที่ 60: บรรทัดที่ 60:
   }
   }


* On Seasons, we have some panels on the right of the boards. On small screen, we display these panels below :
* On Seasons, we have some panels on the right of the board. On small screens, we display these panels below the board:




บรรทัดที่ 74: บรรทัดที่ 74:
    
    
   }
   }
Tip: on mobile, BGA displays player panels at the top of the page (instead of displaying them on the right). When doing this, BGA applies the CSS class "mobile_version" to the root HTML element with id "ebd-body". If you want you can use this CSS "mobile_version" class to optimize some of your game adaptations to this change. In the opposite, when the "normal" version is active, the CSS class "desktop_version" BGA applies the CSS class "desktop_version" to the root HTML element with id "ebd-body".


== Touchscreen compatibility ==
== Touchscreen compatibility ==


Most of your game should work with touchscreen device.
Most of your games should work with touchscreen devices without needing any changes.


Note : When your game is running on a touchscreen device, the global CSS class "touch-device" is added to the root HTML element (and "notouch-device" is added in the contrary).
Note: when your game is running on a touchscreen device, the global CSS class "touch-device" is added to the to the root HTML element with id "ebd-body" (and "notouch-device" is added for the opposite).


What may not work :
What may not work :
* ":hover" CSS switch. Because there is no mouse, ":hover" won't be triggered. This is not an issue unless it is needed to play the game. In addition, some touch device considers that a short touch must trigger a ":hover" (and should apply corresponding CSS), which can block an interaction in your game. We advise you to explicitely disable ":hover" effects when your game is running on a touchscreen device.
* ":hover" CSS switch. Because there is no mouse, ":hover" won't be triggered. This is not an issue unless it is needed to play the game. In addition, some touch devices consider that a short touch must trigger a ":hover" (and should apply corresponding CSS), which can block an interaction in your game. We advise you to explicitely disable ":hover" effects when your game is running on a touchscreen device (for ex. by adding ".notouch-device" as a prefix to all your CSS :hover rules).
* Mouseover events : like the previous one : if you associated Javascript events to "onmouseover" event, it won't work on tablets.
* Mouseover events : like the previous one : if you associated Javascript events to "onmouseover" event, it won't work on tablets.
* Drag'n'drop : it won't work. To make it work, you should listen to "ontouchstart", "ontouchmove" and "ontouchend" event and trigger the same logic you already have for "onmousedown", "onmousemove" and "onmouseup". You should also make sure to stop the Javascript "ontouchmove" event (ex: dojo.stopEvent( evt ) ) during the drag n drop, otherwise the interface is going to scroll while drag'n'droping.
* Drag'n'drop : it won't work. To make it work, you should listen to "ontouchstart", "ontouchmove" and "ontouchend" event and trigger the same logic you already have for "onmousedown", "onmousemove" and "onmouseup". You should also make sure to stop the Javascript "ontouchmove" event (ex: dojo.stopEvent( evt ) ) during the drag n drop, otherwise the interface is going to scroll while drag'n'dropping.

รุ่นแก้ไขปัจจุบันเมื่อ 09:12, 29 ธันวาคม 2558

Board Game Arena is now adaptated for Mobiles and Tablets too.

It is very easy to have a mobile version of the game you developed with BGA Studio. In fact, your game is probably already 100% playable on mobile.

However, to provide your players the best experience, you should follow the 2 advices below.


Declare your interface minimum width

By default, your game can run in an window up to 740 pixels width. Considering the informations of the right column (player's panel), it fits on a 1024px wide screen.

However, you can choose to declare that your game is able to run with a smaller width. This way, the game will appear much better on mobile and tablets.

For example, Reversi board is only 540px wide. If we stay with the default width (740px), the game interface displayed on mobile will be too large and some space will be lost on the left and on the right. Consequently the Reversi board is going to appear very small on the mobile screen, and players will have to "pinch & zoom" to display it correctly.

To avoid that, we can specify that the game can be played with an interface with a minimum width of 540 pixels, by adding the following to gameinfos.inc.php :


 // Game interface width range (pixels)
 // Note: game interface = space on the left side, without the column on the right
 'game_interface_width' => array(
 
   // Minimum width
   //  default: 740
   //  maximum possible value: 740 (ie: your game interface should fit with a 740px width (correspond to a 1024px screen)
   //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
   'min' => 540,
 
   // Maximum width
   //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
   //  maximum possible value: unlimited
   //  minimum possible value: 740
   'max' => null
 ),


And that's it! Now, BGA can choose the better display for your game interface, whatever the device.

Important

If you declare that your interface can run with a 540 pixels width, it must effectively run on an interface with 540 pixels width.

Note that this doesn't mean that your interface must ALWAYS be 540 pixels width: you just have to make your interface fluid and/or to use CSS media query to fit in any width.

Examples :

  • On Can't Stop, when the screen is too narrow, we move the dices on another position (below the main board) to fit in the width :
 @media only screen and (max-width: 990px) {
 
   #dicechoices {
       left: 180px;
       top: 530px;
   }
   #cantstop_wrap {
       height: 900px;
       width: 550px;
   }
 }
  • On Seasons, we have some panels on the right of the board. On small screens, we display these panels below the board:


 @media only screen and (max-width: 970px) {
 
   #board {
       float: none;
       margin: auto;
   }
   .seasons_rightpanel {
       margin-left: 0px;
   }
 
 }


Tip: on mobile, BGA displays player panels at the top of the page (instead of displaying them on the right). When doing this, BGA applies the CSS class "mobile_version" to the root HTML element with id "ebd-body". If you want you can use this CSS "mobile_version" class to optimize some of your game adaptations to this change. In the opposite, when the "normal" version is active, the CSS class "desktop_version" BGA applies the CSS class "desktop_version" to the root HTML element with id "ebd-body".

Touchscreen compatibility

Most of your games should work with touchscreen devices without needing any changes.

Note: when your game is running on a touchscreen device, the global CSS class "touch-device" is added to the to the root HTML element with id "ebd-body" (and "notouch-device" is added for the opposite).

What may not work :

  • ":hover" CSS switch. Because there is no mouse, ":hover" won't be triggered. This is not an issue unless it is needed to play the game. In addition, some touch devices consider that a short touch must trigger a ":hover" (and should apply corresponding CSS), which can block an interaction in your game. We advise you to explicitely disable ":hover" effects when your game is running on a touchscreen device (for ex. by adding ".notouch-device" as a prefix to all your CSS :hover rules).
  • Mouseover events : like the previous one : if you associated Javascript events to "onmouseover" event, it won't work on tablets.
  • Drag'n'drop : it won't work. To make it work, you should listen to "ontouchstart", "ontouchmove" and "ontouchend" event and trigger the same logic you already have for "onmousedown", "onmousemove" and "onmouseup". You should also make sure to stop the Javascript "ontouchmove" event (ex: dojo.stopEvent( evt ) ) during the drag n drop, otherwise the interface is going to scroll while drag'n'dropping.