The map that will be visible on the screen I want to be 640x480 with 16x16 tiles, which totals to 1200 tiles per screen. So what I ultimately want is to be able to draw these 1200 tiles onto an SDL_Surface that I can resize to fit the screen. Now the problem isn't necessarily that I can't resize it or any of the math involved, it's reading from a file that's giving me trouble. I'm finding it very difficult to figure out how to read from a file and find where the tag [MapLayer] or [SpriteLayer] might be then reading all the tile numbers into an array, which being that I'm used to C#'s XNA, I would normally use a multidimensional array.

I've looked at input\output tutorials, but it's hard to make sense of it for what I'm trying to do. This is along the lines of what I want to do in simple terms:

Open File "mapname.map"
Read and find the string "[MapLayer]"
If string doesn't exist, close and quit.
Go to next line and read the numbers and put them into an array and get the length of how many tiles were counted and put into the array.
Continue reading the next lines and putting them into an array until there is no more tiles, and if they are a different length than the first, cancel and close the file.
Find if there is a string "[SpriteLayer]" and repeat the process of the [MapLayer], only this time, the tiles represent sprites.
Close the file.
Use array(s) to draw tiles relative to a "Camera's" position.

If someone could give me some guidance or a C based tutorial on how to do this, it'd be very appreciated.

Just for some clarification, right now I'm running on Mac OS X 10.6 with XCode 3.2.6(If you're making some kind of a WTF face right now, I made that same one when I had to switch back to this Mac after having some problems with my PC)

Okay, I eventually decided to forget it and move back to C++. I've got a tile engine going and I'm working on a small remake of the Legend of Zelda A Link to the Past game for SNES for learning purposes.

The first part you may notice about my code just so you're not asking "why" is that when I draw a level I'm using the original resolution of 256x224 (224 tiles per screen) to make it look like the original game. Also, there's not much error checking because I know where everything is right now and I'll rewrite it with more error checking later once I have the actual TIleEngine up and running.

Okay here's my problem, I have a 1440 x 900 screen. All my tiles (so far) are 16x16 (later I'll add 32x32). What I'm doing right now is drawing 224 tiles per screen 16 tiles per line, and 14 lines. The problem I'm facing is that it's drawing at a resolution of 256 x 224 on a 1440 x 900 screen. What I want to do is re-size what's being drawn to the screen to the SCREENWIDTH and SCREENHEIGHT integers. The best case scenario would be to re-size the individual tiles using a scale factor based on the screen width and height. I'm finding that to be extremely difficult to do with the way this is set up. (I'm now following the LazyFoo SDL tutorial for a TileEngine)

Right now I have it working, but the way it's setup collision detection would be impossible once I add in a character or an enemy, or whatever. What I do right now is take the tiles blit them to the screen once have an SDL_Surface copy the contents of the screen clipping the width and the height then re-sizing that surface and blit it to the screen. It also seems to take up quite a bit of the CPU as well. Alright now that I've done all the explaining here's the actual code:

Right now I would say that the most important part is the drawing code and the clipping code.

What's the best way I can re-size the tiles based on a scale factor that is calculated based on a comparison of the projected screen width and height (256x224) to the actual screen (1440x900 or whatever the case may be).