SRL Archive - OSR Help

Little hlp with painting on smart


bud_wis_er_420

2013-05-24 00:36:34

Is there a way to clear last entry or something along those lines, using SMART_DrawText. I want to update my paint proggy every sec or so with new numbers without having to reload the large img every sec too.

Is there a way to do this or am I forced to clear a whole area?

If I am forced to clear a whole area then, I would have to crop a small piece of the main img for the part I want to reload every sec to making things faster.

Flight

2013-05-24 00:55:57

Ok, I believe it was Euphemism made this procedure for updating only the text but I'll give you an explained example of how I use it in my own progress report, in this case BarbFlyFisher.


{$DEFINE SMART8}
{$I SRL/SRL.Simba}

{$IFDEF SMART8}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}


Var
//Import painting
Prog: Integer;
PaintArray: TStringArray;


procedure UpdateReport;
var
XPH,Portion,I: Integer;
TP: TPoint;
V: string;
begin
if (FishXP < 1) then
FishXP := 1;

XPH := Round((FishXP * 3600) / (GetTimeRunning / 1000));

for I := 0 to 6 do // Number of lines you'll be writing on SMART
begin
case I of
0:
begin
V := 'V.'+Version; // The first line of text
TP := Point(425, 20); // Where the text will be printed [Note] This is relevant to the X/Y postion OF THE IMAGE, NOT the client X/Y postion
end; // An example of the coordinate would be Point(0,0) if you were printing text at the very top left corner OF THE IMAGE
// Do the above for every line of text, in this case I have 7 lines being printed
1:
begin
V := MsToTime(GetTimeRunning, Time_Bare);
TP := Point(93, 56);
end;

2:
begin
V := IntToStrEx(FishXP);
TP := Point(93, 82);
end;

3:
begin
V := IntToStrEx(XPH);
TP := Point(93, 109);
end;

4:
begin
V := IntToStrEx(Trout_Caught);
TP := Point(374, 56);
end;

5:
begin
V := IntToStrEx(Salmon_Caught);
TP := Point(374, 83);
end;

6:
begin
V := IntToStrEx(Loads);
TP := Point(374, 109);
end;
end;

if V = PaintArray[I] then
Continue;

Portion := GetMufasaBitmap(Prog).Copy(TP.x, TP.y, TP.x + (Length(V)*10), TP.y + 17).Index;
SMART_DrawBitmap(False, Portion, Point(MCX1 + TP.x, MCY1 + TP.y)); // Since my image is located in the chat screen, I use MCX/Y 1 as the

FreeBitmap(Portion);

SMART_DrawTextEx(False, MCX1 + TP.x, MCY1 + TP.y, SmallCharsNS, V, clWhite)
end;

// Now we make an array of each text line that will be printed, this should match the above
PaintArray := ['V.'+Version, MsToTime(GetTimeRunning, Time_Bare), IntToStrEx(FishXP), IntToStrEx(XPH),
IntToStrEx(Trout_Caught), IntToStrEx(Salmon_Caught), IntToStrEx(Loads)];
end;

procedure LoadImg;
begin
Prog := LoadBitmap(AppPath + '/Scripts/BFFImg.png'); // Wherever your background image is located
SMART_DrawBitmap(True, Prog, Point(MCX1, MCY1)); // The point where your image will be placed (in this case the chat box)
SetLength(PaintArray, 7); // How many lines of text you have on your progress report
end;

begin
SetupSRL;
LoadImg; // The background image is only loaded once

Repeat
UpdateReport; // This will only update each line of text on your image
Until(False)

FreeBitmap(Prog); // Make sure you free your progress report image
end.

Let me know if you don't understand a part of this.

bud_wis_er_420

2013-05-24 01:17:07

K thx.

This is the part I was looking for
Portion := GetMufasaBitmap(Prog).Copy(TP.x, TP.y, TP.x + (Length(V)*10), TP.y + 17).Index;
SMART_DrawBitmap(False, Portion, Point(MCX1 + TP.x, MCY1 + TP.y)); // Since my image is located in the chat screen, I use MCX/Y 1 as the

FreeBitmap(Portion);

SMART_DrawTextEx(False, MCX1 + TP.x, MCY1 + TP.y, SmallCharsNS, V, clWhite)