From 1b112b9f53751b923a39d085e2c9d8fff8db86d6 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:49:30 +0900 Subject: [PATCH] Fix conflict --- src/Home/PaletteEditor/PaletteEdit.ZC | 69 +++++++++++---------------- src/Home/PaletteEditor/PaletteGod.ZC | 29 ++++++----- 2 files changed, 43 insertions(+), 55 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index d4e5eef7..8a66a19a 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -39,9 +39,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) CSliderState *s = c->state; I64 size = (c->win_task->pix_width / 16), size2 = (c->win_task->pix_height / 32), + i, pos, col, - i, bias; - CBGR24 tempColor; + bias; /////////////////////// // CURRENT SELECTION // @@ -50,21 +50,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // current color box preview dc->color = BLACK; GrPrint(dc, 10, 10, "Preview:"); - - // pixel loop for current color preview - // for (i = 0; i <= 12; i++) - // for (j = 0; j <= 12; j++) - // { - // tempColor = gr_palette[selected_color]; - // if (i < border || i > 12 - border || j < border || j > 12 - border) - // tempColor = 0x000000; - // // DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); - // } - tempColor = gr_palette[selected_color]; - dc->color = tempColor; - GrRect(dc, c->win_task->pix_left + 78 , t + 7,c->win_task->pix_left + 78 + 12, t + 7 +12); - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); + if (selected_color == 15) dc->color = LTGRAY; else if (gr_palette[selected_color] > 0xCCCCCC) @@ -73,7 +60,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = 15; GrRect(dc, 94, 8, 58, 12); + // #Hex value dc->color = selected_color; + GrRect(dc, 78, 8, 12, 12); GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r, gr_palette[selected_color].g, gr_palette[selected_color].b); @@ -153,32 +142,10 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) for (i = 0; i < COLORS_NUM; i++) { - // for (j = 0; j <= size; j++) - // { - // for (k = 0; k <= size; k++) - // { - // tempColor = gr_palette[i]; - // // black borders - // if (k < border || k > size - border || j < border || j > size - border - 1) - // { - // if (selected_color == i) - // tempColor = 0xFFFFFF; - // else - // tempColor = 0x000000; - // } - // // color preview - // DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); - // } - // } - - tempColor = gr_palette[i]; - dc->color = tempColor; - GrRect(dc, c->win_task->pix_left + i, c->win_task->pix_bottom - size * 1.5, c->win_task->pix_left + (size * i), c->win_task->pix_bottom - size * 1.5); - // color label and text preview // TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES // if color too light or too dark add bg - + if (i == 15) dc->color = LTGRAY; else if (gr_palette[i] < gr_palette[15]) @@ -189,23 +156,31 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = LTRED;*/ else dc->color = 15; + if (i == selected_color) dc->color = 0; GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); GrRect(dc, (size * i), c->win_task->pix_height - (size - size / 2), size, size * 1.5); GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); - + if (i == selected_color) dc->color = 15; else dc->color = i; + bias = (size / 2) - 4; if (i >= 9) bias = (size / 2) - 8; + GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); + // Border for preview box + GrRect(dc, (size * i)-2, c->win_task->pix_height - (size*1.5)-1, size+2, size+1); + // preview box + dc->color = i; + GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); } @@ -379,12 +354,15 @@ public U0 PaletteEditor() " PreviousColor(,,SC_CURSOR_UP);" " NextColor(,,SC_CURSOR_RIGHT);" " NextColor(,,SC_CURSOR_DOWN);" + " RandomColor(,'r');" + " RandomPalette(,'R');" "}" "About {" " Info(,CH_CTRLI);" "}" ); DocClear; + DocCursor(OFF); WinBorder(ON); CCtrl *c = SliderNew; @@ -441,13 +419,20 @@ public U0 PaletteEditor() if (selected_color == 15) selected_color = -1; SelectColor(selected_color + 1, c); - break; + break; } break; case CH_CTRLO: current_palette = ""; current_palette = PaletteSelect; break; + case 'r': + gr_palette[selected_color] = ColorGod; + LFBFlush; + break; + case 'R': + PaletteGod; + break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); break; @@ -483,4 +468,4 @@ public U0 PaletteEditor() c->win_task->win_right = original_right; c->win_task->win_top = original_top; c->win_task->win_bottom = original_bottom; -} +} \ No newline at end of file diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 1de348d1..2aaa3ba8 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,15 +1,18 @@ - -public U0 PaletteGodGenerate() -{ - I64 i; - CBGR24 palette; - - for (i = 0; i < 16; i++) - { - palette = GodPick & 0xFFFFFF; - gr_palette[i] = palette; - LFBFlush; - } +CBGR24 ColorGod(Bool instant=TRUE) +{// Generate a random color, seed-based or not + if (instant) + return RandI32 & 0xFFFFFF; + else + return GodPick & 0xFFFFFF; } -PaletteGodGenerate; \ No newline at end of file +public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) +{// Generate a random palette, seed-based or not + I64 i; + + if (seedUse) Seed(GodPick); + + for (i=0; i < 16; i++) + gr_palette[i] = ColorGod(instant); + LFBFlush; +} \ No newline at end of file