Tiny Mouse
Foreword
Compressed further using Shrinko8. This is my first jam and also experience with PICO-8 development! I purchased it earlier this month and am already so excited to see what I can do with it! This project was essentially me messing around with devkit inputs, and what all was possible. I was inspired by https://www.lexaloffle.com/bbs/?tid=144891 and wanted to see what I would be able to do! It has full support for all mouse buttons, scroll wheel, 0x4 flag deltas, double clicking, dragging, holding, etc.
I ended up discovering (?) some helpful STAT values (specifically some officially undocumented ones, I only found them on the Fandom Wiki and they are not the best descriptions).
STAT(37) specifically was helpful, as it was documented to record "mouse acceleration delta", however it is actually a bitfield!
0x1 - is active when mouse is moving horizontally
0x2 - is active when mouse is moving vertically
0x4 - Here is the big one... is active when a button is pressed or released!
Compressed Bytes
691
Source Code
_m={} function _m:update() for i,v in ipairs(split"x,y,mbb,wh,wv,mab,hdx,hdy") do self[v] = stat(i+31) end local a,p = self.mab&4>0,self.mbb>0 for i,v in ipairs(split"l,r,m") do i-=1 self[v] = self[v] or {} local b = self[v] local k,r,f = self.mbb>>i&1>0, b.k and a, b.t or _dbt b.r, b.k, b.p, b.db, b.h = r, k, k and a, r and f>0 and f<_dbt or false, k and (b.h or 0)+1 or 0 b.t = r and (b.db and _dbt or 0) or (f%32767+1) end if a and p then self.dsx, self.dsy = self.x, self.y elseif p then self.dox, self.doy = self.x - (self.dsx or 0), self.y - (self.dsy or 0) else self.dsx, self.dsy, self.dox, self.doy = 0,0,0,0 end end
color(7) m=_m poke(24365,5) g="\^o15a\^.⁴⁴•⁴⁴\0\0\0" ::_:: m:update() if btnp(❎) then if peek(24365)>0 then poke(24365) else poke(24365,5) end end if m.l.p or m.r.p or m.m.p then ?"\as1i7d5#cg4ce3" end if m.l.r or m.r.r or m.m.r then ?"\as1i7a2b#c3eba4",0,0 end cls(2) if m.m.h>0 then circ(m.x,m.y,sqrt(m.m.h),7) end if m.l.k or m.r.k then rect(m.dsx,m.dsy,m.x,m.y,7) end ?"\#0tiny mouse\n𝘷1.0.0",2,2 ?"\#0press ❎ to toggle",55,2 ?"",2,16 for s in all(split"x,y,mbb,mab,wv,wh,hdx,hdy,dsx,dsy,dox,doy") do ?"\#0"..s..":"..tostr(m[s]) end ?"",91,8 for s in all(split"k,p,r,db,t,h") do ?"\#0l"..s..":"..tostr(m.l[s]) ?"\#0r"..s..":"..tostr(m.r[s]) ?"\#0m"..s..":"..tostr(m.m[s]) end ?g,m.x-2,m.y-2 flip() goto _
Leave a comment
Log in with itch.io to leave a comment.