Fix conflict

This commit is contained in:
y4my4my4m 2023-08-24 14:49:30 +09:00
parent fe04a340db
commit 1b112b9f53
2 changed files with 43 additions and 55 deletions

View file

@ -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,28 +142,6 @@ 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
@ -189,6 +156,7 @@ 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);
@ -201,11 +169,18 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
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;
@ -448,6 +426,13 @@ public U0 PaletteEditor()
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;

View file

@ -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;
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;
}