Well now, what could that be for?

This commit is contained in:
Devine Lu Linvega 2019-01-12 15:02:29 +12:00
parent b904bb1e52
commit 4b9a6eb801
4 changed files with 30 additions and 1 deletions

View File

@ -17,6 +17,7 @@
<script type="text/javascript" src="scripts/tool.js"></script> <script type="text/javascript" src="scripts/tool.js"></script>
<script type="text/javascript" src="scripts/generator.js"></script> <script type="text/javascript" src="scripts/generator.js"></script>
<script type="text/javascript" src="scripts/picker.js"></script> <script type="text/javascript" src="scripts/picker.js"></script>
<script type="text/javascript" src="scripts/listener.js"></script>
<!-- Styles --> <!-- Styles -->
<link rel="stylesheet" type="text/css" href="links/reset.css"/> <link rel="stylesheet" type="text/css" href="links/reset.css"/>
<link rel="stylesheet" type="text/css" href="links/fonts.css"/> <link rel="stylesheet" type="text/css" href="links/fonts.css"/>

View File

@ -24,6 +24,7 @@ function Dotgrid (width, height) {
this.interface = new Interface(this) this.interface = new Interface(this)
this.picker = new Picker(this) this.picker = new Picker(this)
this.cursor = new Cursor(this) this.cursor = new Cursor(this)
this.listener = new Listener(this)
host.appendChild(this.renderer.el) host.appendChild(this.renderer.el)

View File

@ -0,0 +1,27 @@
'use strict'
const dgram = require('dgram')
function Listener (dotgrid) {
this.server = dgram.createSocket('udp4')
this.start = function () {
}
this.server.on('error', (err) => {
console.log(`server error:\n${err.stack}`)
server.close()
})
this.server.on('message', (msg, rinfo) => {
console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`)
})
this.server.on('listening', () => {
const address = this.server.address()
console.log(`server listening ${address.address}:${address.port}`)
})
this.server.bind(49160)
}

View File

@ -355,7 +355,7 @@ function Tool (dotgrid) {
this.selectLayer = function (id) { this.selectLayer = function (id) {
this.index = clamp(id, 0, 2) this.index = clamp(id, 0, 2)
if (this.index !== 0) { this.settings.crest = false } if (this.index !== 0) { this.settings.crest = false }
this.clear() this.clear()