View previous topic :: View next topic |
Author |
Message |
Fluffer_Nutter Advanced Cheater Reputation: 0
Joined: 26 Feb 2015 Posts: 67
|
Posted: Thu Feb 26, 2015 5:26 pm Post subject: Adding a background picture. |
|
|
Hello. I have a Lua Script for a hack i am working on. I was wondering if i can add a background image to the trainer. I have been trying for a while now and just cant figure it out.
Thanks in advance!
Code: |
REMOVED THANK YOU FOR THE HELP! SEE FINAL CODE BELOW.
|
Last edited by Fluffer_Nutter on Mon Jun 01, 2015 4:04 pm; edited 1 time in total |
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Thu Feb 26, 2015 8:42 pm Post subject: |
|
|
Here CEImage1 is a image control loaded with a 181x181 *.jpg, but place outside the visible form UDF1.
The OnPaint callback of form UDF1 will be called whenever it need to paint how it should be draw. There the canvas of the form is draw with the bitmap object obtained from the CEImage1 control. So the image from the CEImage1 became/copied as the form background. It should be work similar with other control eg. button.
I don't know how to scale the bitmap yet.
Code: | local img = UDF1.CEImage1.getPicture().getBitmap()
UDF1.height=181
UDF1.width=181
UDF1.OnPaint = function(sender)
local c = sender.getCanvas()
c.draw(0,0,img)
end
UDF1.show() |
Description: |
|
Filesize: |
31.22 KB |
Viewed: |
7750 Time(s) |
|
|
|
Back to top |
|
|
Fluffer_Nutter Advanced Cheater Reputation: 0
Joined: 26 Feb 2015 Posts: 67
|
Posted: Thu Feb 26, 2015 9:25 pm Post subject: |
|
|
Hello Panraven.
Thank you for the reply.
I see that code calls to open a new CE forum. I already have the entire trainer codded in only Lua script. And not sure how to convert it into a forum so i can use your method.
I stripped the entire code so all it does is open a blank window. The only option I have seen in the code is to change the color but not add a picture. Here is the bare code that i execute from the Lua Script scree.
Code: | orange2="0x00F21200"
--------------
MainGUI = {}
MainGUI[1] = createForm(false)
---------------
-- Main GUI --
control_setSize(MainGUI[1], 425, 512)
-------------
setProperty(MainGUI[1] , "color", orange2)
-------------
form_show(MainGUI[1])
|
Or I might just not understand how to use your code inside of a Lua Forum Window.
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Thu Feb 26, 2015 10:11 pm Post subject: |
|
|
I make it a function and use TableFile:
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
attachBackground(UDF1,[[soulhacker.png]])
UDF1.show() |
Try from your Table menu add an image file, say abc.jpg
then in your code, this should attach abc.jpg as your form background:
Code: | attachBackground(MainGUI[1] ,[[abc.jpg]]) |
Description: |
|
Filesize: |
72.28 KB |
Viewed: |
7738 Time(s) |
|
|
|
Back to top |
|
|
|