DEADSOFTWARE

simple allocation counter for classes
[d2df-sdl.git] / src / game / g_holmes_ui.inc
index f9cbf3c01bde5919959d87e6f94de173251b8be1..f91ab1937f2ab50f496803255ebf6ebecbada50e 100644 (file)
@@ -15,7 +15,7 @@
  *)
 // ////////////////////////////////////////////////////////////////////////// //
 type
-  THControl = class
+  THControl = class(TPoolObject)
   public
     type TActionCB = procedure (me: THControl; uinfo: Integer);
 
@@ -664,6 +664,10 @@ end;
 procedure THControl.setScissorGLInternal (x, y, w, h: Integer);
 begin
   if not scallowed then exit;
+  x := trunc(x*g_holmes_ui_scale);
+  y := trunc(y*g_holmes_ui_scale);
+  w := trunc(w*g_holmes_ui_scale);
+  h := trunc(h*g_holmes_ui_scale);
   y := gWinSizeY-(y+h);
   if not intersectRect(x, y, w, h, scxywh[0], scxywh[1], scxywh[2], scxywh[3]) then glScissor(0, 0, 0, 0) else glScissor(x, y, w, h);
 end;
@@ -849,8 +853,8 @@ procedure THTopWindow.centerInScreen ();
 begin
   if (mWidth > 0) and (mHeight > 0) then
   begin
-    mX := (gWinSizeX-mWidth) div 2;
-    mY := (gWinSizeY-mHeight) div 2;
+    mX := trunc((gWinSizeX/g_holmes_ui_scale-mWidth)/2);
+    mY := trunc((gWinSizeY/g_holmes_ui_scale-mHeight)/2);
   end;
 end;
 
@@ -870,12 +874,12 @@ var
 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);
@@ -885,7 +889,7 @@ begin
   if (Length(mTitle) > 0) then
   begin
     setScissor(mFrameWidth+3*8, 0, mWidth-mFrameWidth*2-3*8, 8);
-    tx := mX+(mWidth-Length(mTitle)*8) div 2;
+    tx := (mX+3*8)+((mWidth-3*8)-Length(mTitle)*8) div 2;
     fillRect(tx-3, mY, Length(mTitle)*8+3+2, 8, 0, 0, 128);
     drawText8(tx, mY, mTitle, r, g, b);
   end;