Skip to content

Commit 4fe20ff

Browse files
committed
interface debugging docs
1 parent 50f4c88 commit 4fe20ff

File tree

2 files changed

+150
-68
lines changed

2 files changed

+150
-68
lines changed

osrs/interfaces/debugging.simba

Lines changed: 150 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@ compiler directive:
1212

1313
{$IFDEF WL_DEBUG_INTERFACES}
1414

15-
procedure TRSInterface.Draw(img: TImage);
15+
(*
16+
## Button.Draw
17+
```pascal
18+
procedure TRSButton.Draw(img: TImage; color: Integer = $00FFFF);
19+
```
20+
Draws the current {ref}`TRSButton` on the `img` passed in.
21+
22+
Example:
23+
```pascal
24+
{$I WaspLib/osrs.simba}
25+
var
26+
img: TImage;
1627
begin
17-
img.DrawColor := $00FFFF;
18-
img.DrawBox(Self.Bounds);
28+
img := Target.GetImage();
29+
Bank.Buttons[ERSBankButtons.MENU].Draw(img);
30+
img.Show();
1931
end;
20-
32+
```
33+
*)
2134
procedure TRSButton.Draw(img: TImage; color: Integer = $00FFFF);
2235
var
2336
oldColor: Integer;
@@ -28,6 +41,25 @@ begin
2841
img.DrawColor := oldColor;
2942
end;
3043

44+
(*
45+
## ButtonArray.Draw
46+
```pascal
47+
procedure TRSButtonArray.Draw(img: TImage; color: Integer = $00FFFF);
48+
```
49+
Draws the current {ref}`TRSButtonArray` on the `img` passed in.
50+
51+
Example:
52+
```pascal
53+
{$I WaspLib/osrs.simba}
54+
var
55+
img: TImage;
56+
begin
57+
img := Target.GetImage();
58+
Bank.Buttons.Draw(img);
59+
img.Show();
60+
end;
61+
```
62+
*)
3163
procedure TRSButtonArray.Draw(img: TImage; color: Integer = $00FFFF);
3264
var
3365
oldColor: Integer;
@@ -42,6 +74,25 @@ begin
4274
img.DrawColor := oldColor;
4375
end;
4476

77+
(*
78+
## ScrollBar.Draw
79+
```pascal
80+
procedure TRSScrollBar.Draw(img: TImage);
81+
```
82+
Draws the current {ref}`TRSScrollBar` on the `img` passed in.
83+
84+
Example:
85+
```pascal
86+
{$I WaspLib/osrs.simba}
87+
var
88+
img: TImage;
89+
begin
90+
img := Target.GetImage();
91+
Bank.Scroll.Draw(img);
92+
img.Show();
93+
end;
94+
```
95+
*)
4596
procedure TRSScrollBar.Draw(img: TImage);
4697
var
4798
bounds: TBox;
@@ -66,6 +117,25 @@ begin
66117
img.DrawBoxArray([Self.Up, Self.Down], False);
67118
end;
68119

120+
(*
121+
## DropDown.Draw
122+
```pascal
123+
procedure TRSDropDown.Draw(img: TImage);
124+
```
125+
Draws the current {ref}`TRSDropDown` on the `img` passed in.
126+
127+
Example:
128+
```pascal
129+
{$I WaspLib/osrs.simba}
130+
var
131+
img: TImage;
132+
begin
133+
img := Target.GetImage();
134+
Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].Draw(img);
135+
img.Show();
136+
end;
137+
```
138+
*)
69139
procedure TRSDropDown.Draw(img: TImage);
70140
var
71141
i: Integer;
@@ -85,6 +155,47 @@ begin
85155
end;
86156

87157

158+
(*
159+
## Interface.Draw
160+
```pascal
161+
procedure TRSInterface.Draw(img: TImage);
162+
procedure TRSGameTabs.Draw(img: TImage);
163+
procedure TRSChat.Draw(img: TImage);
164+
procedure TRSMake.Draw(img: TImage);
165+
procedure TRSBank.Draw(img: TImage);
166+
procedure TRSBankPin.Draw(img: TImage);
167+
procedure TRSCollectionBox.Draw(img: TImage);
168+
procedure TRSDepositBox.Draw(img: TImage);
169+
procedure TRSShop.Draw(img: TImage);
170+
procedure TRSGoldScreen.Draw(img: TImage);
171+
procedure TRSSilverScreen.Draw(img: TImage);
172+
```
173+
Draws several parts of the interface on a {ref}`TImage`
174+
175+
Example:
176+
```pascal
177+
{$I WaspLib/osrs.simba}
178+
var
179+
img: TImage;
180+
begin
181+
img := Target.GetImage();
182+
GoldScreen.Draw(img);
183+
img.Show();
184+
end;
185+
```
186+
*)
187+
procedure TRSInterface.Draw(img: TImage);
188+
begin
189+
img.DrawColor := $00FFFF;
190+
img.DrawBox(Self.Bounds);
191+
end;
192+
193+
procedure TRSGameTabs.Draw(img: TImage);
194+
begin
195+
img.DrawBox(Self.Bounds);
196+
img.DrawBoxArray(Self.Tabs, False);
197+
end;
198+
88199
procedure TRSChat.Draw(img: TImage);
89200
var
90201
tab: TRSChatTab;
@@ -105,6 +216,22 @@ begin
105216
tab.Button.Draw(img);
106217
end;
107218

219+
procedure TRSMake.Draw(img: TImage);
220+
begin
221+
if not Self.IsOpen() then Exit;
222+
223+
img.DrawColor := $00FFFF;
224+
img.DrawBox(Chat.Bounds);
225+
img.DrawColor := $FFFFFF;
226+
img.DrawBoxArray(Self.QuantityButtonBoxes, False);
227+
img.DrawColor := $0000FF;
228+
img.DrawBoxArray(Self.GetQuantityBoxes(), False);
229+
img.DrawColor := $00FF00;
230+
img.DrawBoxArray(Self.GetItemBoxes(), False);
231+
img.DrawColor := $FF0000;
232+
img.DrawBox(Self.GetHintBox());
233+
end;
234+
108235
procedure TRSBank.Draw(img: TImage);
109236
var
110237
i: Integer;
@@ -133,6 +260,17 @@ begin
133260
Self.DynamicButtons[i].Draw(img);
134261
end;
135262

263+
procedure TRSBankPin.Draw(img: TImage);
264+
begin
265+
if not Self.IsOpen() then Exit;
266+
267+
img.DrawColor := $00FFFF;
268+
img.DrawBox(Self.Bounds);
269+
270+
img.DrawColor := $FFFFFF;
271+
img.DrawBoxArray(Self.Buttons, False);
272+
end;
273+
136274
procedure TRSCollectionBox.Draw(img: TImage);
137275
var
138276
i: Integer;
@@ -192,12 +330,6 @@ begin
192330
end;
193331
end;
194332

195-
procedure TRSGameTabs.Draw(img: TImage);
196-
begin
197-
img.DrawBox(Self.Bounds);
198-
img.DrawBoxArray(Self.Tabs, False);
199-
end;
200-
201333
procedure TRSShop.Draw(img: TImage);
202334
var
203335
i: Integer;
@@ -224,67 +356,19 @@ begin
224356
Self.QuantityButtons[i].Draw(img);
225357
end;
226358

227-
procedure TRSBankPin.Draw(img: TImage);
359+
procedure TRSGoldScreen.Draw(img: TImage);
228360
begin
229-
if not Self.IsOpen() then Exit;
230-
231-
img.DrawColor := $00FFFF;
232361
img.DrawBox(Self.Bounds);
233-
234-
img.DrawColor := $FFFFFF;
235-
img.DrawBoxArray(Self.Buttons, False);
362+
img.DrawBoxArray(Self.ItemBoxes, False);
363+
Self.GetButtons().Draw(img);
236364
end;
237365

238-
(*
239-
## GoldScreen.Draw
240-
```pascal
241-
procedure TRSGoldScreen.Draw(Bmp: TMufasaBitmap);
242-
```
243-
Debug‑draws bounds, item slots, and quantity buttons on `Bmp`.
244-
*)
245-
procedure TRSGoldScreen.Draw();
246-
var
247-
btn: TRSButton;
248-
allBoxes: TBoxArray;
249-
begin
250-
allBoxes += Self.Bounds;
251-
allBoxes += Self.ItemBoxes;
252-
253-
for btn in Self.GetButtons() do
254-
allBoxes += btn.Bounds;
255-
256-
ShowOnTarget(allBoxes);
257-
end;
258-
259-
procedure TRSSilverScreen.Draw();
260-
var
261-
btn : TRSButton;
262-
allBoxes : TBoxArray;
366+
procedure TRSSilverScreen.Draw(img: TImage);
263367
begin
264-
allBoxes += Self.Bounds;
265-
allBoxes += Self.SlotBoxes;
266-
allBoxes += Self.ClickBoxes;
267-
268-
for btn in Self.GetButtons do
269-
allBoxes += btn.Bounds;
270-
271-
ShowOnTarget(allBoxes);
272-
end;
273-
274-
procedure TRSMake.Draw(img: TImage);
275-
begin
276-
if not Self.IsOpen() then Exit;
277-
278-
img.DrawColor := $00FFFF;
279-
img.DrawBox(Chat.Bounds);
280-
img.DrawColor := $FFFFFF;
281-
img.DrawBoxArray(Self.QuantityButtonBoxes, False);
282-
img.DrawColor := $0000FF;
283-
img.DrawBoxArray(Self.GetQuantityBoxes(), False);
284-
img.DrawColor := $00FF00;
285-
img.DrawBoxArray(Self.GetItemBoxes(), False);
286-
img.DrawColor := $FF0000;
287-
img.DrawBox(Self.GetHintBox());
368+
img.DrawBox(Self.Bounds);
369+
img.DrawBoxArray(Self.SlotBoxes, False);
370+
img.DrawBoxArray(Self.ClickBoxes, False);
371+
Self.GetButtons().Draw(img);
288372
end;
289373

290374

@@ -325,7 +409,6 @@ begin
325409
img.Show();
326410
end;
327411

328-
329412
procedure ShowOnTarget(chat: TRSChat); overload;
330413
var
331414
img: TImage;

osrs/interfaces/mainscreen/depositbox.simba

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ Example:
255255
DepositBox.DepositItem('Lobster', True);
256256
```
257257
*)
258-
259258
function TRSDepositBox.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
260259
var
261260
ba: TBoxArray;

0 commit comments

Comments
 (0)