Core::timerTick();

I just wrote a timer for Pokitto myself. (It´s not my idea, but it works!)

PokittoCore.h

static int timerTick(uint64_t timer);

PokittoCore.cpp

unsigned long timertime = 0;

int Core::timerTick(uint64_t timer)
{
    if ((getTime()- timertime) >= timer)
    {
        timertime = getTime();
        return 1;
    }
    else return 0;
}

Use in program:

if (game.timerTick(1000))
{
     game.display.print("Hi");
}

It will print it every 1000 Milliseconds for a really short time, after that it disapears.

@jonne It´s not really useful yet, it´s just a beginning so someone must improve it first.
(I´m just a beginner, as every time :slight_smile:)

3 Likes