|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Jul 09, 2015 10:03 pm Post subject: Add an image / picture to CE trainer |
|
|
Dear guys,
Code: |
t1 = createForm()
t2 = createPanel(t1)
control_setSize(t1, 320, 183)
control_setCaption(t1,"Test Trainer")
x,y = control_getSize(t1)
control_setSize(t2, x,y)
-- Add image / picture
img = createImage(t1)
|
How to add a picture as background image by lua script ? (not by form designer)
Does anybody could give a hint / helps ?
Thanks
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Jul 11, 2015 5:03 am Post subject: |
|
|
Thanks Panraven.
The function work properly. For now I just need adjustment image size same to form size.
Anyway maybe should find out to how set control for image / picture property (e.q stretch, size, etc) for the bitmap copy and paste to form with your function.
Code: |
function attachBackground(wc,tblFile)
local p = createPicture()
p.loadFromStream(findTableFile(tblFile).Stream)
wc.OnPaint = function(sender)
local c = sender.getCanvas()
local bitmap = p.getBitmap()
c.draw(0,0,bitmap)
end
end
t0 = createForm()
control_setSize(t0, 300, 200)
x,y = control_getSize(t0)
attachBackground(t0,[[batman1.png]])
--- trying find out how to scaling image loaded to t0 form
--- t2 = createImage(t0)
--- a = attachBackground(t2,[[batman1.png]])
--- t3 = setProperty("Picture", a)
--- control_setSize(t3, x,y)
t0.show()
|
Description: |
|
Filesize: |
79.75 KB |
Viewed: |
11222 Time(s) |
|
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Jul 12, 2015 5:14 am Post subject: |
|
|
oops, I overlooked the copyRect function.
here,
Code: | function attachBackground(wc,tblFile,xoff,yoff,w,h,BorderAdjust)
if wc and wc.getCanvas then
rawset(_G,'bmCache',rawget(_G,'bmCache') or {})
if not bmCache[tblFile] then
local p = createPicture()
p.loadFromStream(findTableFile(tblFile).Stream)
bmCache[tblFile] = p.getBitmap()
end
local b = bmCache[tblFile]
xoff,yoff,w,h = xoff or 0,yoff or 0,w or b.Width, h or b.Height
wc.OnPaint = function(sender)
local c,bw=sender.Canvas,type(BorderAdjust) == 'number' and wc.BorderWidth + BorderAdjust or 0
c.copyRect(bw,bw,wc.Width-bw,wc.Height-bw,b.Canvas,xoff,yoff,xoff+w,yoff+h)
end
return true
else
return false,'the object has no canvas'
end
end
-- to draw with BorderAdjust (adder to BorderWidth of the wc) but not specific the bitmap xoff,yoff etc call like:
attachBackground(UDF1,[[soulhacker.png]],nil,nil,nil,nil,1) -- 1 pixel add to control border
-- otherwise if just not specific the bitmap xoff,yoff etc:
attachBackground(UDF1,[[soulhacker.png]])
|
...but seems not many control can be paint background this way.
I expected common control like button can be but seems not.
_________________
- Retarded.
Last edited by panraven on Mon Jul 13, 2015 6:10 pm; edited 1 time in total |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sun Jul 12, 2015 8:19 pm Post subject: |
|
|
Thank you very much Panraven. You are really very good.
It's done.
Regards
Description: |
|
Filesize: |
121.88 KB |
Viewed: |
11073 Time(s) |
|
|
|
Back to top |
|
|
___obmib___ How do I cheat? Reputation: 0
Joined: 03 Aug 2015 Posts: 5 Location: qatar
|
Posted: Sat Aug 22, 2015 9:38 pm Post subject: |
|
|
hey guys still having some problem in making an image on the trainer itself.do i need to create a udf form and put an image in the form designer...thanks in advance
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|