Code Monkey home page Code Monkey logo

monogame.js's Introduction

MonoGame.Js

JavaScript game libary that is based on the XNA/MonoGame API

The only "dependancies" on modern browsers the API takes is the HTML canvas object, addEventListener function, and if you want to use Songs and sound effects a dependancy on the audio tag too. Otherwise the code is valid ECMAScript 3 code and should work if those two are pollyfilled.

Clown.html contains both a game that is both an example of how to use MonoGame.Js and is used as a basic test to make sure it works correctly.

There are places where the API is different in more than just ECMAScript ways (so besides making methods start with lowercase letters):

  • To create a Game class to put your own methods on you use the Game.createGame(cstr) function which sets up an object for you that you can set the prototype of to add instance functions to but inherits from the Game class. The function you pass in will be called as the constructor and can use this as though it is a constructor.
  • The initialize, loadContent, contentLoaded, update, draw, unloadContent, and exit methods are expected to be "replaced" in your game. To call the Game objects base version call base_[function name], for example base_initialize for Game's initialize method.
  • Because textures are loaded asynchronously you just load content in loadContent and then in contentLoaded do any logic based on that content.
  • There is no TimeSpan object, instead just plain milliseconds are used. So for example you instead of gameTime.elapsedGameTime it's gameTime.elapsedGameMilliseconds.
  • Remember that Point, Vector2, and Matrix are all copy by ref not copy by value.
  • loadSong and loadSoundEffect both can take an array of urls to allow for mutiple encoding formats to help with cross-browser development.

monogame.js's People

Contributors

shmuelie avatar

Watchers

James Cloos avatar Gabriel Barbier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.