Tiling Help!

Joined
Mar 9, 2004
Messages
2,860
Reaction score
21
Points
38
Location
Miami FL
Your Mac's Specs
G4 1Ghz OS X 10.4.7
I saw some map application, but it didn't render rightly
 
OP
M

MACnus

Guest
I've have problems with this:
Code:
- (BOOL) draw_tiles
{
   int tile;
   int x,y;
   
   char map[MAP_SIZEY][MAP_SIZEX] = 
	{
		{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
		{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	};

    for (y = 0; y < MAP_SIZEY; y++)
	{
		for (x = 0; x < MAP_SIZEX; x++)
		{   
			glLoadIdentity();
			tile = map[y][x];
			glBindTexture(GL_TEXTURE_2D, texture[tile]);
			glBegin(GL_QUADS);
				glTexCoord2f(0.0f, 0.0f);
					glVertex3f(float(x), float(y), 0.0f);
				glTexCoord2f(1.0f, 0.0f);
					glVertex3f(float(x + 1), float(y), 0.0f);
				glTexCoord2f(1.0f, 1.0f);
					glVertex3f(float(x + 1), float(y + 1), 0.0f);
				glTexCoord2f(0.0f, 1.0f);
					glVertex3f(float(x), float(y + 1), 0.0f);
			glEnd();
		}
	}
	return (1);
}
I get this error
Code:
MapView.m:121: error: parse error before "float"
MapView.m:123: error: parse error before "float"
MapView.m:125: error: parse error before "float"
MapView.m:127: error: parse error before "float"
What do I have to do?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top