Editor Running Slow
Blitz3D Forums/Blitz3D Beginners Area/Editor Running Slow
| ||
Problem is this code is running really slow.. if someone could help me please... im only getting 9 fps ;Globals Global FRAMELIMIT = CreateTimer(60) Global Frame%,OneSecond#,StartFrame%,SecondTimerOn,FPS% Global SectTile Global Layer% = 1 Global TileDN# = 0 Global MapX% = 0 Global MapY% = 0 Global ShowAll# = 0 Global XTil = 8 Global YTil = 8 Global WorldTile = LoadAnimImage("gfx/worldtiles.png",8,8,0,1024) MaskImage WorldTile,255,0,255 Dim MapTile(63,63,5) ;Types ;Graphics Setting ;Graphics 640,480,16,1 ;SetBuffer BackBuffer() ;GUI Setup winMain = CreateWindow("Zelda:Scroll of Ages",32,32,640,480,winMain,13) canMap = CreateCanvas(32,16,256,224,winMain) canTile = CreateCanvas(302,16,128,128,winMain) canSect = CreateCanvas(382,160,32,32,winMain) ;Menu Setup mnuFile=CreateMenu("File",1,WindowMenu(winMain)) Global mnuLoad=CreateMenu("Load Map",2,mnuFile) Global mnuSave=CreateMenu("Save Map",3,mnuFile) CreateMenu("",0,mnuFile) Global mnuQuit=CreateMenu("Quit",99,mnuFile) UpdateWindowMenu(winMain) ;Contorls radLay1 = CreateButton("Layer 1",302,160,64,20,winMain,3) radLay2 = CreateButton("Layer 2",302,184,64,20,winMain,3) radLay3 = CreateButton("Layer 3",302,208,64,20,winMain,3) chxLayA = CreateButton("ShowAll",382,208,64,20,winMain,2) ;butTilS = CreateButton("Set Size",446,16,64,20,winMain,1) ;Text Feilds ;txtXTil = CreateTextField(446,48,32,20,winMain) ;SetGadgetText txtXTil,"8" ;txtYTil = CreateTextField(478,48,32,20,winMain) ;SetGadgetText txtYTil,"8" ;Hidden GadGets butTileDN# = CreateButton("",0,0,0,0,winMain,1) HideGadget butTileDN# butTileUP = CreateButton("",0,0,0,0,winMain,1) HideGadget butTileUp butMapUp = CreateButton("",0,0,0,0,winMain,1) HideGadget butMapUp butMapDn = CreateButton("",0,0,0,0,winMain,1) HideGadget butMapDn butMapLt = CreateButton("",0,0,0,0,winMain,1) HideGadget butMapLt butMapRt = CreateButton("",0,0,0,0,winMain,1) HideGadget butMapRt ;HotKeys HotKeyEvent 208,1,$401,0,0,0,0,butTileDN# HotKeyEvent 200,1,$401,0,0,0,0,butTileUP HotKeyEvent 200,0,$401,0,0,0,0,butMapUP HotKeyEvent 208,0,$401,0,0,0,0,butMapDN HotKeyEvent 205,0,$401,0,0,0,0,butMapLT HotKeyEvent 203,0,$401,0,0,0,0,butMapRT SetButtonState radLay1,1 ;MainLoop Repeat id = WaitEvent() If MouseDown(1) And EventSource()=canMap maptile(MapX%+MouseX(canMap)/8,MapY%+MouseY(canMap)/8,Layer%)=SectTile Else If MouseDown(2) And EventSource()=canMap maptile(MapX%+MouseX(canMap)/8,MapY%+MouseY(canMap)/8,Layer%)=0 EndIf Select id Case $201 If EventData()=1 And EventSource()=canTile SectTile = (MouseX(canTile)/8)+((TileDN#+(MouseY(canTile)/8))*16) EndIf Case $401 If EventSource()=radLay1 Then Layer% = 1 If EventSource()=radLay2 Then Layer% = 2 If EventSource()=radLay3 Then Layer% = 3 If EventSource()=chxLayA If ShowAll# = 0 ShowAll# = 1 Else ShowAll# = 0 EndIf EndIf If EventSource()=butTileDN# And TileDN# < 48 Then TileDN# = TileDN# + 2 If EventSource()=butTileUP And TileDN# > 0 Then TileDN# = TileDN# - 2 ;Directions on the Map... If EventSource()=butMapUp If MapY% = 0 Then MapY% = 0 Else MapY%=MapY%-1 ;UpdatePos() EndIf If EventSource()=butMapDn If MapY% = 32 Then MapY% = 32 Else MapY%=MapY%+1 ;UpdatePos() EndIf If EventSource()=butMapLt If MapX% = 32 Then MapX% = 32 Else MapX%=MapX%+1 ;UpdatePos() EndIf If EventSource()=butMapRt If MapX% = 0 Then MapX% = 0 Else MapX%=MapX%-1 ;UpdatePos() EndIf Case $803 If EventSource()=winMain Then Exit ; Press X and Exit Program Case $1001 ; File Menu Stuff If EventData()=2 Then LoadMap(RequestFile$("Load Game","zsm",False)) If EventData()=3 Then SaveMap(RequestFile$("Save Game","zsm",True)) If EventData()=99 Then End End Select SetBuffer CanvasBuffer(canMap) Cls MapRefresh() FlipCanvas canMap SetBuffer CanvasBuffer(canTile) Cls TilePallete() FlipCanvas canTile SetBuffer CanvasBuffer(canSect) Cls DrawImage worldtile,0,0,SectTile FlipCanvas canSect FPS_Counter() WaitTimer(Framelimit) SetStatusText(winMain,"FPS: "+FPS%+"- 60+ Great! 30- Bad!"+", "+"Layer "+Layer%+", "+AvailVidMem ()+", "+TotalVidMem()) Forever FreeImage worldtiles End Function MapRefresh() For x = 0 To 31 For y = 0 To 27 DrawImage worldtile,x*8,y*8,1 Next Next If ShowAll# = 0 For x = MapX% To MapX%+31 For y = MapY% To MapY%+27 DrawImage worldtile,(x-MapX%)*8,(y-MapY%)*8,maptile(x,y,Layer%) Next Next EndIf If ShowAll# = 1 For x = MapX% To MapX%+31 For y = MapY% To MapY%+27 DrawImage worldtile,(x-MapX%)*8,(y-MapY%)*8,maptile(x,y,1) DrawImage worldtile,(x-MapX%)*8,(y-MapY%)*8,maptile(x,y,2) DrawImage worldtile,(x-MapX%)*8,(y-MapY%)*8,maptile(x,y,3) Next Next EndIf End Function Function TilePallete() For y = 0 To 15 For x = 0 To 15 DrawImage worldtile,x*8,y*8,pallete+TileDN#*16 pallete = pallete + 1 Next Next End Function Function FPS_Counter() Frame% = Frame%+1 If SecondTimerOn = False Then OneSecond# = MilliSecs() + 1000 StartFrame% = Frame% SecondTimerOn = True Else If MilliSecs() > OneSecond# Then SecondTimerOn = False FPS% = Frame%-StartFrame% EndIf EndIf End Function Function SaveMap(mapname$) ;If FileType("Maps\Str(loadmapnum)+".til")=0 Then Notify "Map"+Str(loadmapnum)+".map Not found." : Return soaFile=WriteFile(Str(mapname$)) ;WriteString(ffafile,head_title$) ;WriteString(ffafile,head_author$) ;WriteString(ffafile,head_pass$) ;WriteString(ffafile,head_desc$) ;WriteInt soaFile ;For m=1 To totalmapnum For z=0 To 4 For y=0 To 63 For x=0 To 63 WriteInt soaFile,MapTile(x,y,z) ;WriteByte(soaFile,MapSolid(totalmapnum,x,y)) Next Next Next ;Next CloseFile(ffafile) Notify "Saved Map Sucessfully!" End Function Function LoadMap(mapname$) soaFile=OpenFile(Str(mapname$)) ;head_title$=ReadString(ffafile) ;head_author$=ReadString(ffafile) ;head_pass$=ReadString(ffafile) ;head_desc$=ReadString(ffafile) ;totalmapnum=ReadInt(ffafile) ;Notify Str$(totalmapnum) ;For m=1 To totalmapnum For z=0 To 4 For y=0 To 63 For x=0 To 63 MapTile(x,y,z) = ReadInt(soaFile) ;MapSolid(1,x,y) = ReadByte(soaFile) Next Next Next ;Next CloseFile(soaFile) Notify "Opened Map Sucessfully!" End Function |
| ||
HAVEEN'T TRIED IT CUS BY THE LOOKS OF IT ID NEED A TEST MAP....SRRY BOUT THE CAPS... |
| ||
Are you using an Nvidia graphics card? If so you may need to get the latest drivers. There was an issue with DX7 and Nvidia a little while back. |
| ||
no mines a radeon 7000 64mb |