The primary purpose of the last rewrite was that a lot of code was becoming tangled in an unsavory way. Code for windows controls would have editor and tilemap logic in them. And GUI-agnostic code would try to accommodate too much for GUI features. The source code upload is now at a stage where there is danger of this happening again. Therefore, it would be helpful to discuss what exactly these controls should do, and with that, where the logic for each feature belongs.
Features
Tilemaps
My personal definition of a "tilemap" has changed a lot since developing MushROMs. At its most basic, I should define it simply as a map of tiles. Some examples are given below:
Figure 1: A Palette TileMap
Figure 2: A GFX TileMap
Figure 3: A Map16 TileMap
These are all One-Dimensional tilemaps. Their data is stored in a single array. This may seem confusing since we've all been familiar with all of the above mentioned being 16x16 or 16x8 in almost any experience. However, a single Palette row defined in a rom could be 2 colors, 4, 8, 16, or 256. And legend of zelda, link to the past loads its palettes every 15 colors, ignoring the transparent first color. So there are several exceptions that merit these being 1D tilemaps.
For a 1D tilemap, the main parameter we have is its length, how many tiles it has. In each case, it's 256. Every 16 tiles, the image wraps to the next row. The utility of a 1D tilemap is that if we change the width of the view area, the data will wrap accordingly, as shown in the following examples:
Figure 4: A Palette tilemap with width reduced to 15 tiles
Figure 5: A GFX tilemap with width reduced to 9 tiles
Figure 6: A Map16 TileMap with width increased to 18 tiles
In each case, the data wraps according to the size of the view area. A good example of a 1D tilemap would be a line of text in a text editor that has word wrap turned on.
2D TileMaps
A 2D tilemap is one that has a defined height and width. In this case, change the view area doesn't change the layout. A good example would be a picture in an image editing program, or several lines of text in a text editor with no word wrapping.
In our case, a 2D tilemap would be a level editor (Lunar Magic has an obviously good example of this).
Properties of TileMaps
Properties that 1D and 2D tilemaps share are:
View area
Selected tile relative to view area
Properties that 1D tilemaps have are
The length of tiles
The index of the first viewable tile
The number of tiles viewable in the region (If our view area exceeds the tiles length, or if the first index is high enough, this number can be different from the length of tiles or view area).
Issue
The primary purpose of the last rewrite was that a lot of code was becoming tangled in an unsavory way. Code for windows controls would have editor and tilemap logic in them. And GUI-agnostic code would try to accommodate too much for GUI features. The source code upload is now at a stage where there is danger of this happening again. Therefore, it would be helpful to discuss what exactly these controls should do, and with that, where the logic for each feature belongs.
Features
Tilemaps
My personal definition of a "tilemap" has changed a lot since developing MushROMs. At its most basic, I should define it simply as a map of tiles. Some examples are given below:
Figure 1: A Palette TileMap
Figure 2: A GFX TileMap
Figure 3: A Map16 TileMap
These are all One-Dimensional tilemaps. Their data is stored in a single array. This may seem confusing since we've all been familiar with all of the above mentioned being 16x16 or 16x8 in almost any experience. However, a single Palette row defined in a rom could be 2 colors, 4, 8, 16, or 256. And legend of zelda, link to the past loads its palettes every 15 colors, ignoring the transparent first color. So there are several exceptions that merit these being 1D tilemaps.
For a 1D tilemap, the main parameter we have is its length, how many tiles it has. In each case, it's 256. Every 16 tiles, the image wraps to the next row. The utility of a 1D tilemap is that if we change the width of the view area, the data will wrap accordingly, as shown in the following examples:
Figure 4: A Palette tilemap with width reduced to 15 tiles
Figure 5: A GFX tilemap with width reduced to 9 tiles
Figure 6: A Map16 TileMap with width increased to 18 tiles
In each case, the data wraps according to the size of the view area. A good example of a 1D tilemap would be a line of text in a text editor that has word wrap turned on.
2D TileMaps
A 2D tilemap is one that has a defined height and width. In this case, change the view area doesn't change the layout. A good example would be a picture in an image editing program, or several lines of text in a text editor with no word wrapping.
In our case, a 2D tilemap would be a level editor (Lunar Magic has an obviously good example of this).
Properties of TileMaps
Properties that 1D and 2D tilemaps share are:
Properties that 1D tilemaps have are
The 2D tilemap properties are analagous
Resolution