colorscrolling

General

tikkel

NEW 4 years ago

Steph Steph

Hello Steph, do you have a code snippet for me? How to load the current palette into an array. And then manipulate a single index and then set this array again?

Steph

4 years ago

Hi tikkel,

Here's a demonstration sketch that should help you understand.

And this is what it does:

The image is never redrawn! Only the palette is updated.

jicehel

NEW 4 years ago

if the colors are used only for diamonds you can cycles the colors but it's mean that you'll have to use the minimum colors to keep some for the rest of the game. For example you use 3 colors for the diamond and you cycle them in the loop. It's can have one interest if you have many diamonds like you have because you don't change each sprite, you just redefine 3 colors in the palette.

Steph

NEW 4 years ago

tikkel tikkel

Hi tikkel,

Here's a demonstration sketch that should help you understand.

And this is what it does:

The image is never redrawn! Only the palette is updated.

jicehel

NEW 4 years ago

Well done Steph. A scheme is always better than a long speech  ;)

tikkel

NEW 4 years ago

Another color question. 

How do I change the foreground and background color of gb.gui.menu()

gb.display.setColor() has no effect.

Steph

4 years ago

See how the menu display is implemented.... 

The colors used are the constants DARKGRAY, WHITE, BROWN... so you can't change that (unless you code your own menu). However, you can make sure that the color indices you want to display for the menu correspond to the constants used.

I mean, I haven't tried, but it has to work?!

Steph

NEW 4 years ago

tikkel tikkel

See how the menu display is implemented.... 

The colors used are the constants DARKGRAY, WHITE, BROWN... so you can't change that (unless you code your own menu). However, you can make sure that the color indices you want to display for the menu correspond to the constants used.

I mean, I haven't tried, but it has to work?!

tikkel

NEW 4 years ago

Here is all what i'm looking for :o) 

 https://gamebuino.com/academy/standalone/add-images-to-your-games  (Indexed Images at bottom!)

Thanx to all helped me!

Steph

4 years ago

Just a word to clarify an important point!
Now I understand better your distress!

This discussion led me to dig deeper into where the difficulties you were having with the colors of your indexed images came from... and I realized that the documentation is actually wrong! The color indexing order described in it does not correspond at all to the order established in the source code of the Gamebuino-Meta library!

So I fixed ImageTranscoder to take into account the order implemented in the library.
You should now be able to use it without having the same problems with images built using the official palette!

This is the actual palette:

const Color PALETTE[] = {
    (Color)0x0000, // color 0x0
    (Color)0x0210, // color 0x1
    (Color)0x9008, // color 0x2
    (Color)0x044a, // color 0x3
    (Color)0xcc68, // color 0x4
    (Color)0x5268, // color 0x5
    (Color)0xacd0, // color 0x6
    (Color)0xffff, // color 0x7
    (Color)0xd8e4, // color 0x8
    (Color)0xfd42, // color 0x9
    (Color)0xf720, // color 0xa
    (Color)0x8668, // color 0xb
    (Color)0x7ddf, // color 0xc
    (Color)0x4439, // color 0xd
    (Color)0xca30, // color 0xe
    (Color)0xfeb2  // color 0xf
};

But the documentation is still incorrect!

Steph

NEW 4 years ago

tikkel tikkel

Just a word to clarify an important point!
Now I understand better your distress!

This discussion led me to dig deeper into where the difficulties you were having with the colors of your indexed images came from... and I realized that the documentation is actually wrong! The color indexing order described in it does not correspond at all to the order established in the source code of the Gamebuino-Meta library!

So I fixed ImageTranscoder to take into account the order implemented in the library.
You should now be able to use it without having the same problems with images built using the official palette!

This is the actual palette:

const Color PALETTE[] = {
    (Color)0x0000, // color 0x0
    (Color)0x0210, // color 0x1
    (Color)0x9008, // color 0x2
    (Color)0x044a, // color 0x3
    (Color)0xcc68, // color 0x4
    (Color)0x5268, // color 0x5
    (Color)0xacd0, // color 0x6
    (Color)0xffff, // color 0x7
    (Color)0xd8e4, // color 0x8
    (Color)0xfd42, // color 0x9
    (Color)0xf720, // color 0xa
    (Color)0x8668, // color 0xb
    (Color)0x7ddf, // color 0xc
    (Color)0x4439, // color 0xd
    (Color)0xca30, // color 0xe
    (Color)0xfeb2  // color 0xf
};

But the documentation is still incorrect!

Sorunome

4 years ago

The thing you linked was meant to just be an unordered collection of the colours - agreed, it is confusing as it doesn't represent the actual offsets themselves and it needs fixing! Thank you for pointing it out!

On the upside, in the Images tutorial it is in the correct order... (but without the hex values)

Sorunome

NEW 4 years ago

Steph Steph

The thing you linked was meant to just be an unordered collection of the colours - agreed, it is confusing as it doesn't represent the actual offsets themselves and it needs fixing! Thank you for pointing it out!

On the upside, in the Images tutorial it is in the correct order... (but without the hex values)

Steph

4 years ago

Indeed, the order displayed in the Image Tutorial is correct, but it is not in the documentation about setColor() function and color palettes!

Steph

NEW 4 years ago

Sorunome Sorunome

Indeed, the order displayed in the Image Tutorial is correct, but it is not in the documentation about setColor() function and color palettes!