Random Colors hotkey in palette editor

This commit is contained in:
y4my4my4m 2023-05-31 01:40:05 +09:00
parent 9cf9e07805
commit 5700e961c8
3 changed files with 46 additions and 24 deletions

View file

@ -1,4 +1,5 @@
Cd(__DIR__);;
#define PALETTES_PATH "~/PaletteEditor/Palettes/"
#include "PaletteSelect"
#include "PaletteGod"
#include "PaletteEdit"

View file

@ -38,14 +38,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
CSliderState *s = c->state;
I64 size = (c->win_task->pix_width / 16),
border = size / 16,
// border = size / 16,
size2 = (c->win_task->pix_height / 32),
// slider_amount = 3,
i, k, j,// l,
i,
pos, col,
bias;
I64 rectSize = size / 16; // Size of each color rectangle
CBGR24 tempColor;
///////////////////////
// CURRENT SELECTION //
@ -54,7 +52,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
// current color box preview
dc->color = BLACK;
GrPrint(dc, 10, 10, "Preview:");
 GrPrint(dc, 10, 26, "Current Color: #%d", selected_color);
GrPrint(dc, 10, 26, "Current Color: #%d", selected_color);
if (selected_color == 15)
dc->color = LTGRAY;
@ -428,6 +426,14 @@ public U0 PaletteEditor()
current_palette = "";
current_palette = PaletteSelect;
break;
case 'r':
gr_palette[selected_color] = ColorGod(FALSE, TRUE);
LFBFlush;
break;
case 'R':
gr_palette[selected_color] = PaletteGod(FALSE, TRUE);
LFBFlush;
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

@ -2,8 +2,7 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE)
{
// Instantly generate a random palette, seed-based or not
I64 i;
CBGR24 palette;
I32 color;
CBGR24 color;
if (seedUse)
Seed(GodPick);
@ -11,15 +10,31 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE)
{
if (instant || seedUse)
{
color = RandI32;
palette = color & 0xFFFFFF;
color = RandI32 & 0xFFFFFF;
}
else {
palette = GodPick & 0xFFFFFF;
color = GodPick & 0xFFFFFF;
}
gr_palette[i] = palette;
gr_palette[i] = color;
LFBFlush;
}
}
PaletteGod;
CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE)
{
// Instantly generate a random color, seed-based or not
if (seedUse)
Seed(GodPick);
if (instant || seedUse)
{
return RandI32 & 0xFFFFFF;
}
else {
return GodPick & 0xFFFFFF;
}
}
// PaletteGod;