Jump to content
BryceTheCoder

Can someone post Canvas Tutorial Please?

Recommended Posts

Canvas are not hard, the simple solution to not having to understand canvases is just use bitmaps.

Here is a Progress report function i wrote for ubex to display multiple lines strings at any position on the screen.

[scar]

Procedure UBMultiText(Text: TStringArray; TColor, BColor, X, Y:Integer);

Var

I,II,III,BMP: Integer;

ATPA: T2dPointArray;

begin

BMP := BitmapFromString(200,Length(Text)*15,''); // set width and height (Height is set by the length of the string)

FastDrawClear(BMP,BColor); // fills the BMP i just made

SetLength(ATPA,Length(Text));

For I := Low(ATPA) to High(ATPA) do

begin

ATPA := LoadTextTPA(Text, OptionChars); // TPA for text is loaded with all the points of ea pixel of ea letter

III := High(ATPA);

for II := 0 to III do

FastSetPixel(BMP, ATPA[iI].X, ATPA[iI].Y+(I*15), TColor); // this sets a pixel of color at each point in TPA

end;

SmartDebugBitmap(BMP,X,Y); // bmp that i made is now copied to smart canvas

FreeBitmap(BMP);

end;

[/scar]

 

---------- Post added at 06:25 AM ---------- Previous post was at 06:19 AM ----------

 

If you want to understand canvas's then heres the syntax:

>> Create BMP same size as RS Page

>> Get the BMP Canvas (make TCanvas Var and use the function GetBitmapCanvas)

>> Store the handle of smartdebug into the canvas class handle

>> Make another Canvas .. Do what you wish to it

>> Then safeCopyCanvas to the original canvas bam you done.

Link to comment
Share on other sites

Alright cool ty, but when i run it i get something saying it does not understand the code "SmartDebugBitmap"

 

EXACT ERROR: Line 213 Unknown identifier 'SmartDebugBitMap'

 

My line 213: SmartDebugBitmap(BMP,X,Y);

 

because its built ontop of include UBeX and just call the function from there if you want to see it in action.

 

[scar]

program New;

{$I UBeX\UBeX.scar}

 

begin

SetupUBeX;

UBMultiText(

[

'UB Ulimate Yew Chopper',

//'Current Player: '+ Left(Players[CurrentPlayer].Name,10),

//'Current Lvl: '+IntToStr(LVL[currentPlayer]),

//'Location: '+' EdgeVille',

//'Logs Cut: '+IntToStr(ItemsDone[CurrentPlayer]),

//'Logs/Hr: '+IntToStr(LogsHR),

//'XP Gained: '+FloatToStr(XPNow),

//'XP/Hr: '+IntToStr(XPHour),

//'GP/Hr: '+IntToStr(GPHour),

//'Players Arround: '+IntToStr(PC),

//'Break In: '+IntToStr(Timings)+' Mins',

'Time Ran: '+Left(STimeRunning,15),

'Made By: ShadowRecon.',

'UnitedBots.Net'

],clYellow,clBlack,548,207);

end.

[/scar]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...