Grafikbugs
Grafikbugs
Hallo Leute,
ich wollte eigentlich mal an meinem TMX-Loader weiter programmieren.
Es treten aber diverse unerklärliche Grafikbugs auf, die beim laden der TMX-Dateien unter Tiled nicht existieren.
Siehe hier: (Zeltbug)
https://workupload.com/file/FzQSnvGu
ich wollte eigentlich mal an meinem TMX-Loader weiter programmieren.
Es treten aber diverse unerklärliche Grafikbugs auf, die beim laden der TMX-Dateien unter Tiled nicht existieren.
Siehe hier: (Zeltbug)
https://workupload.com/file/FzQSnvGu
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat
Re: Grafikbugs
Mit Debugger komme ich gar nicht so weit.
In DecodeMap() übergibst du eine String-Adresse als Size an AllocateMemory().
In DecodeMap() übergibst du eine String-Adresse als Size an AllocateMemory().
Re: Grafikbugs
Hallo #NULL,
korrigiere es gegen:
korrigiere es gegen:
Code: Alles auswählen
*bmap = AllocateMemory(MemoryStringLength(@bdata))
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat
Re: Grafikbugs
Code: Alles auswählen
*bmap = AllocateMemory(MemorySize(@bdata) * 4)
<edit>Mit MemoryStringLength() geht es auch
Re: Grafikbugs
So! Das war zwar ein uncooler Bug (der bei mir aber funktioniert hat ), aber nicht der eigentliche Fehler.
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat
Re: Grafikbugs
Wenn ich den Screen kleiner machedann verschwinden die Schwarzen bereiche, die Transparenz funktioniert dann und die Tiles zucken auch nicht mehr.
Code: Alles auswählen
OpenWindowedScreen(WindowID(0), 0, 0, 800,600)
Re: Grafikbugs
Das sind wieder andere Umstände und nicht der eigentliche Fehler.dann verschwinden die Schwarzen bereiche, die Transparenz funktioniert dann und die Tiles zucken auch nicht mehr.
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat
Re: Grafikbugs
Ich seh da nicht ganz durch aber hiermit kannst du dir die clipping informationen anzeigen lassen:
(z.b. ist tid in deinem programm eins höher als in tiled angezeigt)
(z.b. ist tid in deinem programm eins höher als in tiled angezeigt)
Code: Alles auswählen
...
Global NewMap m.s()
Procedure DisplayTile(tid, x, y)
If tid > 0
ding=#False
If tid <= (sw / tileset(0)\tileWidth)
calcX = (tid * tileset(0)\tileWidth)-tileset(0)\tileWidth
ClipSprite(0, calcX, 0, tileset(0)\tileWidth, tileset(0)\tileHeight)
ding=#True
EndIf
For q = 2 To (sh / tileset(0)\tileHeight)-1
If tid > (sw / tileset(0)\tileWidth) And tid <= (sw / tileset(0)\tileWidth)*q
tcalc = (sw / tileset(0)\tileWidth) * (q-1)
calcX = ((tid - tcalc) * tileset(0)\tileWidth)-tileset(0)\tileWidth
calcY = tileset(0)\tileHeight * (q-1)
ClipSprite(0, calcX, calcY, tileset(0)\tileWidth, tileset(0)\tileHeight)
Break
EndIf
Next q
DisplayTransparentSprite(0, x, y)
key.s = ""+x+","+y
m(key) = ""
;m(key) + ""+x+","+y+","
m(key) + ""+tid+","
;m(key) + ""+calcX+","+calcY+","
;m(key) + ""+tileset(0)\tileWidth+","+tileset(0)\tileHeight
;m(key) + ""+","+ding
EndIf
EndProcedure
...
ClearScreen($66)
ClearMap(m())
;DrawIsoMap(xmap1, cx, cy)
DrawIsoMap(xmap2, cx, cy)
;DrawIsoMap(xmap3, cx, cy)
StartDrawing(ScreenOutput())
ForEach m()
_x = Val(StringField(MapKey(m()),1,","))
_y = Val(StringField(MapKey(m()),2,","))
DrawText(_x,
_y,
m())
Box(_x,_y,1,1,$ffffffff)
Next
StopDrawing()
Re: Grafikbugs
Das Sprite mit Alphakanal laden:
Und das Clipping geht auch einfacher:
ebeno deine DrawIsoMap(), war irgendwie rückwärts von links gezeichnetMußt dann nur den Startpunkt anpassen:
Das entscheidende war aber #PB_Sprite_AlphaBlending.
Code: Alles auswählen
LoadSprite(0, *tset\image\source, #PB_Sprite_AlphaBlending)
Code: Alles auswählen
Procedure DisplayTile(tid, x, y)
If tid > 0
_x = 64 * ((tid-1) % 16)
_y = 32 * ((tid-1) / 16)
_w = 64
_h = 32
ClipSprite(0, _x, _y, _w, _h)
DisplayTransparentSprite(0, x, y)
EndIf
EndProcedure
Code: Alles auswählen
Procedure DrawIsoMap(level.s, x_start, y_start)
t = 1
For y = 0 To 31
For x = 0 To 31
xpos = x_start + x * 32 - y * 32
ypos = y_start + x * 16 + y * 16
If Val(StringField(level, t, ",")) <> 0
DisplayTile(Val(StringField(level, t, ",")), xpos, ypos)
EndIf
t + 1
Next x
Next y
EndProcedure
Code: Alles auswählen
Global cx = ScreenWidth() / 2
Global cy = 0
Re: Grafikbugs
Autsch!Das Sprite mit Alphakanal laden
Danke!
Betriebssysteme: div. Windows, Linux, Unix - Systeme
no Keyboard, press any key
no mouse, you need a cat
no Keyboard, press any key
no mouse, you need a cat