Skip to content

Commit

Permalink
Splitting this up into libs next (also totally will really add unit t…
Browse files Browse the repository at this point in the history
…ests :p)
  • Loading branch information
kaliumxyz committed May 7, 2017
1 parent d20d0af commit d2531c2
Show file tree
Hide file tree
Showing 11 changed files with 1,499 additions and 136 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ $ cd asap
$ npm
```


## usage
Just run electron in the dir.
```
$ electron .
```

## Tests
```
$ npm test
```

## license
MIT © [Kalium](kalium.xyz)
File renamed without changes.
File renamed without changes
File renamed without changes.
10 changes: 5 additions & 5 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html>
<head>
<title>ASAP</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href='style.css' rel='stylesheet'>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0"/>
<link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet'>
<link href='assets/css/style.css' rel='stylesheet'>
<meta name='viewport' content='initial-scale=1, maximum-scale=1, user-scalable=0'/>
</head>
<body>
<main>
Expand All @@ -15,15 +15,15 @@ <h1>press space or tap the screen</h1>
<div class='terminal'>
<div class='terminal-ghost'></div>
<div class='options terminal-main'>
bounds? <span class="option active">y</span>/<span class='option'>n</span>
bounds? <span class='option active'>y</span>/<span class='option'>n</span>
gravity? <span class='option active'>[wiggly]</span>/<span class='option'>[wigglyInverse]</span>/<span class='option'>[regular]</span>
collisions? <span class='option'>[boring]</span>/<span class='option active'>[care]</span>

</div>
</div>
</div>

<canvas width="1000" height="1000">If you can read this, your browser does not support HTML5 canvas.</canvas>
<canvas width='1000' height='1000'>If you can read this, your browser does not support HTML5 canvas.</canvas>
</body>
<script src='load.js'></script>
</html>
25 changes: 18 additions & 7 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ keys[77] = mouseNext

/* TODO:
* - unit testing.
* + basic is implemented
* - something more fun, sync it up with a node server somehow?
* - multiple particle types:
* - default (atoms?)
Expand All @@ -26,6 +27,7 @@ keys[77] = mouseNext
* - AI in a particle engine? yes, go fuck yourself if you don't know about steering behaviour.
* - seriously go feel a wicked degree of shame mate.
* - mouse / pointer modes:
* - touchscreen.
* - create / emit.
* - gravitate.
* - contain.
Expand Down Expand Up @@ -56,8 +58,8 @@ function rand(i) {
return i * Math.random()
}

/* Anything relating to the mouse
*********************************/
/* Anything relating to the mouse events.
*****************************************/

const mouse = {
clone: {
Expand All @@ -72,7 +74,7 @@ const mouse = {
},
bow: ev => {
return _ => {
particleArr.push(particle(mouse.clone.clientX, mouse.clone.clientY))
//particleArr.push(particle(mouse.clone.clientX, mouse.clone.clientY))
}
},
// blackHole : ev => {
Expand Down Expand Up @@ -103,6 +105,7 @@ const mouse = {
action: '',
}


function mouseNext() {
let flag
for (let mode in mouse.modus) {
Expand All @@ -122,6 +125,7 @@ const scroll = ev => {
//scroller(ev.clientX,ev.clientY)
}

// This creates an... action emitter?
window.onmousedown = ev => actions.push(mouse.action(ev))

window.onmouseup = ev => actions.pop()
Expand All @@ -130,13 +134,20 @@ window.onmousemove = ev => mouse.clone = ev

window.onclick = ev => mouse.clone = ev

// Great way to create emittors but nothing more, lets swap to using a mouse object.
//window.onmousedown = ev => actions.push(mouse.emit(ev))
/* Anything related to touch events.
************************************/

// Touchscreen handles very different from a mouse, make seperate actions!
const touch = {}

window.ontouchstart = window.onmousedown

//window.onmouseup = ev => actions.pop()
window.ontouchend = window.onmouseup

//window.onmousewheel = scroll
window.ontouchmove = window.onmousemove

// When does this even fire?
window.ontouchcancel = window.ontouchend



Expand Down
81 changes: 0 additions & 81 deletions assets/style.css

This file was deleted.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
{
"name": "asap",
"description": "pewpewpew",
"version": "0.7.2",
"main": "index.js",
"author": "kalium",
"license": "MIT",
"dependencies": {
"electron": "^1.6.6",
"electron-packager": "^8.7.0"
"electron": "^1.6.6"
},
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.2.0",
"ava": "^0.19.1",
"node-sass": "^4.5.2",
"nodemon": "^1.11.0"
},
"scripts": {
"build-css": "node-sass --include-path sass assets\\sass\\style.sass assets\\css\\style.css",
"watch-css": "nodemon -e sass -x \"npm run build-css\"",
"sass": "node-sass -w -r ./ -o ./",
"test": "mocha",
"watch-css": "node-sass -w -r ./app/assets/sass -o ./app/assets/css",
"test": "ave",
"start": "electron ."
}
}
2 changes: 2 additions & 0 deletions run.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'run.vbs
CreateObject("Wscript.Shell").Run "electron .", 0, True
17 changes: 7 additions & 10 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
const fs = require('fs')
const chai = require('chai')
const assert = chai.assert
//const asap = require('../')
import test from 'ava'

// todo: add real unit tests
describe('true', function () {
it('equals true', function () {
assert.equal(true, true)
})
})
// Testing ava :3
test('The test that passes', t => {
t.pass()
})

test.todo('write unit tests :p')
Loading

0 comments on commit d2531c2

Please sign in to comment.