summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4aae1df)
raw | patch | inline | side by side (parent: 4aae1df)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 3 Sep 2017 14:05:18 +0000 (17:05 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 3 Sep 2017 15:35:43 +0000 (18:35 +0300) |
src/game/g_holmes.inc | patch | blob | history | |
src/game/g_holmes_ui.inc | patch | blob | history |
diff --git a/src/game/g_holmes.inc b/src/game/g_holmes.inc
index d103cdb76d184a31e6764433164feee4d1fbcd4b..3cfdd17b09580471164bfc819190b7ee85d861e6 100644 (file)
--- a/src/game/g_holmes.inc
+++ b/src/game/g_holmes.inc
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);
index d9909a2586a3540147eb716f3128443d75674226..0580a475a60f68178a479bf0f942162173155026 100644 (file)
--- a/src/game/g_holmes_ui.inc
+++ b/src/game/g_holmes_ui.inc
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);