Jump to content

Recommended Posts

Posted

Just wondering if this problem's as tricky as I was making it earlier today (and yes, I did solve it...* I'm not trying to get you to do my work for me or anything, just curious how others go about solving it):

 

A background image in {insert 2D-graphics based video game console} is stored as a list of tiles, each tile an 8x8 square of pixels and arranged such that each tile's indices progress from left-to-right and top-to-bottom as in reading order.* These tiles are all appended to each other in a 1-dimensional array, which would result in the array being arranged like so (if you had four 2x2 tiles):

+---+---+---+---+

| 0 | 1 | 4 | 5 |

+---+---+---+---+

| 2 | 3 | 6 | 7 |

+---+---+---+---+

| 8 | 9 | 12| 13|

+---+---+---+---+

| 10| 11| 14| 15|

+---+---+---+---+

 

The index shown is the index that would correspond to that pixel in the tile data array.* The red lines indicate the borders between tiles.

 

The problem I was working on today:

 

Transform an 8-bit 512x512 bitmap to this tile format.* Since each tile is 8x8 pixels, this gives you 64x64=4096 tiles and a total of 262144 pixels.

 

Given:

 

unsigned char bitmap[262144]; //existing bitmap is stored here, retrieved from file or something

unsigned char tilemap_Tiles[262144]; //tile data is to be copied into this array

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...