Potentially misleading crank alert/indicator documentation

,

SDK 1.10.0 - Linux

Hi all,

I am not sure if this is supposed to go in the #get-help section or here amongst the bug reports. I decided that it should go here because the documentation on the surface seems misleading.

Looking at the crank alert section in the 1.10.0 documentation, it states:

The crank alert will disappear once you stop calling :update()

However, when I stop calling the update method, the update of the alert stops (as indicated by the 'highlight screen updates' feature of the simulator), but the crank indicator image itself does not disappear. I believe a manual clear screen or clear that section of the screen is required to be implemented, but that is not indicated in the documentation.

I used the following code below to validate this. It's a simple hello world example that allows the crank indicator update to be invoked with the press of the A button.

import "CoreLibs/graphics"
import "CoreLibs/ui"
import "CoreLibs/timer"

local show = false
playdate.ui.crankIndicator:start()

function playdate.AButtonDown()
    show = not show
end

function playdate.update()
    playdate.graphics.drawText("Hello World!", 50, 50)

    if show then
        print(" ")
        playdate.ui.crankIndicator:update()
    else
        print("Not showing")
    end

    playdate.timer.updateTimers()
end

I'm happy to be told that I'm wrong or the code is incorrect. Otherwise if this is how it's supposed to work, I would argue that the documentation needs to be clearer.

Thanks in advance.

5 Likes

Thanks for the report, and sorry for the late reply--things are pretty busy over here. :slight_smile: I've got this in the bug tracker now, and we'll get it fixed as soon as we can!

2 Likes

It looks like this is still an issue in 2.0.1.

What do people typically do, draw a box where the indicator was after the crank is undocked? It'd be nice if it worked as the documentation says - preferably by removing/clearing the indicator sprite, or at least through a clarification to the docs.

This indicator does not use sprites to draw - you can think of it more like drawing an image via img:draw(x, y) (also feel free to check out the implementation in the CoreLibs file!)

If you are drawing using sprites, the last crank indicator image should be cleared when you call playdate.graphics.sprite.update() (unless you have set your background color to clear), but otherwise your game will have to draw over that area to clear the image.

So, I think this is mostly a documentation bug, but it would probably make sense to have a getBounds() method so you can either redraw that area or call playdate.graphics.sprite.addDirtyRect() with it.

1 Like

Thanks Dan. Apologies for the super late reply.

I agree. As stated in the original post, I am happy if this is supposed to work as expected and for this to be marked as a documentation typo/bug.

At the time of writing, version 2.0.3 documentation still has this misleading text.

Also happy to mark this as solved once the documentation is fixed.

I believe the documentation update and some other crankIndicator improvements are scheduled for the next SDK release! Should be out fairly soon now I think.

1 Like