problem mit scroll geschwindigkeit im sprite editor

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Mathias-Kwiatkowski

Betreff: problem mit scroll geschwindigkeit im sprite editor

BeitragMi, Sep 28, 2005 21:18
Antworten mit Zitat
Benutzer-Profile anzeigen
hi leute, nun wo ich weiss wie man eine scroll function macht, wollte ich einen sprite bzw, tile editor machen, nähere infos http://purechannel.ath.cx

nur mein problem lautet nu das alles etwas langsam läuft seht selber


Code: [AUSKLAPPEN]

Graphics 640,480,32,1
karte$ = WriteFile("leer.SPR")
Dim map(255,255)
tile=0

For x = 0 To 127
For y = 0 To 127
WriteLine(karte$,0)
WriteInt(karte$,map(x,y))
Next
Next
CloseFile(karte$)

karte$ = ReadFile("leer.SPR")
For x = 0 To 127
For y = 0 To 127
tile = ReadLine(karte$)
map(x,y) = ReadInt(karte$)
Next
Next
CloseFile(karte$)


maus=CreateImage (20,20)
Color 255,0,128
Rect 0,0,20,20
Color 255,255,255
Line 0,10,20,10
Line 10,0,10,20
GrabImage maus,0,0
MaskImage maus,255,0,128








Repeat
SetBuffer BackBuffer()
Cls
If KeyDown(1) Then End


For y = 0 To 127
For x = 0 To 127
If map(x,y)=0 Then Color 0,0,255
If map(x,y)=1 Then Color 255,0,0


Rect  x*10-scrollx,y*10-scrolly,9,9
Next
Next

mx=MouseX()
my=MouseY()



;der ganze scroll scheiss
If KeyDown ( 205 ) Then scrollx=scrollx+10
If KeyDown ( 203 ) Then scrollx=scrollx-10
If scrollx=<0 Then scrollx=0
If scrollx=>1280-1024+704+10 Then scrollx=1280-1024+704+10
If KeyDown ( 200 ) Then scrolly=scrolly-10
If KeyDown ( 208 ) Then scrolly=scrolly+10
If scrolly=<0 Then scrolly=0
If scrolly=>1280-768+448+10 Then scrolly=1280-768+448+10






;rahmen (weiss)
Color 0,0,0
Rect 321,0,1024,768
Rect 0,321,1024,768
Color 255,255,255

For x=0 To 320 Step 10
Line x,0,x,320
Next
For x=0 To 320 Step 10
Line 0,x,320,x
Next



;malt die miniatur ansicht
Color 255,255,255
Text 400,15,"Miniaturansicht"
If Not MouseDown(1) Or KeyDown(205) Or KeyDown(203) Or KeyDown(200) Or KeyDown(208)Then
For x = 400 To 400+126
For y = 30 To 30+126
If map(x-399,y-29)=0 Then Color 0,0,255
If map(x-399,y-29)=1 Then Color 255,0,0
Plot x,y
Next
Next
EndIf



If MouseDown(1) Then

If mx=>320 Then Goto nicht
If my=>320 Then Goto nicht
For xb=1 To 4064 Step 10
For yb=1 To 4064 Step 10
If xb=>mx+scrollx And xb=<mx+9+scrollx And yb=>my+scrolly And yb=<my+9+scrolly Then
If auswahl=0 Then map(xb/10,yb/10) =1
map(xb/10,yb/10) =1
EndIf
Next
Next
.nicht
EndIf

DrawImage  maus,mx,my
Flip
Forever


wie bekomm ichs schneller=?

[/syntax]

Spikespine

BeitragMi, Sep 28, 2005 21:22
Antworten mit Zitat
Benutzer-Profile anzeigen
1. SetBuffer BackBuffer() vor der Schleife
2. Line ersetzen mit Rect
3. Plot ersetzen mit WritepixelFast
Athlon 64 3700+ | 1024 MB RAM | GeForce 7900 GT | Blitz2D, Blitz3D, BlitzPlus, BlitzMax

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group