end;
+// ////////////////////////////////////////////////////////////////////////// //
+procedure normRGBA (var r, g, b, a: Integer); inline;
+begin
+ if (a < 0) then a := 0 else if (a > 255) then a := 255;
+ if (r < 0) then r := 0 else if (r > 255) then r := 255;
+ if (g < 0) then g := 0 else if (g > 255) then g := 255;
+ if (b < 0) then b := 0 else if (b > 255) then b := 255;
+end;
+
+
+// ////////////////////////////////////////////////////////////////////////// //
function textWidth6 (const s: AnsiString): Integer;
var
f: Integer;
begin
result := 0;
if (Length(s) = 0) then exit;
- if (a < 0) then a := 0 else if (a > 255) then a := 255;
- if (r < 0) then r := 0 else if (r > 255) then r := 255;
- if (g < 0) then g := 0 else if (g > 255) then g := 255;
- if (b < 0) then b := 0 else if (b > 255) then b := 255;
+ normRGBA(r, g, b, a);
if (a < 255) then
begin
// ////////////////////////////////////////////////////////////////////////// //
procedure drawLine (x1, y1, x2, y2: Integer; r, g, b: Integer; a: Integer=255);
begin
- if (a < 0) then a := 0 else if (a > 255) then a := 255;
- if (r < 0) then r := 0 else if (r > 255) then r := 255;
- if (g < 0) then g := 0 else if (g > 255) then g := 255;
- if (b < 0) then b := 0 else if (b > 255) then b := 255;
+ normRGBA(r, g, b, a);
if (a < 255) then
begin
procedure drawRect (x, y, w, h: Integer; r, g, b: Integer; a: Integer=255);
begin
if (w < 0) or (h < 0) then exit;
- if (a < 0) then a := 0 else if (a > 255) then a := 255;
- if (r < 0) then r := 0 else if (r > 255) then r := 255;
- if (g < 0) then g := 0 else if (g > 255) then g := 255;
- if (b < 0) then b := 0 else if (b > 255) then b := 255;
+ normRGBA(r, g, b, a);
if (a < 255) then
begin
glEnable(GL_BLEND);
end;
+procedure drawRectUI (x, y, w, h: Integer; r, g, b: Integer; a: Integer=255);
+begin
+ drawRect(x, y, w, h, r, g, b, a);
+end;
+
+
procedure darkenRect (x, y, w, h: Integer; a: Integer);
begin
if (w < 0) or (h < 0) then exit;
procedure fillRect (x, y, w, h: Integer; r, g, b: Integer; a: Integer=255);
begin
if (w < 0) or (h < 0) then exit;
- if (a < 0) then a := 0 else if (a > 255) then a := 255;
- if (r < 0) then r := 0 else if (r > 255) then r := 255;
- if (g < 0) then g := 0 else if (g > 255) then g := 255;
- if (b < 0) then b := 0 else if (b > 255) then b := 255;
+ normRGBA(r, g, b, a);
if (a < 255) then
begin
glEnable(GL_BLEND);
begin
if mDragging then
begin
- drawRect(mX+4, mY+4, mWidth-8, mHeight-8, r, g, b);
+ drawRectUI(mX+4, mY+4, mWidth-8, mHeight-8, r, g, b);
end
else
begin
- drawRect(mX+3, mY+3, mWidth-6, mHeight-6, r, g, b);
- drawRect(mX+5, mY+5, mWidth-10, mHeight-10, r, g, b);
+ drawRectUI(mX+3, mY+3, mWidth-6, mHeight-6, r, g, b);
+ drawRectUI(mX+5, mY+5, mWidth-10, mHeight-10, r, g, b);
setScissor(mFrameWidth, 0, 3*8, 8);
fillRect(mX+mFrameWidth, mY, 3*8, 8, 0, 0, 128);
drawText8(mX+mFrameWidth, mY, '[ ]', r, g, b);