Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

sinix-dev/sinix.js

Repository files navigation

Sinix

Build games for Sinix with Joystick support

Installation and Setup

$ npm install sinix --save

Add script in package.json

"scripts": {
  "sinix": "sinix",
}

Initialize a Sinix project

$ npm run sinix init

This will create sinix.config.js in the current directory. By default, sinix packages the content of dist/ directory, update the distDir value in sinix.config.js as per your project.

Communication Interface

You can use remote to listen for events happening on Joysticks

import { remote } from "sinix"

remote.listen("STICK1", (payload) => {
  console.log(payload)
  
  /*
  {
    "user": "nickname",
    "x": 35.09090909090909,
    "y": -48.36363636363637}
  }
  */
})

remote.listen("BUTTON", (payload) => {
  console.log(payload) // { "user": "nickname", "val": "A" }
  
  if(payload.val === "A"){
    // do something
  } else if(payload.val === "B"){
    // do something
  }
})

Build and Publish

Generates app.dext file in release folder, which you can open in Sinix or publish on Sinix.

$ npm run sinix build

It is also possible to publish directly from the command-line using following command.

$ npm run sinix publish

will prompt for token and password which can be retrieved from the account created on sinix.dev. The application will go live in under 24 hours on Sinix Store.