map.c (723B)
1 // map tests 2 3 #include <stdio.h> 4 #include "liblashgame/lash_game_standard.h" 5 #include "liblashgame/lash_game_map.h" 6 7 int main() { 8 lash_map_simple_t map; 9 lash_game_coords_t tmpcoords; 10 lash_game_map_index_t tmpidx = 0; 11 unsigned int w = 29; 12 unsigned int h = 21; 13 unsigned int unitsize = 1; 14 15 lash_mapSimpleInit(&map, &w, &h); 16 17 lash_mapSimpleLayerPoke(map.layer_path, 50, 2); 18 lash_mapSimpleLayerPoke(map.layer_path, 80, 44); 19 for (tmpcoords.y=0; tmpcoords.y<h; tmpcoords.y++) { 20 for (tmpcoords.x=0; tmpcoords.x<w; tmpcoords.x++) { 21 lash_cartesianToIndex(&tmpidx, &w, &h, &unitsize, &tmpcoords); 22 printf("%02i ", lash_mapSimpleLayerPeek(map.layer_path, tmpidx)); 23 } 24 printf("\n"); 25 } 26 printf("\n"); 27 return 0; 28 }