functions by Anonymous Coder6th Aug 2004 18:15
|
---|
Summary functions,some useful,some useless,some working,some not really some taken from examples, some made it up, have some more,need some inprovement, there is always space for improveme Description dear programmers Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com global sinwave# global maxx global maxy global halfx global halfy maxx=screen width() maxy=screen height() halfx=maxx/2 halfy=maxy/2 function load_file(filename$,extension$,filenumber) if (extension$="mp3") then:load music filename$+"."+extension$,filenumber if (extension$="wav") then:load sound filename$+"."+extension$,filenumber if (extension$="avi") then:load animation filename$+"."+extension$,filenumber if (extension$="wmv") then:load animation filename$+"."+extension$,filenumber endfunction function play_file(filename$,extension$,filenumber,x1,y1,x2,y2) if (extension$="mp3") then:play music filenumber if (extension$="wav") then:play sound filenumber if (extension$="avi") then:play animation filenumber,x1,y1,x2,y2 if (extension$="wmv") then:play animation filenumber,x1,y1,x2,y2 endfunction function unload_file(filename$,extension$,filenumber) if (extension$="mp3") then:delete music filenumber if (extension$="wav") then:delete sound filenumber if (extension$="avi") then:delete animation filenumber if (extension$="wmv") then:delete animation filenumber endfunction function music_player_status() do tracks_number=GET NUMBER OF CD TRACKS() print_xy_int(0,60,tracks_number) if (1=MUSIC PAUSED(Music_Number)) then: print_xy(0,0,"Music is Paused") if (1=MUSIC PLAYING(Music_Number))then: print_xy(0,0, "Music is Playing") print_xy(0,15, "Music Speed: ") print_xy_int(40,15,MUSIC SPEED(Music_Number)) print_xy(0,30, "Music Volume: ") print_xy_int(40,30,MUSIC VOLUME(Music_Number)) if (1=MUSIC EXIST(Music_Number)) then:print_xy(0,45, "Music Exist") if (0=MUSIC EXIST(Music_Number)) then:print_xy(0,45,"Music Doesn't Exist") loop endfunction function make_directory(directory_name$) make directory directory_name$ endfunction function delete_directory(directory_name$) delete directory directory_name$ endfunction function make_file(file_name$) make file file_name$ endfunction function delete_file(file_name$) delete file file_name$ endfunction function set_working_directory(path$) SET DIR Path$ endfunction function move_file(Source_Filename$,Destination_Filename$) MOVE FILE Source_Filename$,Destination_Filename$ endfunction function copy_file(Source_Filename$,Destination_Filename$) copy FILE Source_Filename$,Destination_Filename$ endfunction function light_commands(fog$,fog_color,fog_distance,ambient_light_Percentage) if (fog$="on") then: fog on Fog color fog_color fog distance fog_distance SET AMBIENT LIGHT ambient_light_Persentage endfunction function deactivation_keys(escape_key_active$,system_keys_active$) if (escape_key_active$="no") then: disable escapekey if (system_keys_active$="no") then: disable systemkeys if (escape_key_active$="yes") then: enable escapekey if (system_keys_active$="yes") then: enable systemkeys endfunction function system_memory_available() tmem=SYSTEM TMEM AVAILABLE() dmem=SYSTEM DMEM AVAILABLE() smem=SYSTEM SMEM AVAILABLE() print "Total memory available: ",tmem/10^6," Mbyte" print "Total video memory available: ",dmem/10^6," Mbyte" print "Total system memory available: ",smem/10^6," Mbyte" endfunction function show_mouse_cordinates() do print_xy_int2(mousex(),mousey(),mousex(),mousey()) loop endfunction function screen_resolution() print "Max application resolution" print screen width() print screen height() endfunction function cut_display(x_rooms,y_rooms) endfunction function scan_keys() do cls integer_key_value=scancode() integer_key_hold=keystate(integer_key_value) print_xy_int(0,0,integer_key_value) print_xy_int(0,10,integer_key_hold) rem print rem Return Integer=KEYSTATE(Scancode) loop endfunction function arrow_keys() do if (1=upkey()) then:print "up" if (1=downkey())then:print "down" if (1=leftkey())then:print "left" if (1=rightkey())then:print "right" if (1=controlkey()) then:print "control key" if (1=shiftkey())then:print "shift key" if (1=returnkey())then:print "return key" if (1=spacekey())then:print "space key" rem if (1=escapekey())then: print "escape key.": print "about to exit.." : wait 1500: print "press any key...": wait key: exit loop endfunction FUNCTION print_XY(x,y,message$) SET CURSOR x,y PRINT message$ ENDFUNCTION FUNCTION print_XY_int(x,y,integer_) SET CURSOR x,y PRINT integer_ ENDFUNCTION FUNCTION print_XY_int2(x,y,integer_x,integer_y) cls SET CURSOR x,y print integer_x SET CURSOR x,y+15 print integer_y ENDFUNCTION function join_array(array1$,array2$,connector$) array3$=array1$+connector$+array2$ endfunction array3$ function colors() rem cls rem INK Foreground Color,Background Color green_value=0 blue_value=0 x=0 y=0 rem do rem red_value=red_value+1 rem INK rgb(0,0,0),rgb(red_value,green_value,blue_value) rem CLS rem if red_value>255 then: red_value=0 REM IF (WAIT KEY) THEN: EXIT rem loop endfunction function game_graphic_settings() sync on : sync rate 60 : backdrop off : hide mouse if check display mode(1024,768,32)=1 then set display mode 1024,768,32 endfunction function accelerator3d_features(light_mapping,Obj_No,Img_No) rem if (light_mapping="on") then:SET LIGHT MAPPING ON Obj_No,Img_No endfunction function fast_sync(status$) if status$="on" then: fastsync if status$="off" then: sync off if status$="normal" then: sync endfunction function show_image(file_name$,image_path$) if (image_path$="yes") then:file_path$=get dir$():image_path$="images":full_path$=join_array(file_path$,image_path$,"\"):full_path$=join_array(full_path$,file_name$,"\") if (image_path$="no") then:file_path$=get dir$():full_path$=join_array(file_path$,file_name$,"\") rem load image full_path$,1 rem paste image 0,0,1 rem print full_path$ wait key endfunction function mouse_relocate(x,y) POSITION MOUSE x,y endfunction function mouse_features(vinsible$,cursor) if (vinsible$="off") then:hide mouse if (vinsible$="on") then: show mouse change mouse cursor endfunction function screen_refreshing(sync_status$,sync_rate) rem sync rate 0 program refresh as fast as the system will allow if (sync_status$="on") then :sync on if (sync_status$="off") then: sync off if (sync_rate=0) then: sync rate 0 if ((sync_rate not 0) and (sync_rate<=1000)) then : sync rate sync_rate endfunction function prettybackdrop() yy=0 red=rgb(128+(cos(sinwave#)*127),0,0) green=rgb(0,128-(sin(sinwave#)*127),0) for y=0 to 49 col=1-col ys=10 if col=0 then box 0,yy,640,yy+ys,green,red,green,red if col=1 then box 0,yy,640,yy+ys,red,green,red,green yy=yy+ys next y endfunction function text_font_size_style_transparent(font$,text_size,style$,transparent$) if (font$="book") then: set text font "book" set text size text_size if (style$="bold")then: set text to bold if (transparent$="ON") then: set text transparent endfunction function frames_per_second() text 20,screen height()-40,desc$ fps$="DBPro Fps: "+str$(screen fps()) text screen width()-20-text width(fps$),screen height()-40,fps$ endfunction |