mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 23:36:32 +00:00
Random Colors hotkey in palette editor
This commit is contained in:
parent
9cf9e07805
commit
5700e961c8
3 changed files with 46 additions and 24 deletions
|
@ -1,4 +1,5 @@
|
||||||
Cd(__DIR__);;
|
Cd(__DIR__);;
|
||||||
#define PALETTES_PATH "~/PaletteEditor/Palettes/"
|
#define PALETTES_PATH "~/PaletteEditor/Palettes/"
|
||||||
#include "PaletteSelect"
|
#include "PaletteSelect"
|
||||||
|
#include "PaletteGod"
|
||||||
#include "PaletteEdit"
|
#include "PaletteEdit"
|
|
@ -38,14 +38,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
||||||
|
|
||||||
CSliderState *s = c->state;
|
CSliderState *s = c->state;
|
||||||
I64 size = (c->win_task->pix_width / 16),
|
I64 size = (c->win_task->pix_width / 16),
|
||||||
border = size / 16,
|
// border = size / 16,
|
||||||
size2 = (c->win_task->pix_height / 32),
|
size2 = (c->win_task->pix_height / 32),
|
||||||
// slider_amount = 3,
|
// slider_amount = 3,
|
||||||
i, k, j,// l,
|
i,
|
||||||
pos, col,
|
pos, col,
|
||||||
bias;
|
bias;
|
||||||
I64 rectSize = size / 16; // Size of each color rectangle
|
|
||||||
CBGR24 tempColor;
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// CURRENT SELECTION //
|
// CURRENT SELECTION //
|
||||||
|
@ -54,7 +52,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
||||||
// current color box preview
|
// current color box preview
|
||||||
dc->color = BLACK;
|
dc->color = BLACK;
|
||||||
GrPrint(dc, 10, 10, "Preview:");
|
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)
|
if (selected_color == 15)
|
||||||
dc->color = LTGRAY;
|
dc->color = LTGRAY;
|
||||||
|
@ -428,6 +426,14 @@ public U0 PaletteEditor()
|
||||||
current_palette = "";
|
current_palette = "";
|
||||||
current_palette = PaletteSelect;
|
current_palette = PaletteSelect;
|
||||||
break;
|
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:
|
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");
|
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;
|
break;
|
||||||
|
|
|
@ -1,25 +1,40 @@
|
||||||
public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE)
|
public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE)
|
||||||
{
|
{
|
||||||
// Instantly generate a random palette, seed-based or not
|
// Instantly generate a random palette, seed-based or not
|
||||||
I64 i;
|
I64 i;
|
||||||
CBGR24 palette;
|
CBGR24 color;
|
||||||
I32 color;
|
|
||||||
|
|
||||||
if (seedUse)
|
if (seedUse)
|
||||||
Seed(GodPick);
|
Seed(GodPick);
|
||||||
for (i=0; i < 16; i++)
|
for (i=0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (instant || seedUse)
|
if (instant || seedUse)
|
||||||
{
|
{
|
||||||
color = RandI32;
|
color = RandI32 & 0xFFFFFF;
|
||||||
palette = color & 0xFFFFFF;
|
}
|
||||||
}
|
else {
|
||||||
else {
|
color = GodPick & 0xFFFFFF;
|
||||||
palette = GodPick & 0xFFFFFF;
|
}
|
||||||
}
|
gr_palette[i] = color;
|
||||||
gr_palette[i] = palette;
|
LFBFlush;
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue