mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
updated graph rendering to be more efficient. added smooth scrolling, added color type, mmb drag for cutting
This commit is contained in:
51
public/pico8-cart.p8
Normal file
51
public/pico8-cart.p8
Normal file
@@ -0,0 +1,51 @@
|
||||
pico-8 cartridge // http://www.pico-8.com
|
||||
version 41
|
||||
__lua__
|
||||
-- Generated with picoGraph
|
||||
|
||||
zzzz = ""
|
||||
offset = 0
|
||||
color = 5
|
||||
var1 = nil
|
||||
|
||||
function _update()
|
||||
-- sequence a
|
||||
cls()
|
||||
offset = 0
|
||||
-- sequence b
|
||||
if btn(0, 0) then
|
||||
print("left", 0, offset, rnd((16) + (1)))
|
||||
custom_addoffset()
|
||||
end
|
||||
-- sequence c
|
||||
if btn(1, 0) then
|
||||
print("right", 0, offset, color)
|
||||
local itsalocalvariable = true
|
||||
if itsalocalvariable then
|
||||
custom_addoffset()
|
||||
end
|
||||
end
|
||||
-- sequence d
|
||||
if btn(2, 0) then
|
||||
print("up", 0, offset, color)
|
||||
custom_addoffset()
|
||||
end
|
||||
-- sequence e
|
||||
if btn(3, 0) then
|
||||
print("down", 0, offset, color)
|
||||
custom_addoffset()
|
||||
end
|
||||
end
|
||||
|
||||
function custom_addoffset()
|
||||
offset = (offset) + (7)
|
||||
end
|
||||
__gfx__
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
3304
public/pico8-player.html
Normal file
3304
public/pico8-player.html
Normal file
File diff suppressed because it is too large
Load Diff
95
public/pico8-temp-player.html
Normal file
95
public/pico8-temp-player.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { background: #1a1a2e; display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; overflow: hidden; }
|
||||
#canvas { image-rendering: pixelated; image-rendering: crisp-edges; width: 512px !important; height: 512px !important; border: 8px solid #000; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="128" height="128"></canvas>
|
||||
<script>
|
||||
var pico8_state = [];
|
||||
var pico8_buttons = [0,0,0,0,0,0,0,0];
|
||||
var codo_command = 0;
|
||||
var _cartname = ['untitled.p8'];
|
||||
var codo_key_buffer = [];
|
||||
var p8_keyboard_state = 0;
|
||||
var pico8_mouse = [];
|
||||
var pico8_gamepads = { count: 0 };
|
||||
var pico8_gpio = new Array(128).fill(0);
|
||||
var p8_dropped_cart = null;
|
||||
var p8_dropped_cart_name = '';
|
||||
|
||||
var CART_B64 = 'cGljby04IGNhcnRyaWRnZSAvLyBodHRwOi8vd3d3LnBpY28tOC5jb20KdmVyc2lvbiA0MQpfX2x1YV9fCi0tIEdlbmVyYXRlZCB3aXRoIHBpY29HcmFwaAoKb2Zmc2V0ID0gMApjb2xvciA9IDUKCmZ1bmN0aW9uIF91cGRhdGUoKQogIC0tIHNlcXVlbmNlIGEKICBjbHMoKQogIG9mZnNldCA9IDAKICAtLSBzZXF1ZW5jZSBiCiAgaWYgYnRuKDAsIDApIHRoZW4KICAgIHByaW50KCJsZWZ0IiwgMCwgb2Zmc2V0LCBybmQoKDE2KSArICgxKSkpCiAgICBjdXN0b21fYW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DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAo=';
|
||||
|
||||
// Silence all XHR — PICO-8 makes BBS metadata calls that crash from file:// origin.
|
||||
(function() {
|
||||
function MockXHR() {
|
||||
this.onload = null; this.onerror = null; this.onreadystatechange = null;
|
||||
this.readyState = 0; this.status = 0; this.statusText = '';
|
||||
this.response = null; this.responseText = ''; this.responseType = '';
|
||||
}
|
||||
MockXHR.UNSENT=0; MockXHR.OPENED=1; MockXHR.HEADERS_RECEIVED=2; MockXHR.LOADING=3; MockXHR.DONE=4;
|
||||
MockXHR.prototype.open = function() { this.readyState = 1; };
|
||||
MockXHR.prototype.send = function() {
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
self.readyState = 4; self.status = 200; self.statusText = 'OK';
|
||||
self.response = self.responseType === 'arraybuffer' ? new ArrayBuffer(0) : '';
|
||||
self.responseText = '';
|
||||
if (typeof self.onload === 'function') self.onload({ target: self });
|
||||
if (typeof self.onreadystatechange === 'function') self.onreadystatechange();
|
||||
}, 0);
|
||||
};
|
||||
MockXHR.prototype.setRequestHeader = function() {};
|
||||
MockXHR.prototype.getResponseHeader = function() { return null; };
|
||||
MockXHR.prototype.getAllResponseHeaders = function() { return ''; };
|
||||
MockXHR.prototype.abort = function() {};
|
||||
MockXHR.prototype.addEventListener = function(e, fn) {
|
||||
if (e==='load') this.onload=fn;
|
||||
if (e==='error') this.onerror=fn;
|
||||
if (e==='readystatechange') this.onreadystatechange=fn;
|
||||
};
|
||||
MockXHR.prototype.removeEventListener = function() {};
|
||||
window.XMLHttpRequest = MockXHR;
|
||||
})();
|
||||
|
||||
var Module = {
|
||||
arguments: [],
|
||||
canvas: document.getElementById('canvas'),
|
||||
preRun: [function() {
|
||||
if (typeof IDBFS !== 'undefined' && typeof MEMFS !== 'undefined') {
|
||||
var orig = FS.mount.bind(FS);
|
||||
FS.mount = function(type, opts, mp) { return orig(type===IDBFS?MEMFS:type, opts, mp); };
|
||||
}
|
||||
FS.syncfs = function(populate, callback) {
|
||||
var cb = typeof callback==='function' ? callback : typeof populate==='function' ? populate : null;
|
||||
if (cb) setTimeout(function(){ cb(null); }, 0);
|
||||
};
|
||||
}],
|
||||
postRun: [function() {
|
||||
setTimeout(function() {
|
||||
p8_dropped_cart = 'data:application/octet-stream;base64,' + CART_B64;
|
||||
p8_dropped_cart_name = 'picograph.p8';
|
||||
codo_command = 9;
|
||||
|
||||
// After cart loads, inject "run" + Enter to execute it
|
||||
setTimeout(function() {
|
||||
// Push keystrokes: r u n Enter (lowercase ASCII)
|
||||
codo_key_buffer.push(114, 117, 110, 13);
|
||||
}, 300);
|
||||
}, 200);
|
||||
}],
|
||||
print: function(t) { console.log('P8:', t); },
|
||||
printErr: function(t) { console.error('P8:', t); },
|
||||
setStatus: function() {}
|
||||
};
|
||||
|
||||
function pico8_audio_context_suspended() { return false; }
|
||||
</script>
|
||||
<script src="./pico8_edu.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
25
public/pico8_edu.js
Normal file
25
public/pico8_edu.js
Normal file
File diff suppressed because one or more lines are too long
25
public/pico8_player.js
Normal file
25
public/pico8_player.js
Normal file
File diff suppressed because one or more lines are too long
55
public/player.html
Normal file
55
public/player.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PICO-8 Player</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
#canvas {
|
||||
image-rendering: pixelated;
|
||||
image-rendering: crisp-edges;
|
||||
background: #000;
|
||||
}
|
||||
#p8_container {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="p8_container">
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
// Cart will be injected here
|
||||
window.PICO8_CART_DATA = null;
|
||||
</script>
|
||||
<script src="pico8_player.js"></script>
|
||||
<script>
|
||||
Module = {
|
||||
arguments: ['-run'],
|
||||
canvas: document.getElementById('canvas'),
|
||||
preRun: [],
|
||||
postRun: []
|
||||
};
|
||||
|
||||
// Wait for cart data to be set
|
||||
if (window.PICO8_CART_DATA) {
|
||||
// Create virtual file system entry
|
||||
Module.preRun.push(function() {
|
||||
FS.createDataFile('/', 'cart.p8', window.PICO8_CART_DATA, true, true, true);
|
||||
});
|
||||
Module.arguments.push('/cart.p8');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user