Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

RenJS

HTML5 Visual Novel creation made easy and free · By lunafromthemoon

How to load a mobile version on mobile/tablet ?

A topic by Lapinay created Apr 12, 2019 Views: 271 Replies: 2
Viewing posts 1 to 3
(1 edit)

Hi. I found this code snippet that is supposed to detect Mobile/Desktop and make config files accordingly. Could you please tell me if this would  works with RenJS (i've added a RenJS config example):

var isMobile = navigator.userAgent.indexOf("Mobile");
if (isMobile == -1) {
    isMobile = navigator.userAgent.indexOf("Tablet");
}
if (isMobile == -1) {
   var globalConfig = {
  w:1000,
  h:659,
  mode: "AUTO",
  scaleMode: "NO_SCALE", //SHOW_ALL, EXACT_FIT, NO_SCALE    i18n: {
    langs: ["en","es"],
    path: "mobile/assets/gui/i18n/",
    format: ".png",
    w: 163,
    h: 83
  },
  splash: { //The "Loading" page for your game
    loadingScreen: "mobile/assets/gui/LANG/splash.png", //splash background
    loadingBar: {
      fullBar: "mobile/assets/gui/LANG/loadingbar.png",
      position: {x:111,y:462}
    }
  },
 
  logChoices: true,
  fonts: "mobile/assets/gui/fonts.css",
  guiConfig: "mobile/story/GUI.yaml",
  storySetup: "mobile/story/Setup.yaml",
  //as many story text files as you want
  storyText: [
        "mobile/story/LANG/YourStory.yaml"
    ],
}
} else {
    var globalConfig = {
  w:480,
  h:640,
  mode: "AUTO",
  scaleMode: "NO_SCALE", //SHOW_ALL, EXACT_FIT, NO_SCALE    i18n: {
    langs: ["en","es"],
    path: "desktop/assets/gui/i18n/",
    format: ".png",
    w: 163,
    h: 83
  },
  splash: { //The "Loading" page for your game
    loadingScreen: "desktop/assets/gui/LANG/splash.png", //splash background
    loadingBar: {
      fullBar: "desktop/assets/gui/LANG/loadingbar.png",
      position: {x:111,y:462}
    }
  },
 
  logChoices: true,
  fonts: "desktop/assets/gui/fonts.css",
  guiConfig: "desktop/story/GUI.yaml",
  storySetup: "desktop/story/Setup.yaml",
  //as many story text files as you want
  storyText: [
        "desktop/story/LANG/YourStory.yaml"
    ],
}
}
var game = new Phaser.Game(config);
Developer

Hello Alix, it looks Ok to choose a different config. In case you haven't read it, here's a link to the Mobile/Desktop documentation: https://lunafromthemoon.github.io/RenJS/mobileanddesktop/

In general, as it is made with Phaser, any procedure to make a Phaser game into mobile should work with RenJS too.

Thank you for the answer.  I'll take a look on the mobile App documentation. Have a nice day.