How to use directBitmap()?

Hi everyone! I’m having yet another problem…
I can’t seem to figure out directBitmap(). No matter what I do, I just can’t get my bitmap to render.
The reason I need to print directly is because I’ll have more than 16 colors in total (16 per sprite) and I can’t have multiple palettes activated at once using the buffer. However, I can’t seem to find any documentation whatsoever about the function.
Anybody know what I need to do?

looking into it i got some observations
try and draw outside of if (game.update()) { and you will see whats going on in the simulator
seems like the display buffer is drawing ontop the directbitmap
im trying to look around but have not seen how to turn the buffer off

try if (game.update(true)) {
this seems to fix the problem

No matter what I try, it doesn’t work. All I get is a blank screen.
I get the feeling that it has something to do with palettes; I used IMG2POK (that image conversion tool @HomineLudens made) to convert the images to code. Do you know if I’m supposed to do anything differently?

1 Like

I used IMG2POK aswell it works fine
Can you draw a regular bitmap on screen
Even if its the wrong format or something your supposed to see something, even corrupted image is something

1 Like
#include "Pokitto.h"

Pokitto::Core game;

const uint16_t pal[] = {
const uint16_t pal0[] = {
const uint8_t duck[] =

int main () {
    //fill screen  after logo
    while (game.isRunning()) {

        if (game.update(true)) { //must be true

            //game.display.drawBitmap(x,y,sprite,4bit color,scale);




    return 1;
reminder that this is persistent and clearing the screen or overlapping images will create flicker

Now this is weird…
I completely copied your code and ran it. All I saw was a nice orange color. No ducks.

My Code::Blocks may be screwed up, or maybe my Pokitto Sim is…
I’ll reinstall both when I have time. Strange glitches have happened to me before, such as the logo not showing up when the simulator opens.

Linux or windows?..

Also: please post code for us to test

Logo not showing up: are you using a project copied from one of the examples or a ‘blank’ project?

EDIT: Just made a new clone from repo, and copy-pasted @adekto code into HelloWorld_win project with results you see below. It seems @epicdude312 that something is wrong in your setup / project settings.

@epicdude312 is any of the other sample code working?

@jonne what exactly is game.update(true)vs game.update()is it just disabling the buffer?

Yes. It was added by @Hanski I think


static bool update(bool useDirectMode=false);

i see, looking into this i found some code in display that seems useless, enableDirectPrinting or something

Its not useless!

directPrinting allows you to print on top of the buffer ! Its needed for the console which will be added soon.

Console = debug output that is independent of the buffer

The console already exits in my development version. I just haven’t tested it lately. It is very neat.

ok my bad, question about overlapping direct images, they do flicker on hardware right?

They flicker because of the drawing order. It depends which one gets drawn first.

If you turn display persistence on and do a directBitmap on every update, the result should be the output of the buffer & directBitmap (or directText) on top of it.

I will check what combination makes it work. A bit busy at the moment.

Right, game.update(true) just skips drawing Pokitto buffer to the screen, but still does everything else, like key events, updates audio, etc.

Huh, I had been having issues with the HelloWorld_win target as well. The game wasn’t using high-resolution mode.

I reinstalled the simulator and it’s working fine now. The simulator code in the directory I copy to make new projects must’ve been corrupted or something.

Hopefully everything should go smoothly now :slight_smile:

oh yea, if you change target, its best to do a full rebuild

Okay, I’ve got a direct image world, and a player. The player is also a direct image, and flickers as can be seen here. Any ideas as to how I might go about resolving the flicker?

I wouldn’t worry about it right now, as none of us have Pokittos yet for testing. The issue might not be noticeable on hardware.

Actually, I am going to have to do something about this directBitmap craziness that you all have gotten involved in :grin: directBitmap is not optimized at all and I’m gonna be in major trouble if this trend continues.

But do not be worried, because I have calculated and come up with an idea how to boost the performance. That will address your games @spinal and yours @epicdude312 as well as whatever @crait is cooking