greygraphics [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=36577 Display Glitch on macOS <p>When running in full screen on macOS Big Sur, the display is around the screen is not cleared, resulting in a pattern of red lines. <img style="margin-bottom:16px" border=0 src="/media/36577/Screenshot 2021-01-11 at 09.37.42.png" alt="" /></p> https://www.lexaloffle.com/bbs/?tid=41132 https://www.lexaloffle.com/bbs/?tid=41132 Mon, 11 Jan 2021 08:36:32 UTC Rotating Sprites Demo <p> <table><tr><td> <a href="/bbs/?pid=64178#p"> <img src="/bbs/thumbs/pico8_rspr_greygraphics-3.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=64178#p"> rspr2.1</a><br><br> by <a href="/bbs/?uid=36577"> greygraphics</a> <br><br><br> <a href="/bbs/?pid=64178#p"> [Click to Play]</a> </td></tr></table> </p> <p>Hi, </p> <p>I made a small demo of a function I have been working on. It is called rspr and can draw sprites with any rotation.<br /> It has the following signature:</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>rspr(sx,sy,sw,sh,a,dx,dy,dw,dh) -- sx,sy,sw,sh - pos,dimensions in spritesheet -- a - angle -- dx,dy,dw,dh - pos,dimensions on screen</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>It takes the angle in the same format as sin and cos and draws the sprite rotated around dx,dy.<br /> You can scale the drawn sprite with dw,dh and it can draw sprites of any size.<br /> However, large values for dw and dh cause some serious performance losses, so you should avoid scaling up sprites to unreasonable sizes.</p> <p>Due to this slowdown, I would really like to have this function implemented natively in pico-8. What do you think, <a href="https://www.lexaloffle.com/bbs/?uid=1"> @zep</a>?</p> <p>Thank you,<a href="https://www.lexaloffle.com/bbs/?uid=25532"> @freds72</a>, for the suggestion of inlining the function calls. It does speed up the function remarkably.</p> https://www.lexaloffle.com/bbs/?tid=34137 https://www.lexaloffle.com/bbs/?tid=34137 Sat, 04 May 2019 22:55:04 UTC Include with &quot;RUN&quot; crashes on Windows 10 <p>When loading a file via #include, pico-8 crashes when running the program from the command line, like &quot;run&quot;.<br /> The code loaded is tested and used correctly and does not cause the crash. Also, running via Ctrl+R works and behaves as expected.</p> <p>Editor:</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/36577/picedit.PNG" alt="" /> <p>Result:</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/36577/cmd.PNG" alt="" /> <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>#include multi.lua m=multi(0,17) m:draw(10,10) -- this works when run with ctrl+r -- it crashes when running with &quot;run&quot;</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>multi.lua</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 multi = {} multi.__index = multi setmetatable(multi,{ __call=function(cls,...) return cls.new(...) end } ) local function getxy(index) local y = flr(index / 16) local x = index - y * 16 return x,y end function multi.new(tl,br) local self = setmetatable({}, multi) local tx,ty = getxy(tl) local bx,by = getxy(br) local w = bx - tx + 1 local h = by - ty + 1 self.tx = tx self.ty = ty self.bx = bx self.by = by self.w = w self.h = h return self end local function getindex(x,y) return x + y * 16 end function multi:draw(x,y) for u=0,self.w - 1 do for v=0,self.h - 1 do local index = getindex(self.tx + u, self.ty + v) spr(index, x + u * 8, y + v * 8) 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>It also would be great, if the folder for includes was the same folder as the cartridges (AppData).</p> https://www.lexaloffle.com/bbs/?tid=33873 https://www.lexaloffle.com/bbs/?tid=33873 Mon, 15 Apr 2019 16:04:05 UTC