Skip to content

Commit

Permalink
I still have no idea why the RasterWindow has no
Browse files Browse the repository at this point in the history
output...
  • Loading branch information
ZILtoid1991 committed Oct 18, 2019
1 parent d28c3cf commit e17a6dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions pixelperfecteditor/src/PixelPerfectEditor/editorEvents.d
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ public class CreateTileLayerEvent : UndoableEvent {
if (tilesheet.length == 0) throw new Exception("No tiles were imported!");
target.addTileSet(nextLayer, tilesheet);
target.mainDoc.addTileSourceFile(nextLayer, res);
/+debug {
TileLayer tl = cast(TileLayer)target;
writeln(tl.displayList);
}+/
//writeln(tilesheet.length);
//generate default names for the tiles
{
Expand Down
30 changes: 21 additions & 9 deletions pixelperfectengine/src/PixelPerfectEngine/graphics/layers.d
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ public interface ITileLayer{
@nogc public int getTY() pure;
/// Adds a tile.
public void addTile(ABitmap tile, wchar id);
/// Returns the tile.
public ABitmap getTile(wchar id);
}
/**
* Universal Mapping element, that is stored on 32 bit.
Expand Down Expand Up @@ -270,15 +272,19 @@ public class TileLayer : Layer, ITileLayer{
totalY=mY*tileY;
}
///Adds a tile to the tileSet. t : The tile. id : The ID in wchar to differentiate between different tiles.
public void addTile(ABitmap tile, wchar id){
if(tile.width==tileX && tile.height==tileY){
displayList[id]=DisplayListItem(id, tile);
public void addTile(ABitmap tile, wchar id) {
if(tile.width==tileX && tile.height==tileY) {
displayList[id] = DisplayListItem(id, tile);
}else{
throw new TileFormatException("Incorrect tile size!", __FILE__, __LINE__, null);
}
}
///Returns a tile from the displaylist
public ABitmap getTile(wchar id) {
return displayList[id].tile;
}
///Removes the tile with the ID from the set.
public void removeTile(wchar id){
public void removeTile(wchar id) {
displayList.remove(id);
}
///Returns which tile is at the given pixel
Expand Down Expand Up @@ -409,12 +415,14 @@ public class TileLayer : Layer, ITileLayer{
*/
public class TransformableTileLayer(BMPType = Bitmap16Bit, int TileX = 8, int TileY = 8) : Layer, ITileLayer{
/*if(isPowerOf2(TileX) && isPowerOf2(TileY))*/
protected struct DisplayListItem{
void* pixelSrc; ///Used for quicker access to the Data
wchar ID; ///ID, mainly used as a padding
ushort reserved; ///Padding for 32 bit
this(wchar ID, BMPType tile){
protected struct DisplayListItem {
BMPType tile; ///For reference counting
void* pixelSrc; ///Used for quicker access to the Data
wchar ID; ///ID, mainly used as a padding
ushort reserved; ///Padding for 32 bit
this (wchar ID, BMPType tile) {
this.ID = ID;
this.tile = tile;
pixelSrc = cast(void*)tile.getPtr();
}
}
Expand Down Expand Up @@ -818,6 +826,10 @@ public class TransformableTileLayer(BMPType = Bitmap16Bit, int TileX = 8, int Ti
throw new TileFormatException("Incorrect tile size!", __FILE__, __LINE__, null);
}
}
///Returns a tile from the displaylist
public ABitmap getTile(wchar id) {
return displayList[id].tile;
}
///Removes the tile with the ID from the set.
public void removeTile(wchar id){
displayList.remove(id);
Expand Down

0 comments on commit e17a6dd

Please sign in to comment.