This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
slugy12345's profile picture

How Do I Create A Background?

Started by slugy12345, 06 April 2014 - 02:00 PM
slugy12345 #1
Posted 06 April 2014 - 04:00 PM
I have no clue whatsoever on how to go at creating a gui nor in any other programming language. I would like to start with a background with a logo and I was just wondering how I could do that as well as if it would work if my startup uses more than one program. I have a username and password system and you have 3 tries. I accidentally used 3 programs instead of a function and a for loop and I might rewrite it. I was just wondering what the code would be for drawing a logo in paint and setting it as the computer background. Please help.
Zambonie #2
Posted 06 April 2014 - 05:13 PM
Well, There are 2 simple function you should know for making a background.

paintutils.loadImage(path) --Returns The Image, used for later.
The load function, which will load a Image. This will return something, so therefor you will have to create a variable for the image to be stored in.
So, like this, for example.

local img = paintutils.loadImage(path)
And for a Argument it will take the path of the image. So lets say you have the image saves as 'Logo'. So I will do

local img = paintutils.loadImage("Logo")

Then theres…

paintutils.drawImage(img, x, y)
This will draw The image. It does not have a (Important) Return.
Though it does have 3 arguments.
The first being the return value from loadImage (In my example it was 'img')
The second and third would be the X and Y to draw the image.
So, If I want to draw my Logo at 2,2, I would do

paintutils.drawImage(img, 2, 2)

And when ran, it should draw my Logo I painted at the position 2,2.

And remember, load the Image first!
For furthur info, refer to these 2 (This and This) links.
RoD #3
Posted 06 April 2014 - 06:41 PM
zambonie forgot to say one thing:
before all this you need to create a image file:

paint logo

in logo you can enter a directory to a file like:

paint mySystem/images/logo
for example.
After creating this you can paint a image and then save it.
Then just do what zombonie said :)/>
Zambonie #4
Posted 06 April 2014 - 07:59 PM
zambonie forgot to say one thing:
before all this you need to create a image file:

paint logo

in logo you can enter a directory to a file like:

paint mySystem/images/logo
for example.
After creating this you can paint a image and then save it.
Then just do what zombonie said :)/>
I might have though he already did that and he proboly knows that, tha'ts why I didn't include that. But its good anyways ;)/>
RoD #5
Posted 06 April 2014 - 08:03 PM
i just posted this becasue he said:
I have no clue whatsoever on how to go at creating a gui nor in any other programming language

:P/>