- exported the drawer function of the colorpicker menu.
This commit is contained in:
parent
04e2b3be4a
commit
8c780ab7ff
15 changed files with 211 additions and 127 deletions
|
|
@ -118,81 +118,6 @@ public:
|
|||
mBlue = (float)BPART(DWORD(*mCVar));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void Drawer()
|
||||
{
|
||||
Super::Drawer();
|
||||
|
||||
if (mCVar == NULL) return;
|
||||
int y = (-mDesc->mPosition + BigFont->GetHeight() + mDesc->mItems.Size() * OptionSettings.mLinespacing) * CleanYfac_1;
|
||||
int h = (screen->GetHeight() - y) / 16;
|
||||
int fh = OptionSettings.mLinespacing * CleanYfac_1;
|
||||
int w = fh;
|
||||
int yy = y;
|
||||
|
||||
if (h > fh) h = fh;
|
||||
else if (h < 4) return; // no space to draw it.
|
||||
|
||||
int indent = (screen->GetWidth() / 2);
|
||||
int p = 0;
|
||||
|
||||
for(int i = 0; i < 16; i++, y += h)
|
||||
{
|
||||
int box_x, box_y;
|
||||
int x1;
|
||||
|
||||
box_y = y - 2 * CleanYfac_1;
|
||||
box_x = indent - 16*w;
|
||||
for (x1 = 0; x1 < 16; ++x1, p++)
|
||||
{
|
||||
screen->Clear (box_x, box_y, box_x + w, box_y + h, p, 0);
|
||||
if ((mDesc->mSelectedItem == mStartItem+7) &&
|
||||
(/*p == CurrColorIndex ||*/ (i == mGridPosY && x1 == mGridPosX)))
|
||||
{
|
||||
int r, g, b;
|
||||
DWORD col;
|
||||
double blinky;
|
||||
if (i == mGridPosY && x1 == mGridPosX)
|
||||
{
|
||||
r = 255, g = 128, b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = 200, g = 200, b = 255;
|
||||
}
|
||||
// Make sure the cursors stand out against similar colors
|
||||
// by pulsing them.
|
||||
blinky = fabs(sin(I_MSTime()/1000.0)) * 0.5 + 0.5;
|
||||
col = MAKEARGB(255,int(r*blinky),int(g*blinky),int(b*blinky));
|
||||
|
||||
screen->Clear (box_x, box_y, box_x + w, box_y + 1, -1, col);
|
||||
screen->Clear (box_x, box_y + h-1, box_x + w, box_y + h, -1, col);
|
||||
screen->Clear (box_x, box_y, box_x + 1, box_y + h, -1, col);
|
||||
screen->Clear (box_x + w - 1, box_y, box_x + w, box_y + h, -1, col);
|
||||
}
|
||||
box_x += w;
|
||||
}
|
||||
}
|
||||
y = yy;
|
||||
DWORD newColor = MAKEARGB(255, int(mRed), int(mGreen), int(mBlue));
|
||||
DWORD oldColor = DWORD(*mCVar) | 0xFF000000;
|
||||
|
||||
int x = screen->GetWidth()*2/3;
|
||||
|
||||
screen->Clear (x, y, x + 48*CleanXfac_1, y + 48*CleanYfac_1, -1, oldColor);
|
||||
screen->Clear (x + 48*CleanXfac_1, y, x + 48*2*CleanXfac_1, y + 48*CleanYfac_1, -1, newColor);
|
||||
|
||||
y += 49*CleanYfac_1;
|
||||
screen->DrawText (SmallFont, CR_GRAY, x+(24-SmallFont->StringWidth("Old")/2)*CleanXfac_1, y,
|
||||
"Old", DTA_CleanNoMove_1, true, TAG_DONE);
|
||||
screen->DrawText (SmallFont, CR_WHITE, x+(48+24-SmallFont->StringWidth("New")/2)*CleanXfac_1, y,
|
||||
"New", DTA_CleanNoMove_1, true, TAG_DONE);
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DColorPickerMenu, true, false)
|
||||
|
|
|
|||
|
|
@ -357,6 +357,26 @@ void DMenu::Drawer ()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMenu, Drawer)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DMenu);
|
||||
self->Drawer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DMenu::CallDrawer()
|
||||
{
|
||||
IFVIRTUAL(DMenu, Drawer)
|
||||
{
|
||||
VMValue params[] = { (DObject*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
else Drawer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DMenu::DimAllowed()
|
||||
{
|
||||
return true;
|
||||
|
|
@ -800,7 +820,7 @@ void M_Drawer (void)
|
|||
screen->Dim(fade);
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
DMenu::CurrentMenu->Drawer();
|
||||
DMenu::CurrentMenu->CallDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ public:
|
|||
|
||||
bool CallMenuEvent(int mkey, bool fromcontroller);
|
||||
bool CallMouseEvent(int type, int x, int y);
|
||||
void CallDrawer();
|
||||
|
||||
bool MouseEventBack(int type, int x, int y);
|
||||
void SetCapture();
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ bool DTextEnterMenu::MenuEvent (int key, bool fromcontroller)
|
|||
|
||||
void DTextEnterMenu::Drawer ()
|
||||
{
|
||||
mParentMenu->Drawer();
|
||||
mParentMenu->CallDrawer();
|
||||
if (mInputGridOkay)
|
||||
{
|
||||
const int cell_width = 18 * CleanXfac;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ public:
|
|||
|
||||
void Drawer()
|
||||
{
|
||||
mParentMenu->Drawer();
|
||||
mParentMenu->CallDrawer();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue