Skip to content
Snippets Groups Projects
Commit 92150f3f authored by Louis Capitanchik's avatar Louis Capitanchik
Browse files

Interface and usability tweaks, now supports 4/4/2 game setups

parent 535a3f9a
No related branches found
No related tags found
No related merge requests found
"use strict";
var exec = require("child_process").exec,
level = require("levelup"),
http = require("combi-server")({
......@@ -9,12 +10,17 @@ var exec = require("child_process").exec,
lib: true
}
}),
Form = require("formidable"),
q = require("q"),
reroute = require("./local_modules/reroute"),
path = require("path"),
x = require("./local_modules/xbridge"),
Route = require("combi-server-router"),
ni = require("os").networkInterfaces()["eth0"].reduce(function(p, c){if(c.family == "IPv4"){return c;}else{return p;}}, null);
router = new Route.Router(),
ni = require("os").networkInterfaces();
const conf = require("./conf");
console.dir(ni);
......@@ -22,9 +28,31 @@ reroute.add("/", "/index.html");
reroute.add("/log", "/chat.html");
http.use(reroute.middleware);
http.use((req, res, next) => {
let def = q.defer();
if(req.method.toLowerCase() == "post") {
let form = new Form.IncomingForm();
form.parse(req, (err, fields, files) => {
if(err) {
def.reject(err);
}
req.body = fields;
def.resolve(next());
});
} else {
def.resolve(next());
}
return def.promise;
});
http.static(path.join(__dirname, "public"));
// router.post("/token", (req, res) => {
//
// });
http.use(Route.middleware(router));
http.ws.do("input:json", function(conn, data) {
x.do(data.key)
.then(function(e) {
......@@ -46,4 +74,6 @@ http.ws.do("input:json", function(conn, data) {
});
})
http.listen();
{
"username": "Commander-lol",
"password": "PlayfulFox"
}
......@@ -20,6 +20,8 @@ var errmap = {
down: "Down",
a: "x",
b: "z",
y: "a",
x: "s",
r: "w",
l: "q",
select: "Shift_R",
......
......@@ -6,6 +6,8 @@
"main": "app.js",
"dependencies": {
"combi-server": "^1.3.2",
"combi-server-router": "^1.0.1",
"formidable": "^1.0.17",
"leveldown": "^1.4.3",
"levelup": "^1.3.1",
"node-ip": "^0.1.2",
......
......@@ -24,7 +24,7 @@
opacity: 0;
transition: opacity 0.1s linear;
}
.hitbox:hover {
.hitbox:active {
opacity: 0.3;
}
......@@ -47,14 +47,11 @@
#b .box {
fill: #f0ba24;
}
.hitbox {
fill: black;
opacity: 0;
transition: opacity 0.1s linear;
#y .box {
fill: #11ff33;
}
.hitbox:hover {
opacity: 0.3;
#x .box {
fill: #1133ff;
}
svg {
position: absolute;
......@@ -66,8 +63,8 @@
</style>
</head>
<body>
<svg viewbox="0, 0, 500, 350">
<g class="group arrows" transform="translate(10,0)">
<svg viewbox="0, 0, 700, 350">
<g class="group arrows" transform="translate(110,0)">
<g class="button" id="left" transform="translate(0,60)">
<path class="box" d="M 50,0 L 0,50 L 50,100 L 100,50 Z" />
<path class="arrow" d="M 50,10 L 60,20 L 30,50 L 60,80 L 50,90 L 10,50 Z" />
......@@ -93,21 +90,46 @@
</g>
</g>
<g class="group letters" transform="translate(260,0)">
<g class="button" id="a" transform="translate(60,120)">
<g class="group shoulders" transform="translate(100, 0)">
<g class="button" id="l" transform="translate(-100,0)">
<rect class="box" x="1" y="30" width="98" height="40" rx="15" ry="15"/>
<text x="50" y="50" dy="7">L</text>
<rect class="hitbox" x="1" y="30" width="98" height="40" rx="15" ry="15"/>
</g>
<g class="button" id="r" transform="translate(500,0)">
<rect class="box" x="1" y="30" width="98" height="40" rx="15" ry="15"/>
<text x="50" y="50" dy="7">R</text>
<rect class="hitbox" x="1" y="30" width="98" height="40" rx="15" ry="15"/>
</g>
</g>
<g class="group letters" transform="translate(360,0)">
<g class="button" id="a" transform="translate(120,60)">
<circle class="box" r="35" cx="50" cy="50"/>
<text x="50" y="50" dy="7">A</text>
<circle class="hitbox" r="35" cx="50" cy="50"/>
</g>
<g class="button" id="b" transform="translate(120,60)">
<g class="button" id="b" transform="translate(60,120)">
<circle class="box" r="35" cx="50" cy="50"/>
<text x="50" y="50" dy="7">B</text>
<circle class="hitbox" r="35" cx="50" cy="50"/>
</g>
<g class="button" id="y" transform="translate(0,60)">
<circle class="box" r="35" cx="50" cy="50"/>
<text x="50" y="50" dy="7">Y</text>
<circle class="hitbox" r="35" cx="50" cy="50"/>
</g>
<g class="button" id="x" transform="translate(60,0)">
<circle class="box" r="35" cx="50" cy="50"/>
<text x="50" y="50" dy="7">X</text>
<circle class="hitbox" r="35" cx="50" cy="50"/>
</g>
</g>
<g class="group commands" transform="translate(135,250)">
<g class="group commands" transform="translate(235,250)">
<g class="button" id="select" transform="translate(0,0)">
<rect class="box" x="1" y="30" width="98" height="40" rx="25" ry="25"/>
<text x="50" y="50" dy="7">SELECT</text>
......@@ -127,6 +149,10 @@
keys = [
"a",
"b",
"y",
"x",
"l",
"r",
"left",
"right",
"up",
......
#!/bin/bash
WID=`xdotool search --name RetroArch`
VALID="_z__x__q__w__Left__Right__Up__Down__Shift_R__Return_"
VALID="_z__x__q__w__s__a__Left__Right__Up__Down__Shift_R__Return_"
if [[ $WID == "" ]]
then
echo 1
......@@ -11,6 +11,8 @@ else
xdotool windowactivate $WID
xdotool windowfocus $WID
xdotool keydown $1
sleep 0.25 # Platformers
#sleep 0.01 # Tetris
xdotool keyup $1
echo 0
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment