A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/melonjs/melonJS/tree/legacy below:

GitHub - melonjs/melonJS at legacy

A fresh & lightweight HTML5 game engine

Copyright (C) 2011 - 2021 Olivier Biot

melonJS is licensed under the MIT License

melonJS is the result of our enthusiasm & experiments with Javascript, and currently features :

Basic Example

import * as me from "melonjs.module.js";

me.device.onReady(function () {
    // initialize the display canvas once the device/browser is ready
    if (!me.video.init(1218, 562, {parent : "screen", scale : "auto"})) {
        alert("Your browser does not support HTML5 canvas.");
        return;
    }

    // add a gray background to the default Stage
    me.game.world.addChild(new me.ColorLayer("background", "#202020"));

    // add a font text display object
    me.game.world.addChild(new me.Text(609, 281, {
        font: "Arial",
        size: 160,
        fillStyle: "#FFFFFF",
        textBaseline : "middle",
        textAlign : "center",
        text : "Hello World !"
    }));
});

Simple hello world using melonJS 9.x or higher

Documentation :

For your first time using melonJS, follow these tutorials :

You may find it useful to skim the overview found at the wiki Details & Usage

When starting your own projects, checkout the boilerplate

The latest builds with corresponding release note are available for direct download here.

Since version 9.0.0 melonJS provides different build options :

build description melonjs.js a legacy ES5 UMD Bundle (directly transpiled from the ES6 version) including full API backward compatibility with previous versions melonjs.min.js a minified version of the ES5 UMD bundle version melonjs.module.js a ES6 Module Bundle, for those living on the edge, and with no backward compatibility (note: this will break your game when upgrading!)

Note: current version of both the tutorials and the debugPanel are not compatible with the ES6 version.

Alternatively, the latest version of melonJS can be installed through NPM :

If you need to import the ES6 module of melonjs (for Webpack):

$ import * as me from 'melonjs/dist/melonjs.module.js';

Note: when using the es6 module, deprecated methods need to be manually applied, see here

Or can simply be added to your html, through a content delivery network (CDN) URL, using for example :

<!-- load the ES5 UMD bundle of melonJS v9.0.0 -->
<script src="https://cdn.jsdelivr.net/npm/melonjs@9.0.0/dist/melonjs.js"></script>
<!-- load the ES6 module bundle of melonJS v9.0.0 -->
<script src="https://cdn.jsdelivr.net/npm/melonjs@9.0.0/dist/melonjs.module.js"></script>
<!-- omit the version completely to get the latest one -->
<!-- you should NOT use this in production -->
<script src="https://cdn.jsdelivr.net/npm/melonjs/dist/melonjs.js"></script>
<!-- add ".min" to any JS/CSS file to get a minified version -->
<script src="https://cdn.jsdelivr.net/npm/melonjs@8.0.1/dist/melonjs.min.js"></script>

and of course the debug panel :

<!-- load the latest debug panel -->
<script src="https://cdn.jsdelivr.net/npm/melonjs/plugins/debug/debugPanel.js"></script>
<!-- or a specific corresponding release -->
<script src="https://cdn.jsdelivr.net/npm/melonjs@8.0.1/plugins/debug/debugPanel.js"></script>

Note: "official" CDN and NPM install are only available from version 7.0.0 and onwards. Note: ES6 version of melonJS is available from version 9.0.0 and onwards.

For most users, all you probably want is to use melonJS, and all you need then is just to download the latest built release to get started. The only time you should need to build melonJS is if you want to contribute to the project and start developing on it.

To build your own version of melonJS you will need to install :

Once Node.js and NPM have been installed, you need to install build dependencies, by executing the following in the folder where you cloned the repository :

Then build the melonJS source by running:

The generated library will be available under the build directory :

To run the melonJS test suite simply use the following:

This will run the jasmine spec tests with the output displayed on the shell. Do note that the latest Chrome version is required, as the test unit will run the Browser in a headless mode (in case of failed tests, upgrade your browser).

Building the documentation

Similarly, you can build your own copy of the docs locally by running :

The generated documentation will be available in the docs directory

melonJS uses Travis-CI for automated testing and build uploads. The latest build artifacts can be downloaded from the melonjs-builds bucket.

If you need technical support, you can contact us through the following channels :

For any other non technical related questions, feel free to also send us an email.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4