Initial commit

This commit is contained in:
2026-04-06 19:02:09 +08:00
commit d186d7dcc7
743 changed files with 521821 additions and 0 deletions

97
MyCode/Gui/Panel.cpp Normal file
View File

@@ -0,0 +1,97 @@
#include "Panel.h"
void TPanel::Init(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u32 aColor, TBvStyle aBevelOuter){
unsigned short Left,Right,Top,Bottom;
Bound.SetBySize(aX+OwnerX, aY+OwnerY, aW, aH);
OwnerLeftTop.x = OwnerX;
OwnerLeftTop.y = OwnerY;
BorderWidth = 2;
Color = aColor;
BevelOuter = aBevelOuter;
if(BevelOuter == bvRaised){
Left = Bound.Left + 1;
Right = Bound.Right - 2;
Top = Bound.Top + 1;
Bottom = Bound.Bottom - 2;
}else{
Left = Bound.Left + 2;
Right = Bound.Right - 2;
Top = Bound.Top + 2;
Bottom = Bound.Bottom - 2;
}
Content.Set(Left,Top,Right,Bottom);
}
void TPanel::DrawSelf(void)
{
/*unsigned int r,g,b, h,l;
h = Color & 0x00FFFFFF;
r = h / 0x10000;
g = (h / 256) % 256;
b = h % 256;
h = r * 3 / 2; if(h > 255)h=255; r = h;
h = g * 3 / 2; if(h > 255)h=255; g = h;
h = b * 3 / 2; if(h > 255)h=255; b = h;
h = (r<<16) + (g<<8) + b;
l = r * 2 / 3; r = l;
l = g * 2 / 3; g = l;
l = b * 2 / 3; b = l;
l = (r<<16) + (g<<8) + b;
//Draw Border
g = Bound.Right;
b = Bound.Bottom;
//Draw Right & Bottom
for(r=0; r<BorderWidth; r++){
//Draw Horiz
HorizLineRender(Bound.Left+r, Bound.Bottom-r, Bound.Width-r-r, l);
//Draw Vert
VertLineRender(Bound.Right-r, Bound.Top+r, Bound.Height-r-r, l);
}
//Draw Left & Top
for(r=0; r<BorderWidth; r++){
//Draw Horiz
HorizLineRender(Bound.Left+r, Bound.Top+r, Bound.Width-r-r, h);
//Draw Vert
VertLineRender(Bound.Left+r, Bound.Top+r, Bound.Height-r-r, h);
}*/
if (BevelOuter == bvLowered){
VertLineRender(Bound.Left, Bound.Top, Bound.Height-1, 0xFF808080);
HorizLineRender(Bound.Left, Bound.Top, Bound.Width-1, 0xFF808080);
VertLineRender(Bound.Left+1, Bound.Top+1, Bound.Height-2, 0xFF404040);
HorizLineRender(Bound.Left+1, Bound.Top+1, Bound.Width-2, 0xFF404040);
VertLineRender(Bound.Right-1, Bound.Top+1, Bound.Height-2, 0xFFD4D0C8);
HorizLineRender(Bound.Left+1, Bound.Bottom-1, Bound.Width-2, 0xFFD4D0C8);
VertLineRender(Bound.Right, Bound.Top, Bound.Height, 0xFFFFFFFF);
HorizLineRender(Bound.Left, Bound.Bottom, Bound.Width, 0xFFFFFFFF);
}else
if(BevelOuter == bvRaised){
VertLineRender(Bound.Left, Bound.Top, Bound.Height -1, 0xFFFFFFFF);
VertLineRender(Bound.Right -1, Bound.Top +1, Bound.Height -2, 0xFF808080);
VertLineRender(Bound.Right, Bound.Top, Bound.Height, 0xFF404040);
HorizLineRender(Bound.Left, Bound.Top, Bound.Width - 1, 0xFFFFFFFF);
HorizLineRender(Bound.Left +1, Bound.Bottom -1, Bound.Width - 2, 0xFF808080);
HorizLineRender(Bound.Left, Bound.Bottom, Bound.Width, 0xFF404040);
}
//Fill Rect Box
RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);
}
void TPanel::Show(void)
{
DrawSelf();
}