00001
00007 #include "Level.h"
00008
00009 bool Level::load(LevelInfo &lvl, const char *filename) {
00010 char buf[sizeof(LevelInfo)];
00011
00012 lvl.data = NULL;
00013
00014 memset(buf, '\0', sizeof(buf));
00015
00016 FILE *file = fopen(filename, "rb");
00017 if (file == NULL) return false;
00018
00019 fread(&lvl, sizeof(lvl), 1, file);
00020
00021 lvl.data = new unsigned char[lvl.width*lvl.height*3];
00022 fread(lvl.data, sizeof(unsigned char)*lvl.width*lvl.height*3, 1, file);
00023
00024 fclose(file);
00025
00026 return true;
00027 }
00028
00029 bool Level::save(LevelInfo &lvl, const char *filename) {
00030
00031 return false;
00032 }
00033
00034 void Level::unload(LevelInfo &lvl) {
00035 if (lvl.data) {
00036 delete [] lvl.data;
00037 }
00038 }