Log In  
:: Unfold ::

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.

P#86345 2021-01-11 08:36

:: Unfold ::

Cart #rspr_greygraphics-3 | 2019-05-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


I made a small demo of a function I have been working on. It is called rspr and can draw sprites with any rotation.
It has the following signature:

--  sx,sy,sw,sh - pos,dimensions in spritesheet
--  a - angle
--  dx,dy,dw,dh - pos,dimensions on screen

It takes the angle in the same format as sin and cos and draws the sprite rotated around dx,dy.
You can scale the drawn sprite with dw,dh and it can draw sprites of any size.
However, large values for dw and dh cause some serious performance losses, so you should avoid scaling up sprites to unreasonable sizes.

Due to this slowdown, I would really like to have this function implemented natively in pico-8. What do you think, @zep?

Thank you, @freds72, for the suggestion of inlining the function calls. It does speed up the function remarkably.

P#64178 2019-05-04 22:55 ( Edited 2019-05-05 17:52)

:: Unfold ::

When loading a file via #include, pico-8 crashes when running the program from the command line, like "run".
The code loaded is tested and used correctly and does not cause the crash. Also, running via Ctrl+R works and behaves as expected.



#include multi.lua
-- this works when run with ctrl+r
-- it crashes when running with "run"


local multi = {}
multi.__index = multi
        return cls.new(...)

local function getxy(index)
    local y = flr(index / 16)
    local x = index - y * 16
    return x,y

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

local function getindex(x,y)
    return x + y * 16

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)

It also would be great, if the folder for includes was the same folder as the cartridges (AppData).

P#63537 2019-04-15 16:04

Follow Lexaloffle:          
Generated 2023-09-30 22:44:14 | 0.072s | Q:15