2018-04-30 18:23:39 -04:00
|
|
|
#include "pal.h"
|
2020-07-19 19:24:48 -04:00
|
|
|
#include "dglgfx.h"
|
|
|
|
#include "dgldraw.h"
|
|
|
|
#include "dglpal.h"
|
2018-04-30 18:23:39 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "helpers.h"
|
|
|
|
|
|
|
|
// displays the entire palette in a grid, waits for a keypress, then changes
|
|
|
|
// color 15's RGB values.
|
|
|
|
void test_palette(void) {
|
|
|
|
int i, x, y;
|
2020-07-19 19:24:48 -04:00
|
|
|
uint8 r, g, b;
|
2018-04-30 18:23:39 -04:00
|
|
|
|
|
|
|
surface_clear(screen, 0);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
for (y = 0; y < 16; ++y) {
|
|
|
|
for (x = 0; x < 16; ++x) {
|
2020-07-19 19:24:48 -04:00
|
|
|
draw_filled_rect(screen, x * 8, y * 8, x * 8 + 7, y * 8 + 7, i);
|
2018-04-30 18:23:39 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getch();
|
|
|
|
|
|
|
|
pal_get_color(15, &r, &g, &b);
|
|
|
|
ASSERT(r == 63 && g == 63 && b == 63);
|
|
|
|
pal_set_color(15, r / 2, g / 2, b / 2);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
pal_set_color(15, r, g, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_palette_fading(void) {
|
|
|
|
int i, x, y;
|
2020-07-19 19:24:48 -04:00
|
|
|
uint8 palette[768];
|
2018-04-30 18:23:39 -04:00
|
|
|
surface_clear(screen, 0);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
for (y = 0; y < 16; ++y) {
|
|
|
|
for (x = 0; x < 16; ++x) {
|
2020-07-19 19:24:48 -04:00
|
|
|
draw_filled_rect(screen, x * 8, y * 8, x * 8 + 7, y * 8 + 7, i);
|
2018-04-30 18:23:39 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pal_get(palette);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
|
|
|
|
pal_fade_range_to_color(16, 31, 0, 0, 0, 1);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
|
|
|
|
pal_fade_range_to_palette(16, 31, palette, 1);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
|
|
|
|
pal_fade_to_color(0, 0, 0, 1);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
|
|
|
|
pal_fade_to_palette(palette, 1);
|
|
|
|
|
|
|
|
getch();
|
|
|
|
}
|
|
|
|
|