The GBS visualizer should use custom color palettes

This commit is contained in:
Lior Halphon 2021-12-10 02:06:12 +02:00
parent 9e57201b08
commit e087bd5218

View File

@ -1,4 +1,5 @@
#import "GBVisualizerView.h" #import "GBVisualizerView.h"
#import "GBPaletteEditorController.h"
#include <Core/gb.h> #include <Core/gb.h>
#define SAMPLE_COUNT 1024 #define SAMPLE_COUNT 1024
@ -28,24 +29,7 @@ static NSColor *color_to_effect_color(typeof(GB_PALETTE_DMG.colors[0]) color)
- (void)drawRect:(NSRect)dirtyRect - (void)drawRect:(NSRect)dirtyRect
{ {
const GB_palette_t *palette; const GB_palette_t *palette = [GBPaletteEditorController userPalette];
switch ([[NSUserDefaults standardUserDefaults] integerForKey:@"GBColorPalette"]) {
case 1:
palette = &GB_PALETTE_DMG;
break;
case 2:
palette = &GB_PALETTE_MGB;
break;
case 3:
palette = &GB_PALETTE_GBL;
break;
default:
palette = &GB_PALETTE_GREY;
break;
}
NSSize size = self.bounds.size; NSSize size = self.bounds.size;
[color_to_effect_color(palette->colors[0]) setFill]; [color_to_effect_color(palette->colors[0]) setFill];