How to use directBitmap()?


#21

We need the LCD init/draw routine you’ve code for the hardware to check some idea for a new draw lib in directmode (no buffer)


#22

I noticed. I will put it up for you. At the moment the HW lib is in heavy edit, but I will share the init routine. Its quite simple, I will just copy-paste it as an answer to you.


#23

Is something involving HIGH RES + HIGH COLOR buffer mode? I believe we are all using this direct mode to override the poor palette limit (4 colors) at full resolution.
Also someone mention a tiles mode, or am I wrong?


#24

It would be my guess that there might not really be enough RAM to buffer a 220x176 screen and a higher pit depth. Personally I’m happy with not having an image buffer for high colour stuff if we can draw tile-by-tile or line-by-line at a good enough speed.


#25

Maybe I’m wrong, but 220x176x4bit (16 colors) are about 20Kb.
We’ll still have about 12Kb of ram for game stuff, not so much but not so bad.


#26

I’m kind of doing that…however, that’s simply because I can’t seem to figure out how to disable full resolution. Whatever I do, it just wants to stay at 220x176…

What I’m really using it for is to have 16 colors per sprite, not just for the entire screen. Hopefully if I can get it into low-res mode, it’ll stop flashing…


#27

Make sure you have PROJ_HIRES=0 in “project/build options/#defines” in CodeBlocks. Then use normal drawBitmap() for drawing and display.update(false) for your drawing loop.


#28

Thx for the share Jonne :wink:

If the idea of my friend work as we espect this lib could be awesome for the pokitto :wink:


#29

@epicdude312 please consider trying to fit your graphics to 16 colors. I know it can be done, with a careful selection of colors. Pico-8 games manage, and they have a fixed palette

If you use only 16 colors, you can use the ahem buffered mode that will soon be available :grin:


#30

I’m having a new problem. It has absolutely nothing to do with intersections, because I do not have any overlapping bitmaps on my new hotbar.

However, it seems that there are black lines flashing in my hotbar:

It happens frequently with the item selected, and occasionally with the energy bar…

The bar is NOT intersecting with the world. I made a special function called directBlockBitmap() that ensures that not blocks draw past where the hotbar is.

Do you have any idea what is going on? If you need the source code, I can release it, but I don’t want to have to upload everything to GitHub if I don’t need to…

EDIT: Fixed! Turned out I was drawing things in the wrong order :stuck_out_tongue:


Making a Minicraft Clone (Blocky World)
#31

If possible, show me your code somehow. I have a feeling you’re using a lot of resources and I am not sure how it would work on the hardware. I will look at it 100% confidentially and you can release when/if you want. IMHO this project looks awesome and I want to support your efforts to get it done.


#32

I’m fairly confident that it’s using too much memory, but I know some ways to optimize it which I’ll do before I release the game.


#33

I’m still very confused. Can anyone list a few steps to direct draw in its current state?

This is what I’m using. But it was flickering, so I made it draw once, but the framebuffer draws over, so I didn’t even see my pic drawn. I also put it into direct draw mode with the update(true) function, but nothing else is drawn. Do I need to follow this function up with a method to change the mode?

const uint16_t pal_me[] = {
    21527,12913,38331,0,63220,60973,33989,27554,22785,31300,46156,65535,47234,56704
};

const uint8_t me[] =
{
80,80,
0,1,0,0,0,16,0,0,0,16,0,0,0,16,0,3,0,3,57,153,153,153,153,153,153,147,0,0,0,0,16,0,0,1,0,0,0,0,0,1,
0,0,16,0,0,1,0,0,0,17,0,0,0,0,0,51,3,57,153,153,153,153,153,153,153,147,51,0,0,1,0,0,0,16,0,0,0,0,0,16,
0,0,1,0,0,1,0,0,0,1,0,0,0,1,3,153,57,153,153,153,153,153,153,153,153,51,131,0,0,1,0,0,0,16,0,0,0,0,1,0,
0,0,1,16,0,0,16,0,0,1,16,0,0,3,57,153,153,153,153,153,153,153,153,153,153,56,147,0,0,16,0,0,1,0,0,0,0,0,16,0,
0,0,0,17,0,0,1,0,0,0,17,0,0,57,153,153,154,169,153,153,153,153,153,153,153,153,147,0,1,16,0,0,16,0,0,0,0,1,0,1,
16,0,0,1,16,0,1,16,0,0,51,51,51,153,153,153,153,170,170,153,169,147,153,153,153,153,48,0,1,0,0,0,16,0,0,0,0,16,0,16,
17,0,0,0,16,0,0,16,0,3,137,153,153,153,153,153,153,153,154,170,169,153,153,169,154,153,48,0,17,0,0,1,0,0,0,0,1,0,1,0,
1,16,0,0,17,0,0,1,0,0,58,169,153,153,153,153,153,153,153,154,153,58,154,169,170,147,0,0,16,0,0,1,0,0,0,0,16,0,16,0,
0,16,0,0,1,16,0,1,16,3,51,170,153,153,153,153,147,153,153,169,147,170,170,170,170,163,0,1,16,0,0,16,0,0,0,1,0,1,0,0,
0,1,0,0,0,17,0,0,17,57,153,153,153,153,153,153,57,153,153,153,51,153,169,154,153,51,48,17,0,0,1,0,0,0,0,16,0,16,0,0,
0,0,16,0,0,1,16,0,1,57,153,153,153,153,153,153,57,153,153,147,57,153,153,57,153,153,48,17,0,0,17,0,0,0,1,0,1,0,0,1,
16,0,1,0,0,1,16,0,1,57,153,153,153,147,56,136,56,137,153,147,153,153,152,51,137,131,1,16,0,1,16,0,0,0,16,0,16,0,0,16,
1,0,0,16,0,0,17,0,0,57,153,153,153,52,67,51,51,51,136,51,136,136,131,68,56,48,17,16,0,1,0,0,0,1,0,1,0,0,1,0,
0,16,0,1,0,0,1,16,0,57,153,153,153,52,68,68,68,68,51,51,51,51,52,68,67,0,17,0,0,17,0,0,0,16,0,16,0,1,16,0,
0,1,0,1,16,0,0,17,0,56,136,137,147,68,68,68,68,68,68,68,68,68,68,68,67,1,17,0,1,16,0,0,1,0,1,0,0,17,0,0,
0,0,16,0,17,0,0,17,16,57,153,152,147,68,68,68,68,68,68,68,68,68,68,68,67,1,16,0,1,16,0,0,16,0,16,0,1,16,0,0,
0,0,1,0,1,16,0,1,16,56,136,137,131,68,68,68,68,136,136,68,69,68,136,136,67,17,16,0,17,0,0,1,16,1,0,0,17,0,0,0,
16,0,0,16,0,17,0,0,17,57,153,152,52,68,68,68,136,136,136,132,84,72,136,136,131,17,0,1,16,0,0,17,0,16,0,1,16,0,0,1,
17,0,0,1,0,1,16,0,1,19,153,147,68,68,68,72,132,68,68,68,68,68,68,68,131,17,0,17,16,0,1,16,1,0,0,17,0,0,1,16,
1,16,0,0,16,0,17,0,1,19,153,52,68,68,68,68,68,68,68,68,68,68,68,68,67,17,17,17,0,0,17,0,16,0,17,16,0,0,16,0,
0,17,16,0,1,0,1,16,0,3,136,52,68,68,68,68,68,68,68,68,68,68,68,68,67,17,17,17,0,1,16,1,0,1,17,0,0,1,0,0,
0,0,17,0,0,16,0,17,0,3,153,52,68,68,68,68,67,51,52,68,68,68,51,51,67,17,17,17,0,17,0,16,0,17,16,0,1,0,0,0,
0,0,1,16,0,1,0,1,16,3,153,52,68,68,68,68,59,187,179,68,68,67,187,187,51,17,17,17,1,16,1,1,17,17,0,0,16,0,0,1,
0,0,0,17,0,0,16,0,17,3,153,52,68,68,68,67,187,187,187,52,68,59,187,187,179,17,17,17,17,0,16,17,17,16,0,17,0,0,1,16,
17,0,0,0,17,0,1,0,17,19,57,147,68,68,68,67,187,51,187,52,68,59,179,59,179,17,17,17,16,1,0,17,17,0,1,0,0,0,16,0,
17,17,0,0,1,16,0,16,1,17,57,147,68,68,68,67,187,51,187,52,68,59,179,59,179,17,17,17,0,16,1,17,17,1,16,0,0,17,0,0,
1,17,17,0,0,17,0,1,0,17,56,131,68,68,68,67,187,187,187,52,68,59,187,187,179,51,49,16,1,0,17,17,17,16,1,17,1,0,0,1,
0,1,17,17,0,0,16,0,16,3,57,147,68,68,68,68,59,187,179,68,68,83,187,187,52,52,67,16,16,1,17,17,17,16,1,17,16,0,0,16,
0,0,17,17,17,0,1,16,1,52,67,153,52,68,68,68,67,51,52,68,68,52,51,51,68,53,67,1,0,17,17,17,17,16,0,16,0,0,16,0,
17,0,0,17,17,17,0,17,3,68,84,57,52,68,68,68,68,68,68,68,68,52,68,68,68,53,67,17,17,16,1,17,17,16,17,0,0,16,0,0,
1,16,0,0,17,17,16,17,19,69,85,67,52,68,68,68,68,68,68,68,68,67,68,68,68,51,67,17,17,17,17,17,17,17,0,0,17,0,0,17,
0,1,17,0,1,17,17,17,19,69,83,67,52,68,68,68,68,68,68,68,68,67,68,68,68,53,67,17,17,17,16,17,17,0,0,1,0,0,17,0,
16,0,1,17,0,17,17,17,19,68,51,68,68,68,68,68,68,68,68,68,68,68,52,68,68,53,49,17,17,17,16,1,16,0,1,0,0,17,0,0,
1,16,0,1,17,0,1,17,17,52,83,68,68,68,68,68,68,68,68,68,68,68,67,68,68,53,49,17,17,17,16,16,0,1,0,0,17,0,0,0,
0,1,16,0,1,17,0,1,16,52,69,84,67,68,68,68,68,68,68,68,68,68,68,52,68,67,49,17,17,17,17,0,1,16,0,17,0,0,0,17,
0,0,1,16,0,1,17,1,17,19,69,67,68,69,68,68,68,68,68,67,68,68,67,68,68,67,17,17,17,17,17,1,16,0,17,0,0,0,17,0,
0,0,0,1,17,17,17,17,17,17,52,67,68,52,68,68,67,51,52,68,53,85,52,68,68,67,17,17,34,17,17,16,1,16,0,0,1,16,0,0,
17,0,0,17,17,17,17,17,17,17,19,51,67,68,52,68,60,59,179,68,68,68,68,68,68,67,17,17,34,33,17,17,16,0,0,1,16,0,0,0,
0,1,17,17,17,17,17,17,17,17,17,17,52,67,68,68,60,195,187,51,68,68,68,68,68,67,17,17,34,34,33,17,0,0,1,16,0,0,0,17,
0,0,1,17,17,17,17,34,33,17,17,17,19,84,67,68,60,204,59,187,51,68,68,68,67,67,33,17,18,34,33,17,0,17,17,16,0,17,17,0,
16,0,1,17,17,17,17,34,34,17,17,34,35,68,52,68,67,204,195,187,187,52,68,68,68,51,34,17,17,34,17,17,17,17,17,17,17,17,0,0,
0,17,17,17,17,17,17,18,34,17,18,34,34,51,68,67,67,204,204,51,51,68,68,67,68,83,34,33,17,17,17,17,17,17,17,17,17,16,0,0,
0,0,0,17,17,17,17,17,17,17,18,34,34,34,51,52,68,60,204,204,52,68,67,68,53,83,34,34,17,17,17,16,1,51,51,17,17,17,0,0,
16,0,0,0,17,17,17,17,17,17,34,34,34,35,51,83,52,67,51,51,68,69,68,52,83,50,34,34,33,17,17,0,3,68,68,49,17,17,1,17,
17,17,17,16,1,17,17,17,17,17,34,34,34,54,115,69,83,52,68,68,69,67,68,51,51,34,34,34,33,17,17,0,52,68,68,49,17,17,16,0,
0,0,17,17,17,17,17,17,51,51,51,51,51,54,52,68,85,83,51,51,51,51,51,55,99,34,35,51,51,49,17,3,68,68,68,49,17,17,16,0,
0,0,0,0,17,17,17,19,54,102,102,102,102,54,52,68,69,85,85,85,85,85,85,54,99,51,54,102,102,51,17,19,68,68,67,17,17,17,17,17,
16,0,0,0,17,17,34,54,54,102,102,102,102,54,52,68,68,69,85,85,85,85,84,54,102,54,102,102,102,54,49,19,85,68,67,17,17,17,16,0,
1,17,0,0,17,18,34,54,54,102,102,102,99,102,99,68,68,68,68,68,68,68,68,54,102,54,102,102,103,102,99,17,53,84,67,17,17,16,0,0,
17,16,17,1,17,18,35,102,54,102,102,102,99,102,102,52,68,68,68,68,68,68,67,102,102,54,102,102,103,102,102,49,52,68,67,17,17,16,0,0,
17,16,0,17,17,17,35,102,118,102,102,102,99,102,102,99,52,67,51,51,68,67,54,102,102,54,102,102,103,99,51,51,51,68,67,17,17,16,17,17,
17,16,17,17,17,17,54,102,99,102,102,102,99,102,102,102,99,51,204,204,52,60,54,102,102,54,102,102,118,52,68,68,68,68,68,49,17,17,16,0,
17,17,17,17,17,17,54,102,102,118,102,102,99,102,102,99,51,55,60,204,195,60,195,51,54,54,102,102,118,52,68,68,68,68,68,49,17,17,17,0,
16,17,17,17,17,19,102,102,102,118,102,102,99,102,51,55,119,51,51,204,204,204,204,55,115,102,102,102,118,52,68,68,68,68,68,49,17,17,17,0,
0,17,17,17,17,19,102,102,102,103,102,102,102,51,119,102,99,204,204,204,195,60,204,54,102,102,102,102,118,51,84,68,68,68,68,67,17,17,17,0,
0,17,17,17,17,54,102,102,102,103,102,102,102,102,102,102,51,51,60,204,56,60,60,195,51,54,102,103,102,52,68,68,68,68,68,67,17,17,17,17,
0,17,17,17,17,54,102,102,102,103,102,102,102,102,102,102,102,51,204,195,147,195,3,204,195,211,102,103,102,52,68,68,68,68,68,67,17,17,17,0,
1,17,17,17,19,102,102,102,102,103,102,102,102,102,102,102,99,204,204,57,147,195,51,204,61,221,54,103,102,51,84,68,68,68,68,68,49,17,17,16,
1,17,17,17,19,102,102,102,102,102,118,102,102,102,102,102,60,204,51,153,153,60,204,195,221,51,54,103,102,52,68,68,68,68,68,68,49,17,17,17,
17,17,17,17,54,102,102,102,102,102,118,102,102,102,102,102,51,51,99,153,153,147,51,56,51,102,102,118,102,52,68,68,68,68,68,68,49,17,17,17,
17,17,17,17,51,102,102,102,102,102,118,102,102,102,102,102,102,102,57,152,153,153,153,152,60,54,102,118,102,99,68,68,68,68,68,68,49,17,17,17,
17,17,17,17,54,54,102,102,102,102,118,102,102,102,102,102,102,102,56,137,153,153,153,147,204,54,102,118,102,99,85,85,84,68,68,68,49,17,17,17,
17,17,17,34,54,99,102,102,102,102,103,102,102,102,102,102,102,99,137,153,153,153,153,60,204,54,102,118,102,102,53,85,85,84,68,68,67,17,17,17,
17,17,18,34,51,102,54,102,102,102,103,102,102,102,102,102,102,99,153,153,153,153,147,204,195,102,102,55,102,102,99,51,51,51,68,68,67,17,17,17,
17,17,18,34,52,54,99,102,102,102,99,102,102,102,102,102,102,57,153,153,153,153,54,60,54,102,103,55,102,102,102,99,52,68,68,68,67,17,17,17,
17,17,18,34,52,67,102,51,102,102,115,102,102,102,102,102,99,153,153,153,153,153,54,99,102,102,103,55,118,102,51,52,52,68,68,68,67,17,17,17,
17,17,18,34,52,68,54,102,51,103,115,118,102,102,102,102,57,153,153,153,153,147,102,102,102,102,103,55,119,99,68,68,67,68,68,68,68,49,17,17,
17,17,17,34,52,68,67,54,102,51,51,51,51,51,51,51,153,153,152,153,153,147,102,102,102,102,103,115,119,52,68,68,67,68,68,68,68,49,17,17,
17,17,17,19,68,68,68,67,54,119,51,137,153,153,153,153,153,153,153,152,153,147,102,102,102,102,103,115,115,84,68,68,67,68,68,68,68,67,17,17,
17,17,17,19,68,68,68,68,67,51,153,57,136,153,153,153,153,153,153,153,153,153,51,102,102,102,102,119,51,85,68,68,67,68,68,68,68,67,17,17,
1,17,17,19,68,68,68,68,69,51,57,153,153,137,153,153,153,153,153,153,153,153,153,54,102,102,102,119,53,85,68,68,67,68,68,68,68,68,49,17,
1,17,17,19,68,68,68,68,51,153,147,153,153,152,153,153,153,153,153,147,57,153,153,147,102,102,102,119,53,85,84,68,67,68,68,68,68,68,49,17,
1,17,17,19,68,68,68,67,137,153,153,147,153,137,152,153,153,153,147,52,67,152,152,53,54,102,102,103,51,85,84,68,52,68,68,68,68,68,83,17,
1,17,17,19,68,68,68,51,136,153,153,153,57,152,137,153,137,51,52,68,67,153,131,85,54,102,102,103,51,85,85,68,52,68,68,68,68,68,83,17,
1,17,17,52,68,68,68,68,51,51,153,153,147,153,153,136,147,68,68,69,57,153,53,68,54,102,102,102,51,85,85,67,68,68,68,68,68,68,85,49,
17,17,17,52,68,68,68,68,68,68,57,153,153,153,153,153,52,68,68,51,153,51,68,68,54,102,102,102,50,53,85,83,68,68,68,68,68,69,85,49,
17,17,17,52,68,68,68,68,68,68,67,56,153,153,153,147,68,68,67,51,51,68,68,68,54,102,102,102,50,35,85,53,68,68,68,68,68,69,85,49,
17,17,19,68,68,68,68,68,68,68,68,67,136,153,153,147,68,68,68,68,68,68,68,67,102,102,102,102,50,35,85,53,68,68,68,68,68,69,85,49,
17,17,19,84,68,68,68,68,68,68,68,68,51,51,51,52,68,68,68,68,68,68,67,53,54,102,102,102,50,17,53,85,84,68,68,68,68,85,83,17,
17,17,17,53,85,85,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,67,52,68,54,102,102,102,49,17,53,85,84,68,68,68,69,85,83,17,
};

#34

call game.update() like this:

game.update(true);

What it does is it prevents the framebuffer from drawing on top of your direct draw images


#35

When I do that, all that is drawn is the directBitmap() …

Side note, but aren’t I cute? :smiley:


#36

use game.display.update(); to force buffer draw before you do the directdraws


#37

Do I need to call game.display.update() at the top of each loop, now?


#38

oh wait. it wont work like that. you will still get flicker


#39

Yeah, I just realized that. How would I be able to get this working right?


#40

I think you could look at how @spinal did the Sensitive game. I am still too tied to the shipping jamboree