1.0.30 • Published 8 months ago

@game8.io/plugin v1.0.30

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

npm GitHub version license

Game8.io HTML5 Plugin

This is the documentation of the "Game8.io HTML5 Plugin" project.

Game8.io is the biggest collections of high quality, cross-platform games. We provide great games for your website within minutes!

Running into any issues? Check out the F.A.Q. within the Wiki of the github repository before mailing to support@game8.io

Implementation

Implement the following snippet within your game or within the <head> section of your index.html.

<!-- Pogame Plugin -->
<link rel="stylesheet" href="https://unpkg.com/@game8.io/plugin/dist/g8plugin.css">
<script type="text/javascript" src="https://unpkg.com/@game8.io/plugin/dist/g8plugin.js"></script>

Usage

Create container where the game screen will be rendered.

<!-- Container -->
<div id="game-screen" style="background: rgba(0, 0, 0, 0.5);height:600px;"></div>

Render game screen with window.g8plugin.init method.

<script>
    window.g8plugin.init({
        container: 'game-screen',
        gameId: 'df0a60ffc1e344adb308b5e9a8a0bd04',
        preload: true,
    });
</script>
  • This plugin provides a range of flexible options to help you fine-tune your experience during usage. npm.io

  • When you start the game, if your device is not oriented correctly, a warning will appear on your screen. This is a gentle reminder to keep your device in a fixed position for the best gaming experience possible

Options:

window.g8plugin.init({
    // The container where the game screen will be rendered
    container: "game-screen",

    // you need to provide either gameId or gameUrl
    // if no `gameData` is used, the game won't be able to fetch from the server, so you don't need to provide gameId, you can provide gameUrl directly
    gameId: "df0a60ffc1e344adb308b5e9a8a0bd04",
    // gameUrl: "https://h5.ga8.io/df0a60ffc1e344adb308b5e9a8a0bd04/",

    environment: "production", // can be 'development' or 'production'
    preload: true, // will be 'preload' or 'direct'

    //can be 'portrait' or 'landscape' or a function that returns either 'portrait' or 'landscape'
    orientation: (gameData) => { return gameData.orientation },
    gameControls: {
        // can be a string that represents the game title or a function that returns the game title
        gameTitle: (gameData) => { return gameData.title },
        // can be a string that represents the game thumb or a function that returns the game thumb
        gameThumb: (gameData) => { return gameData.thumb },
        // You can provide a custom full screen button icon or hide the full screen button by setting fullScreenButton=false
        fullScreenButton: {
            icon: "https://static.ga8.io/plugins/g8plugin/images/full-screen.svg"
        },
        // Determines the visibility of the game controls.
        // You can set the visibility for mobile, mobile_fullscreen, pc, pc_fullscreen or visibility=false to hide the game controls
        visibility: {
            mobile: true,
            mobile_fullscreen: false,
            pc: true,
            pc_fullscreen: true,
        }
    },
    //Button will float on mobile devices on fullscreen mode and will be hidden on PC as default
    floatingButton: {
        // Determines the visibility of the floating button.
        // You can set the visibility for mobile, mobile_fullscreen, pc, pc_fullscreen or visibility=false to hide the floating button
        visibility: {
            mobile: false,
            mobile_fullscreen: true,
            pc: false,
            pc_fullscreen: false,
        },
        // Default position of the floating button, default is bottom right corner
        defaultPosition: {
            right: "0px",
            bottom: "0px"
        }
    },
})
1.0.33

8 months ago

1.0.32

8 months ago

1.0.35

8 months ago

1.0.34

8 months ago

1.0.22-dev

8 months ago

1.0.26-dev

8 months ago

1.0.25-dev

8 months ago

1.0.24-dev

8 months ago

1.0.23-dev

8 months ago

1.0.31

8 months ago

1.0.18-dev

8 months ago

1.0.21-dev

8 months ago

1.0.20-dev

8 months ago

1.0.33-dev

8 months ago

1.0.32-dev

8 months ago

1.0.19-dev

8 months ago

1.0.29

8 months ago

1.0.30

8 months ago

1.0.26

8 months ago

1.0.25

8 months ago

1.0.28

8 months ago

1.0.27

8 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.22

9 months ago

1.0.21

9 months ago

1.0.20

9 months ago

1.0.17-dev

9 months ago

1.0.24

8 months ago

1.0.23

8 months ago

1.0.16

10 months ago

1.0.15

10 months ago

1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

11 months ago

1.0.1

11 months ago