View previous topic :: View next topic |
Author |
Message |
mindoff Advanced Cheater
Reputation: 0
Joined: 12 Jun 2016 Posts: 96
|
Posted: Wed Nov 27, 2019 1:17 am Post subject: Can DX GDI Text hack with transparent background? |
|
|
Last time found some lua code like this to draw custom text on screen for DX game.
Code: |
function setMessage(x, y, message, textColor, backgroundColor)
if h == nil then
h = createD3DHook()
end
if p then
p.destroy()
end
p = createPicture()
c = p.PNG.Canvas
c.Brush.Color = backgroundColor
c.Font.Color = textColor
p.PNG.Width = math.max(1, c.getTextWidth(message))
p.PNG.Height = math.max(1, c.getTextHeight(message))
c.textOut(0, 0, message)
if not pt then
pt = h.createTexture(p)
else
pt.loadTextureByPicture(p)
end
if not ps then
ps = h.createSprite(pt)
else
ps.Width = pt.Width
ps.Height = pt.Height
end
ps.x = x
ps.y = y
ps.Visible = message~=""
end
--BGR
setMessage(100, 100, "My test message", 0x0000FF, 0x000000)
|
This works well.just one problem.
The text background is black and it will cover the screen too much.
So can I just get text without black background color?
I think maybe it's because the png format is 24 bit instead of 32?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Wed Nov 27, 2019 1:22 am Post subject: |
|
|
try createTexture(p,backgroundcolor)
and when updating destroy the old one and create a new one
Or try a TextContainer and fontmap
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
mindoff Advanced Cheater
Reputation: 0
Joined: 12 Jun 2016 Posts: 96
|
|
Back to top |
|
 |
|