Calander program!
Blitz3D Forums/Blitz3D Beginners Area/Calander program!
| ||
OK I have made a calander program for pepole to have a look at! AppTitle"calander maker" Graphics 800,600 HidePointer ;save screen shot Function SaveScreenshot() iFileNumber% = 0 Repeat iFileNumber = iFileNumber + 1 sFileName$ = "output/screenshot" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp" Until Not(FileType(sFileName)) SaveBuffer FrontBuffer(), sFileName End Function ;end of save screen shot Print"welcome to the calander maker!" Print"Please now put you calander" Print"image into the Input folder" Print"It must be 800*600 pixels wide" ;input of image name! Print"Please type in the file name" Print"remember it must be a .bmp" image$=Input() pic=LoadImage("input/" + image$ + ".bmp") Cls Locate 0,0 ;Date selection Print"Please input the month" month$=Input() If Left$(Lower$(month),3) = "jan" jan1=LoadImage("january.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage jan1,0,0 MaskImage jan1,0,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 jansel$=Input() If jansel$=1 DrawBlock pic,0,0 DrawImage jan1,498,296 MaskImage jan1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "feb" feb1=LoadImage("feb.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage feb1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 febsel$=Input() If febsel$=1 DrawBlock pic,0,0 DrawImage feb1,498,296 MaskImage feb1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "mar" mar1=LoadImage("mar1.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage mar1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 marsel$=Input() If marsel$=1 DrawBlock pic,0,0 DrawImage mar1,498,296 MaskImage mar1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "apr" apr1=LoadImage("apr1.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage apr1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 aprsel$=Input() If aprsel$=1 DrawBlock pic,0,0 DrawImage apr1,498,296 MaskImage apr1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "feb" feb1=LoadImage("feb.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage feb1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 febsel$=Input() If febsel$=1 DrawBlock pic,0,0 DrawImage feb1,498,296 MaskImage feb1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "may" may1=LoadImage("may.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage may1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 maysel$=Input() If maysel$=1 DrawBlock pic,0,0 DrawImage may1,498,296 MaskImage may1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "jun" jun1=LoadImage("june.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage jun1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 junsel$=Input() If junsel$=1 DrawBlock pic,0,0 DrawImage jun1,498,296 MaskImage jun1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "jul" jul1=LoadImage("july.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage jul1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 julsel$=Input() If julsel$=1 DrawBlock pic,0,0 DrawImage jul1,498,296 MaskImage jul1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "aug" aug1=LoadImage("aug.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage aug1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 augsel$=Input() If augsel$=1 DrawBlock pic,0,0 DrawImage aug1,498,296 MaskImage aug1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "sep" sep1=LoadImage("sep.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage sep1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 sepsel$=Input() If sepsel$=1 DrawBlock pic,0,0 DrawImage sep1,498,296 MaskImage sep1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "oct" oct1=LoadImage("oct.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage oct1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 octsel$=Input() If octsel$=1 DrawBlock pic,0,0 DrawImage oct1,498,296 MaskImage oct1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "nov" nov1=LoadImage("nov.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage nov1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 novsel$=Input() If novsel$=1 DrawBlock pic,0,0 DrawImage nov1,498,296 MaskImage nov1,0,0,0 EndIf EndIf If Left$(Lower$(month),3) = "dec" dec1=LoadImage("DEC.bmp") Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage dec1,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 decsel$=Input() If decsel$=1 DrawBlock pic,0,0 DrawImage dec1,498,296 MaskImage dec1,0,0,0 EndIf EndIf savescreenshot() Delay 500 Locate 0,0 Print"Thankyou the calander is now" Print"waiting For you in the output folder!" Print"Please press any key to end this program" WaitKey End |
| ||
?? |
| ||
There's a lot of pictures to be included here....... |
| ||
I know but I wondered if any one would like to look at the code I jsut wanted to show it. |
| ||
Hi Agamer... I guess you are looking for constructive critism? Looks like you have a feel for the basic logic, but you need to optimize more. There is ALOT of redundant code in your program. For instance, you use the same large chunk of code for inputing and showing each month. You could use one small routine that will load any month. I typed this up, didn't run it because of the image requirement but it shows how duplicate code can be avoided: AppTitle"calander maker" Graphics 800,600 HidePointer Print"welcome to the calander maker!" Print Print"Please now put you calander" Print"image into the Input folder" Print"It must be 800*600 pixels wide" Print ;input of image name! Print"Please type in the file name" Print"remember it must be a .bmp" image$=Input() pic=LoadImage("input/" + image$ + ".bmp") Cls Locate 0,0 ;Date/month selection loop------------------------------------------------------- Repeat Print"Please input the month" month$=Input() gfxMonth=LoadImage (Left$(Lower$(month),3)+".bmp") ; All your *.bmps named "jan.bmp", "feb.bmp" etc... Print "please choose which calander you want" Print "remember choose one which will stand out well" Print "press any key to preview" WaitKey() Cls DrawImage gfxMonth,0,0 MaskImage gfxMonth,0,0,0 Text 0,170,"1!" Text 0,190,"please select a calander by typing the number below the calander" Locate 0,200 monthsel$=Input() If monthsel$=1 DrawBlock pic,0,0 DrawImage gfxMonth,498,296 MaskImage gfxMonth,0,0,0 EndIf savescreenshot() FreeImage gfxMonth gfxMonth=0 currentmonth=currentmonth+1 Until currentmonth=13 ;------------------------------------------------------------------------------- Delay 500 Locate 0,0 Print Print"Thankyou the calander is now" Print"waiting For you in the output folder!" Print"Please press any key to end this program" WaitKey End ;[ Func: SaveScreenShot() ]################################################################# Function SaveScreenshot() iFileNumber% = 0 Repeat iFileNumber = iFileNumber + 1 sFileName$ = "output/screenshot" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp" Until Not(FileType(sFileName)) SaveBuffer FrontBuffer(), sFileName End Function Cheers |
| ||
Yeh I thought off dong this but Well I don't know why I Didin't! |