| Main > Software Forum | 
| Build Your Own Front End(EXTENDed-) | 
| << < (11/12) > >> | 
| Chris John Hunter: :blank: | 
| Chris John Hunter: :blank: | 
| Chris John Hunter: :blank: | 
| Chris John Hunter: :blank: | 
| kayser2008: --- Quote from: Chris John Hunter on June 17, 2013, 01:45:21 pm --- Background image used: http://imageshack.us/f/593/dkv.jpg/ Right heres some code that uses the system images I grabbed earlier from my C:\HYPERSPINS\Media\Main Menu\Images\Wheel folder N.B: The images need to be in the same folder your working in and I advise you to create a new project. Call it GFX example and put those images along with the background image you want to use in that folder. Later we will specify locations of images but its easy for now. --- Code: ---Rem Front End EXTEND-ed Rem GFX example Rem by CJ Hunter Set Display Mode 1024,768,32 Rem this tells the program, we will say when to refresh the screen. Using the Sync command. Sync Off. And Rem Sync Rate commands are used to automate this. Sync On Rem hide mouse pointer hide mouse Rem Load images - what I've done here is RENAMED the images we grabbed from the Hyperspin folder Rem (C:\HYPERSPINS\Media\Main Menu\Images\Wheel) Rem As 1.png, 2.png etc, upto 20. Doesn't matter which order as long as they are named 1-20.png Rem For Next repeats the actions between For Next commands the number of times specified, here 1-20. Rem 20 times. If you wanted the images to be labled 10-30 you would change this. Sometimes you don't want Rem 1-20 but this time we do. Rem we are using the word IMAGE to represent the number of the IMAGE we want to load For IMAGE=1 to 20 Rem str$(IMAGE) tells the program to convert the NUMBER represents by IMAGE into a string ($) so that Rem it can be treaded as a line of text. +" " to join string$ Rem +".png" is used to add to the string$ the .png extension. We could change that to .bmp jpg. if that was the file type. Rem So the program sees: Load 1.png , then the second time it runs IMAGE now represents the number 2 and Rem sees: Load 2.png Etc. Until the For Next has finished. the ,IMAGE represents the image bank where we store the image for later use. As you might have guessed they are represented again by the word IMAGE. It knows bank 1,2 etc, Rem you could change this but it always makes sense to keep things organised and that is why each number, name and bank are the same. Load image ""+str$(IMAGE)+".png",IMAGE,1 next Rem this is a background image. Once again put it in your project's folder. You could download it from the link if its easier. Or use one of your images. Just remember to change the file extension if you need to Load Image "dkv.jpg",22,1 Rem System number as used before. Will increase decrease depending on user's mouse clicks System=1 Rem start a loop Do Rem clear screen Cls Rem Paste Image is used as it sounds to Paste an image to screen. Pasted images cannot be moved. Rem whereas SPRITES can. We will get to sprites later on. Sprites are used in games for the baddies. Player characters etc. Rem Use: Paste Image IMAGE NUMBER,X position on screen, Y position on screen (number of pixels) Rem This is our BACKGROUND image. Pasted FIRST paste image 22,0,0 Rem The next 2 lines is just me working out the centre of the screen so that the image is pasted at the centre Rem of the screen- 1024 768 are the width and height of the screen IMAGE WIDTH is the Image Width of Rem SYSTEM which is used to represent the current system Image. / is used to divide. So Screen Width divided by 2 Rem minus image width(system) divided by 2. We use these in the next line to paste our system image centrally. the ,1 means make it transparent. 0 would make it black or non transparent. IMX=1024/2-image width(system)/2 IMY=768/2-image height(system)/2 Paste image System,IMY,IMX,1 Rem tells the program to refresh the screen Sync Rem sleep used to slow the program down by cant remember how long now! DOH sleep 100 Rem were using mouse clicks easy. But we will change to the joystick code used earlier (if you've setup the controller first! and its plugged in) if mouseclick()=2 System=System-1 If System=0 System=1 endif endif If mouseclick()=1 System=System+1 If System=20 System=19 endif endif If escapekey() end endif Loop --- End code --- When loading images remember to put ,1 at the end of Load Image "Example.bmp",IMAGE_BANK_NUMBER,1 Because if you don't the graphics go a bit awry!!! :cheers: --- End quote --- Hy first i want to thank you for the great tutorial and help, this is really cool and fun , but i get stucked in this part i put the backgroun image in the same folder GFX example and renamed it dkv.jpg as is on the script and renamed every image that whore downloaded from the hyperspin\wheel as 1.png , 2.png >>>> 20.png, but when i run the script all i get is a black screen i´m not a programmer just some things in Autoit so i´m sorry if i´m doing something wrong ps- in the Part VI , in autoit you can put the .exe that you want to open in the same folder as the compiled script ShellExecute("mame.exe", "", @ScriptDir, "open",@SW_MINIMIZE ) is it possible in Dark Basic Professional ? Sorry and thanks | 
| Navigation | 
|  Message Index | 
| Next page | 
| Previous page |