index 3f26b360c8e770e30c6592c38f0e0c64780d6543..aaf304db0ada4f121e5b291fbe856203cd7e6f74 100644 (file)
--- a/src/game/g_holmes_ui.inc
+++ b/src/game/g_holmes_ui.inc
procedure uiDraw ();
var
f: Integer;
+ ctl: THControl;
begin
- for f := 0 to High(uiTopList) do uiTopList[f].draw();
+ for f := 0 to High(uiTopList) do
+ begin
+ ctl := uiTopList[f];
+ ctl.draw();
+ if (f <> High(uiTopList)) then darkenRect(ctl.x0, ctl.y0, ctl.width, ctl.height, 128);
+ end;
end;
var
r, g, b: Integer;
begin
+ {
if getFocused then
begin
r := 255;
g := 127;
b := 127;
end;
+ }
+ r := 255;
+ g := 255;
+ b := 255;
drawRect(mX, mY, mWidth, mHeight, r, g, b);
if (Length(mTitle) > 0) then
begin
procedure THCtlCBListBox.appendItem (const atext: AnsiString; bv: PBoolean);
begin
- if (Length(atext)*8+4+10 > mWidth) then mWidth := Length(atext)*8+4+10;
+ if (Length(atext)*8+4+3*8+2 > mWidth) then mWidth := Length(atext)*8+4+3*8+2;
SetLength(mItems, Length(mItems)+1);
mItems[High(mItems)] := atext;
SetLength(mChecks, Length(mChecks)+1);
mChecks[High(mChecks)] := bv;
if (Length(mItems)*8+4 > mHeight) then mHeight := Length(mItems)*8+4;
+ if (mCurIndex < 0) then mCurIndex := 0;
end;
for f := 0 to High(mItems) do
begin
if (mCurIndex = f) then fillRect(sx-2, sy, mWidth, 8, 0, 128, 0);
- if (mChecks[f] <> nil) and (mChecks[f]^) then drawText8(sx, sy, '*', 255, 255, 255);
- drawText8(sx+10, sy, mItems[f], 255, 255, 0);
+ if (mChecks[f] <> nil) then
+ begin
+ drawText8(sx, sy, '[ ]', 255, 255, 255);
+ if mChecks[f]^ then drawText8(sx+6, sy, 'x', 255, 255, 255);
+ drawText8(sx+3*8+2, sy, mItems[f], 255, 255, 0);
+ end;
Inc(sy, 8);
end;
end;
SDL_SCANCODE_UP:
begin
result := true;
- if (mCurIndex < 0) then mCurIndex := Length(mItems)
- else if (mCurIndex > 0) then Dec(mCurIndex);
+ if (Length(mItems) > 0) then
+ begin
+ if (mCurIndex < 0) then mCurIndex := Length(mItems);
+ while (mCurIndex > 0) do
+ begin
+ Dec(mCurIndex);
+ if (mChecks[mCurIndex] <> nil) then break;
+ end;
+ end
+ else
+ begin
+ mCurIndex := -1;
+ end;
end;
SDL_SCANCODE_DOWN:
begin
result := true;
- if (mCurIndex < 0) then mCurIndex := 0
- else if (mCurIndex < High(mItems)) then Inc(mCurIndex);
+ if (Length(mItems) > 0) then
+ begin
+ if (mCurIndex < 0) then mCurIndex := -1;
+ while (mCurIndex < High(mItems)) do
+ begin
+ Inc(mCurIndex);
+ if (mChecks[mCurIndex] <> nil) then break;
+ end;
+ end
+ else
+ begin
+ mCurIndex := -1;
+ end;
end;
SDL_SCANCODE_SPACE,
SDL_SCANCODE_RETURN: