Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/04/2013, 12:19
martin0290
 
Fecha de Ingreso: octubre-2009
Mensajes: 84
Antigüedad: 14 años, 6 meses
Puntos: 0
Pregunta [C++] Como retornar arreglo bidimencional?

Buenass, ando necesitando ayuda para terminar una función. Mi problema pasa por retornar un arreglo bidimencional.

Les dejo el código para que me entiendan:

Código:
void Maps::cargarMapa (SDL_Surface *Pantalla, SDL_Surface *Tiles, int x, int y) {

	static int mapa [FILAS_MAPA][COLUMNAS_MAPA] = {
		0,0,12,12,12,12,12,12,12,12,0,0,
		0,0,24,24,24,24,24,24,24,24,0,0,
		0,0,12,12,12,12,12,12,12,12,0,0,
		0,0,24,24,24,24,24,24,24,24,0,0,
		0,25,25,25,25,25,25,25,25,25,25,0,
		0,36,48,48,48,48,48,48,48,48,36,0,
		0,0,36,48,48,48,48,48,48,36,0,0,
		0,0,0,36,48,48,48,48,36,0,0,0,
		0,0,0,0,36,48,48,36,0,0,0,0,
		0,0,0,0,0,37,37,0,0,0,0,0
};

		int i;
		int j;
		int fila = y / ALTO_TILE;
		int columna = x / ANCHO_TILE;

		for (i = 0; i < FILAS_MAPA; i++) {		  // Largo
			for (j = 0; j < COLUMNAS_MAPA; j++) { // Ancho
				imprimirMapa (
					Pantalla, Tiles, 
					mapa [fila + i] [columna + j],
					j*ANCHO_TILE, i*ALTO_TILE
					);
			}
		}


}
Necesito retornar mapa, intente con punteros pero no hubo caso o lo hice mal y eso que trate de varias maneras u.u.

---> Esto es para un juego, la matriz la necesito para detectar colisiones.

Saludos y espero que me puedan ayudar!