jesstelford [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=46556
Picotron's missing man pages
<p>
<table><tr><td>
<a href="/bbs/?pid=143718#p">
<img src="/bbs/thumbs/pico64_man-0.png" style="height:256px"></a>
</td><td width=10></td><td valign=top>
<a href="/bbs/?pid=143718#p">
man</a><br><br>
by <a href="/bbs/?uid=46556">
jesstelford</a>
<br><br><br>
<a href="/bbs/?pid=143718#p">
[Click to Play]</a>
</td></tr></table>
</p>
<h1>Documentation at your fingertips!</h1>
<p>This cart installs the <code>man</code> terminal utility for reading documentation within picotron itself.</p>
<p>Something not documented? <code>man</code> will intelligently search the <a href="https://pico-8.fandom.com/">Fandom Wiki</a>! 😱</p>
<img style="margin-bottom:16px" border=0 src="/media/46556/picotron-man-pages.gif" alt="" />
<h2>Installation</h2>
<ol>
<li>
<p>Setup <a href="https://www.lexaloffle.com/bbs/?pid=143592">yotta</a>:</p>
<ul>
<li>In the terminal</li>
<li><code>load #yotta</code></li>
<li>Press Ctrl-r</li>
<li>Press x to install</li>
</ul>
</li>
<li>Install this package:
<ul>
<li>In the terminal</li>
<li><code>yotta util install #man</code></li>
</ul></li>
</ol>
<p>This will install the following files for you:</p>
<div>
<div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px">
<table style="width:100%" cellspacing=0 cellpadding=0>
<tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
<td background=/gfx/code_bg0.png>
<div style="font-family : courier; color: #000000; display:absolute; padding-left:10px;
padding-top:4px; padding-bottom:4px;
">
<pre>appdata
└── system
├── lib
│ └── man.lua # The `man()` function for library usage
├── man/ # Man files live here
└── util
└── man.lua # The `man` terminal utility</pre></div></td>
<td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
</tr></table></div></div>
<h2>Usage</h2>
<p>In the Picotron terminal, run <code>man</code>.</p>
<div>
<div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px">
<table style="width:100%" cellspacing=0 cellpadding=0>
<tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
<td background=/gfx/code_bg0.png>
<div style="font-family : courier; color: #000000; display:absolute; padding-left:10px;
padding-top:4px; padding-bottom:4px;
">
<pre>NAME
man -- format and display the manual pages
SYNOPSIS
man [section] name
DESCRIPTION
man formats and displays the manual pages. If you specify section, man only looks in that section of the manual. name is normally the name of the manual page, which is typically the name of a command, function, or file.
See below for a description of where man looks for the manual page files.
MANUAL SECTIONS
The standard sections of the manual include:
1 User Commands from /appdata/system/util
2 System Calls such as fetch
3 Picotron Lua Library Functions
wiki Wiki pages from https://pico-8.fandom.com
P8SCII FORMATTING
man understands most of p8scii formatting. The \a command to play audio is not supported.
SEARCH PATH FOR MANUAL PAGES
man searches /appdata/system/man for local manual pages in the format <name>.<section>.
WIKI PAGES
When section is 'wiki', or local manual pages are not found, man will return the first search result from the unofficial PICO-8 wiki: https://pico-8.fandom.com
AUTHOR
Created by Jess Telford <[email protected]></pre></div></td>
<td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
</tr></table></div></div>
<h2>Contributing</h2>
<p>The code <a href="https://github.com/jesstelford/picotron-man">is on GitHub</a>, and I'd love help documenting more of the picotron system so everyone can benefit!</p>
<p>Please open PRs and issues with suggestions ❤️</p>
https://www.lexaloffle.com/bbs/?tid=140872
https://www.lexaloffle.com/bbs/?tid=140872Mon, 18 Mar 2024 17:08:43 UTCPECS: PICO-8 Entity Component System
<p>Introducing <strong>PECS</strong> <em>(PICO-8 Entity Component System)</em></p>
<p>✅ Small API<br />
🏃‍♀️ Efficient even with lots of Entities<br />
😀 Fun to say<br />
🎈 Has a "lite" version for the token-conscious</p>
<p>Based on the fantastic <a href="https://www.lexaloffle.com/bbs/?tid=39021">Tiny ECS Framework by <a href="https://www.lexaloffle.com/bbs/?uid=45947"> @KatrinaKitten</a></a> 🙏</p>
<p><strong>Full code & docs on GitHub: <a href="https://github.com/jesstelford/pecs">github.com/jesstelford/pecs</a></strong></p>
<p>Here's a demo cart showing off some Particle Emitters using PECS v2.0.0:</p>
<p>
<table><tr><td>
<a href="/bbs/?pid=88957#p">
<img src="/bbs/thumbs/pico8_pecs-1.png" style="height:256px"></a>
</td><td width=10></td><td valign=top>
<a href="/bbs/?pid=88957#p">
PECS Particle Example 2.0.0</a><br><br>
by <a href="/bbs/?uid=46556">
jesstelford</a>
<br><br><br>
<a href="/bbs/?pid=88957#p">
[Click to Play]</a>
</td></tr></table>
</p>
<p><em>Update 20210316:</em> I have added a Camera Follow/Window example also:</p>
<p>
<table><tr><td>
<a href="/bbs/?pid=88957#p">
<img src="/bbs/thumbs/pico8_pecs_camera-1.png" style="height:256px"></a>
</td><td width=10></td><td valign=top>
<a href="/bbs/?pid=88957#p">
PECS Camera Follow Example 2.0.0</a><br><br>
by <a href="/bbs/?uid=46556">
jesstelford</a>
<br><br><br>
<a href="/bbs/?pid=88957#p">
[Click to Play]</a>
</td></tr></table>
</p>
<p><em>Update 20220419:</em> Released <a href="https://github.com/jesstelford/pecs/releases/tag/v2.0.0">version 2.0.0</a> with renamed API methods.</p>
https://www.lexaloffle.com/bbs/?tid=41999
https://www.lexaloffle.com/bbs/?tid=41999Sun, 14 Mar 2021 11:38:23 UTCMotion Blur Demo
<p>
<table><tr><td>
<a href="/bbs/?pid=80976#p">
<img src="/bbs/thumbs/pico8_fgetty-1.png" style="height:256px"></a>
</td><td width=10></td><td valign=top>
<a href="/bbs/?pid=80976#p">
Motion Blur Demo</a><br><br>
by <a href="/bbs/?uid=46556">
jesstelford</a>
<br><br><br>
<a href="/bbs/?pid=80976#p">
[Click to Play]</a>
</td></tr></table>
</p>
<p>Pseudo motion blur using the extended palette + dithering with <code>fillp</code>.</p>
<p>The crux of making this happen is:</p>
<div>
<div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px">
<table style="width:100%" cellspacing=0 cellpadding=0>
<tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
<td background=/gfx/code_bg0.png>
<div style="font-family : courier; color: #000000; display:absolute; padding-left:10px;
padding-top:4px; padding-bottom:4px;
">
<pre>local defaultFills = {
0b0000000000000000, -- solid
0b0000000000000001.1, -- single pixel missing
0b0000010100000101.1, -- 4 pixels missing
0b0101101001011010.1, -- half pixels missing
0b1111101011111010.1, -- 4 pixels rendered
0b1111111111111110.1, -- 1 pixel rendered
}
-- Derived from https://stackoverflow.com/a/10086034/473961
function resizeAndFill(input, outputLength)
assert(outputLength >= 2, "behaviour not defined for n<2")
local step = (#input-1)/(outputLength-1)
local result = {}
for x=1,outputLength do
result[x] = input[ceil(0.5 + (x-1)*step)]
end
return result
end
function createTrailSystem(shapes)
local longestTrail = 0
foreach(shapes, function(shape)
shape.trailPositions = shape.trailPositions or {}
shape.trails = shape.trails or 1
shape.framesPerTrail = shape.framesPerTrail or 1
-- Normalise the length of .fills to match number of trails
shape.fills = resizeAndFill(shape.fills or defaultFills, shape.trails + 1)
-- Normalise the length of .colors to match number of trails
shape.colors = resizeAndFill(shape.colors or { shape.color }, shape.trails + 1)
longestTrail = max(longestTrail, shape.trails)
end)
return {
update=function()
foreach(shapes, function(shape)
if (#shape.trailPositions > (shape.trails * shape.framesPerTrail)) then
-- Remove the oldest / now stale trail
deli(shape.trailPositions, 1)
end
-- Add a new trail at the last position
add(shape.trailPositions, { x=shape.x, y=shape.y })
end)
end,
draw=function()
-- Draw all the trail layers at the same time to avoid weird overlay
-- artefacts
for trail=longestTrail,1,-1 do
foreach(shapes, function(shape)
if (shape.trails < trail) then return end
local frame = ((shape.trails - trail) * shape.framesPerTrail) + 1
if (not shape.trailPositions[frame]) then return end
-- +1 for 1-index in lua
-- +1 for the actual shape itself
local color = shape.colors[shape.trails - trail + 2]
local fill = shape.fills[trail + 1]
pal(shape.colors[1], color)
shape.draw(
shape.trailPositions[frame].x,
shape.trailPositions[frame].y,
shape.colors[1],
fill
)
end)
end
foreach(shapes, function(shape)
pal(shape.colors[1], shape.colors[1])
shape.draw(shape.x, shape.y, shape.colors[1], shape.fills[1])
end)
end
}
end</pre></div></td>
<td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
</tr></table></div></div>
<p>And it's used like so:</p>
<div>
<div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px">
<table style="width:100%" cellspacing=0 cellpadding=0>
<tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
<td background=/gfx/code_bg0.png>
<div style="font-family : courier; color: #000000; display:absolute; padding-left:10px;
padding-top:4px; padding-bottom:4px;
">
<pre>local trails
local shape = {
colors={1,2,3,4},
-- Force no dithering
fills={0b0000000000000000},
x=64,
y=64,
trails=4,
framesPerTrail=7,
draw=function(x, y, color, fill)
fillp(fill)
circfill(x, y, 8, color)
end
}
function _init()
-- Setup the palettes in use
-- Colors figured out thanks to http://kometbomb.net/pico8/fadegen.html
pal(1, 12, 1)
pal(2, 129, 1)
pal(3, 131, 1)
pal(4, 140, 1)
-- Initialise the shapes ready for motion trail
trails = createTrailSystem({ shape })
end
function _update60()
if (btn(0)) then shape.x -= 2 end -- Left
if (btn(1)) then shape.x += 2 end -- Right
if (btn(2)) then shape.y -= 2 end --Up
if (btn(3)) then shape.y += 2 end --Down
trails.update()
end
function _draw()
cls(0)
trails.draw()
end</pre></div></td>
<td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td>
</tr></table></div></div>
https://www.lexaloffle.com/bbs/?tid=39289
https://www.lexaloffle.com/bbs/?tid=39289Thu, 20 Aug 2020 16:35:55 UTC