-
Notifications
You must be signed in to change notification settings - Fork 11
Tips & Tricks
Edison Hua edited this page Apr 25, 2021
·
37 revisions
- You can call
tr := TextRender(text, backgroundstyles, textstyles)
by itself. Use this one-line format to save time and space! - You can call
tr.Draw(text)
multiple times, then calltr.Render()
with blank parameters to render all those draws on screen. - If you need to display text on screen temporarily, take advantage of the time syntax:
TextRender("Au revoir", "time:3000")
— this will display "Au revoir" for 3 seconds! - If you are memory-conscious, be sure to call
FreeMemory()
immediately after to reduce memory usage by over 60%.
- Speed up text rendering by setting the text quality to 0. This will disable anti-aliasing. Create a cool stencil effect with
quality:0 color:None outline:(stroke:1px color:Black)
! - Avoid using the glow parameter in outline. It's very slow and will delay your render time. If you must use it, choose an number less than 5px. Anything more will slow down your script exponentially.
- To increase the size of the text without increasing the font size, set the outline width to 1, and the outline color to your text color. Not only will this increase readability, but it will also decrease space between letters, saving you on-screen real estate! Example:
outline:(stroke:1px)
- Create a interesting effect by making the text "eat" through the background. Use
color:Delete
orcolor:Erase
as the text color. - If the text color is omitted, it defaults to white or black depending on the background color!
- If you want to set the background to be transparent, you can use
c:None
,c:Off
,c:Clear
, orc:Transparent
. Don't usew:0
orh:0
. Even though they work - they act weird changing your x and y positions.
- To avoid rendering to the screen, use
Flush()
instead. This does the same thing asRender()
without modifying the screen. - You must clean up any pointers returned by
CopyToBitmap()
andRenderToBitmap()
withDllCall("gdiplus\GdipDisposeImage", "ptr", pBitmap)
. Likewise forCopyToHBitmap()
andRenderToHBitmap()
,DllCall("DeleteObject", "ptr", hbm)
must be called. - Save() must be called after Render(). Otherwise subsequent drawing operations will affect what is being saved.
- Use
tr.GUID
to check if the internal graphics has been changed. Usetr.Hash()
to check if two states are identical.
- Grab the unique window id by calling tr.hwnd
- Use the toggles .AlwaysOnTop(), .ClickThrough() and .ToggleVisible() to change properties of the window.
- If you want to activate the window send .Show(1). By default .Show() will not activate the window.
- If you want to name the window title, use the new constructor. a := new TextRender."Window Title")
- Chaining properties is very useful. TextRender.Render("hi!", "color:Pink", "color:White").AlwaysOnTop().FreeMemory() will make a window that is not always on top, and cannot be edited since its Bitmap memory has been cleared.