This is the third tutorial that i have done; check out my other tutorials: Hello World, Button Presses, and Tables. Now on to the code:
Code:img = Image.load("back.png") while true do System.draw() screen:clear() screen:blit(0, 0, img) System.endDraw() screen:flip() end
Right Click Save As "back.png"
This code loads an image, it sets the image "back.png" to the variable imgCode:img = Image.load("back.png")
This is a really short script, dont worry I'll still break it up for you ;)Code:while true do System.draw() screen:clear() screen:blit(0, 0, img) System.endDraw() screen.flip() end
The first thing you see is "System.draw()", this is the function that makes ANY graphical function possible. The next line says "screen:clear()", this line tells your psp to erase the screen every frame. Now we have "screen:blit(0, 0, img)" this function tells us that we are going to blit (print the image to the screen) at the x,y corrodinates 0,0 the image "img" (remeber we loaded "back.png" to this value). Now finally we have "System.endDraw()" This tells your psp that we are done doing graphical functions.Code:System.draw() screen:clear() screen:blit(0, 0, img) System.endDraw()
This line of code just brings all of the images from the off screen buffer to the screen, without it you would only get a black screen.Code:screen.flip()
And finaly the end of the loop, and the tutorial :P. Download the script below (its a .txt so I could upload it). Have any questions? Ask them hereCode:end