Responsive GameCanvas

Hi 🙂
I try to transform my game in HTML5 responsive version "fullscreen" but I've a problem...
When I try with this HTML :

Code:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="icon" href="icon/icon.png" type="image/png">
        <link rel="apple-touch-icon" href="icon/icon.png">
        <link rel="stylesheet" type="text/css" href="css/game.css">
        <title>My Game</title>
        <style>
html {
     height: -webkit-fill-available;
}
#gameCanvas {
height: 100vh !important;
width: auto !important;
margin: 0px auto !important;
}
body {
  padding: 0px;
  margin: 0px;
  height: 100vh !important;
}
</style>
    </head>
    <body style="background-color: black;">
        <script type="text/javascript" src="js/main.js"></script>


    </body>
</html>

it don't work, there is a gap (may be 100px ?) between touch layer and visual layer... do you have an idea ?
Hello welcome!

Canvas is controlled by RPG_CORE, even if you manipulate it by CSS the effect will be overlaid by code dynamically.

The correct thing is to activate Strech mode by F3 key or search for the Plugin that has already been posted to start in full screen as forced Strech mode
Hello welcome!

Canvas is controlled by RPG_CORE, even if you manipulate it by CSS the effect will be overlaid by code dynamically.

The correct thing is to activate Strech mode by F3 key or search for the Plugin that has already been posted to start in full screen as forced Strech mode
It don't work, I try to scale the canvas under the homme indicator like this :
Unknown-4.png

It work when I use height:100vh !important;
But it bug with a touch gap... It don't work with classic code, with stretch mode etc...
As I understand it, CSS doesn't resize the Canvas, it just enlarges the view, but the touch field remains the same.
I had already tried to do this in RMMV, what I understand you want is this:
(Attachment removed)

If so it is necessary to modify the StretchMode, I don't know how the RMMZ Stretch function will behave in portrait mode.
A basic plugin that forces StrechMode to be always on:
JavaScript:
/*REMOVED
Code updated at end of thread*/
You may need to disable the side scrollbar with CSS.

Sorry if my English sounds a little confusing, it's not my first language.
Good luck.
As I understand it, CSS doesn't resize the Canvas, it just enlarges the view, but the touch field remains the same.
I had already tried to do this in RMMV, what I understand you want is this:
View attachment 205909

If so it is necessary to modify the StretchMode, I don't know how the RMMZ Stretch function will behave in portrait mode.
A basic plugin that forces StrechMode to be always on:
JavaScript:
/*=========================================================
 * ForceStretchMode.js
 *=========================================================
 * @plugindesc Force StretchMode
 * @author RpgMakerWeb
 */
Graphics._defaultStretchMode=function(){
    return true;
}
You may need to disable the side scrollbar with CSS.

Sorry if my English sounds a little confusing, it's not my first language.
Good luck.
Thx… I’ve already tryed ! It don’t work :-/
I still don't get it, do you want the game to run in portrait or landscape mode?
I still don't get it, do you want the game to run in portrait or landscape mode?
Landscape mode… but no matter. I want to scalpe the Canvas height for 100% or thé screen height (under the home indicator)
Sorry, I did the test and due to the _stretchHeight function of RPG_Core the screen height check of the screen reads differently on mobile devices.

JavaScript:
/*=========================================================
 * ForceStretchMode.js
 *=========================================================
 * @plugindesc Force StretchMode
 * Compatible with Desktop and Mobile browsers.
 * @author RpgMakerWeb.com
 */

Graphics._stretchHeight = function() {
    const h = document.documentElement.clientHeight || window.innerHeight;
    return h;
};

Graphics._defaultStretchMode = function() {
    return true;
}

Restult: See attachments
Sorry, I did the test and due to the _stretchHeight function of RPG_Core the screen height check of the screen reads differently on mobile devices.

JavaScript:
/*=========================================================
 * ForceStretchMode.js
 *=========================================================
 * @plugindesc Force StretchMode
 * Compatible with Desktop and Mobile browsers.
 * @author RpgMakerWeb.com
 */

Graphics._stretchHeight = function() {
    const h = document.documentElement.clientHeight || window.innerHeight;
    return h;
};

Graphics._defaultStretchMode = function() {
    return true;
}

Restult: See attachments
Always the same :-(
4BE454BE-1378-46A7-8A2D-9F65608A7253.jpeg
It’s in a webview

Ambianum, please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/responsive-gamecanvas.141839/