Problem with colors in indexed mode

Général

ragnarok93

il y a 6 ans

Hello, I have some question to ask: D.

First one - How to paste code correctly here cause [code][/code] doesn't seem to work :<


Second one - How can i set higher resolution with 16 colors mode?


Third one - I made a sprite of character with indexed 16 color mode in gimp. Saved it as PNG and converted it with this https://gamebuino.com/en/creations/images

Sprite was looking like this -

And result in emulator after doing such code 

[CODE]
#include <Gamebuino-Meta.h>

const uint8_t StoiLewo1Data [] = {32, 32, 1, 0, 1, 0xFF, 1, 0xaa, 0xaa, 0xaa, 0xa7,0x77, 0x77,0x79, 0x97,0x7a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa , 0xaa, 0xaa, 0xaa, 0xaa, 0xa0,0x07, 0x77,0x70, 0x09,0x77, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa0, 0x00,0x07, 0x77 , 0x77, 0x7a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa0, 0x00, 0x99,0x00, 0x77,0x77, 0x7a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa , 0xaa, 0xaa, 0x00,0x99, 0x99,0x90, 0x00,0x07, 0x7a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00,0x09, 0x90,0x09, 0x00,0x00, 0x0a , 0x0a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa0, 0x09,0x99, 0x99,0x90, 0x90,0x00, 0x00,0x0a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa , 0x07,0x99, 0x97,0x99, 0x90,0x00, 0x00,0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00,0x79, 0x00,0x79, 0x99,0x00,0x00,0x0a, 0xaa, 0xaa, 0xaa, 0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aa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa};0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa};
Image StoiLewo1 = Image (StoiLewo1Data); 

void setup ()  
{  
  gb.begin (); 
  

}  

void loop ()  
{  
  while (! gb.update ()); 
  gb.display.clear (); 

  gb.display.drawImage (32, 10, StoiLewo1); 
}
[/CODE]

Was this - 


Why colors has changed? 


Thanks in advice for answers :D.

Sorunome

NEW il y a 6 ans

First one - How to paste code correctly here cause [code][/code] doesn't seem to work :<

There is a button in the top bar

Second one - How can i set higher resolution with 16 colors mode?

You need to create a file called config-gamebuino.h and edit it how it is explained here: https://gamebuino.com/creations/config-gamebuino-h

Third one - I made a sprite of character with indexed 16 color mode in gimp. Saved it as PNG and converted it with this https://gamebuino.com/en/creations/images

That tool uses the default gamebuino palette. If your image uses colors that aren't in the default palette it tries to find the closest match, which is exactly what you see here

ragnarok93

il y a 6 ans

Thanks very very much for reply !! :). I appreciate it :). Another question about color pallete - can I change it so my sprite will match original colors ? And next question - easiest way to animate sprites ? For example I have 3 sprites of animation for running in one direction - how can I implement it easiest way possible ?? (I'm not expert in programming, just learning :D).  I read Your tutorial about animations but there is no example for using it and I dont understand how it should work :<.

ragnarok93

NEW il y a 6 ans

Sorunome Sorunome

Thanks very very much for reply !! :). I appreciate it :). Another question about color pallete - can I change it so my sprite will match original colors ? And next question - easiest way to animate sprites ? For example I have 3 sprites of animation for running in one direction - how can I implement it easiest way possible ?? (I'm not expert in programming, just learning :D).  I read Your tutorial about animations but there is no example for using it and I dont understand how it should work :<.

Sorunome

NEW il y a 6 ans

I updated the image tutorial with more information stuff, i hope that'll help!

ragnarok93

il y a 6 ans

Thank You good Guy/Girl ! ;). Now I understand it much much betyer ;). Soo, Its time to make animations work ^^

ragnarok93

il y a 6 ans

I have another problem :<. Animations works perfectly, but transparency don't work :<. Heres the code

const uint8_t AnimacjaData[] = {32, 32, 2, 0, 1.8, 0xaa, 1, 0xa7, 0xaa,0xaa,

0xaa is the pink background color of my sprites -

But still as result in gamebuino meta emulator i get this - 


So there is no transparency :<. What is wrong ?

ragnarok93

NEW il y a 6 ans

Sorunome Sorunome

Thank You good Guy/Girl ! ;). Now I understand it much much betyer ;). Soo, Its time to make animations work ^^

ragnarok93

NEW il y a 6 ans

Sorunome Sorunome

I have another problem :<. Animations works perfectly, but transparency don't work :<. Heres the code

const uint8_t AnimacjaData[] = {32, 32, 2, 0, 1.8, 0xaa, 1, 0xa7, 0xaa,0xaa,

0xaa is the pink background color of my sprites -

But still as result in gamebuino meta emulator i get this - 


So there is no transparency :<. What is wrong ?

Sorunome

NEW il y a 6 ans

0xaa

should only be

0x0a

as, well, 0x0a is your transparent index, not 0xaa