diff --git a/Code/Dokumentation/LevelLoader.uxf b/Code/Dokumentation/LevelLoader.uxf index 723857bb..6cfb9c29 100644 --- a/Code/Dokumentation/LevelLoader.uxf +++ b/Code/Dokumentation/LevelLoader.uxf @@ -1,61 +1,6 @@ 8 - - com.umlet.element.Package - - 552 - 320 - 584 - 368 - - LevelLoader - - - - com.umlet.element.Class - - 440 - 88 - 128 - 40 - - GameLogic -<<Erik>> - - - - com.umlet.element.Relation - - 768 - 472 - 136 - 104 - - lt=<<<<- - 120;24;120;88;24;88 - - - com.umlet.element.Class - - 560 - 544 - 232 - 136 - - <<Interface>> -Parser --- -Functions: -vector<struct> Parse(); -- -Privates: -enum headerType; -const int FileHeaderSize; -const int FileVersion; - - - com.umlet.element.Class @@ -71,85 +16,39 @@ const int FileVersion; com.umlet.element.Relation - 640 + 840 208 - 40 + 88 168 - lt=<<. - 24;24;24;152 - - - com.umlet.element.Relation - - 384 - 176 - 256 - 56 - - lt=->>>> -m1=1..1 -m2=1..1 -<Knows about - 240;40;24;40 - - - com.umlet.element.Package - - 248 - 320 - 248 - 160 - - Defines - + lt=. +<Uses + 24;24;24;64;72;64;72;152 com.umlet.element.Class - 800 - 360 - 208 - 136 + 928 + 560 + 200 + 120 - <<Interface>> -Loader + Collection of functions +<<lots of functions>> -- -Functions: -wchar* LoadFile(string fileName); -Model* LoadModel(string modelName); -Model* LoadModel(int modelID); -- -Privates: +functions for creating the right structs com.umlet.element.Class - 328 - 208 - 80 - 24 + 440 + 88 + 128 + 40 - Defines - - - - com.umlet.element.Class - - 256 - 360 - 232 - 104 - - Defines.h -<<Header file>> --- -Enum ObjectType(static, dynamic, specials); -. -Struct static; -Struct dynamic; -Struct specials + GameLogic +<<Erik>> @@ -169,28 +68,32 @@ Uses> com.umlet.element.Class - 816 - 192 - 128 - 40 + 800 + 360 + 208 + 136 - Resource Loader -<<Dennis>><<Singleton> + <<Interface>> +Loader +-- +Functions: +wchar* LoadFile(string fileName); +//Model* LoadHitBoxes(string modelName); +//Model* LoadHitBoxes(int modelID); +- +Privates: - com.umlet.element.Class + com.umlet.element.Relation - 928 - 560 - 200 - 120 + 344 + 208 + 40 + 168 - Collection of functions -<<lots of functions>> --- -functions for creating the right structs - + lt=<<. + 24;24;24;152 com.umlet.element.Relation @@ -206,6 +109,61 @@ m2=1..1 Uses> 24;40;160;40 + + com.umlet.element.Class + + 816 + 192 + 128 + 40 + + Resource Loader +<<Dennis>><<Singleton> + + + + com.umlet.element.Relation + + 768 + 472 + 136 + 104 + + lt=<<<<- + 120;24;120;88;24;88 + + + com.umlet.element.Relation + + 384 + 176 + 256 + 56 + + lt=->>>> +m1=1..1 +m2=1..1 +<Knows about + 240;40;24;40 + + + com.umlet.element.Class + + 256 + 360 + 232 + 104 + + Defines.h +<<Header file>> +-- +Enum ObjectType(static, dynamic, specials); +. +Struct static; +Struct dynamic; +Struct specials + + com.umlet.element.Class @@ -229,7 +187,7 @@ Privates: com.umlet.element.Relation - 344 + 640 208 40 168 @@ -238,27 +196,26 @@ Privates: 24;24;24;152 - com.umlet.element.Relation + com.umlet.element.Class - 840 + 328 208 - 88 - 168 + 80 + 24 - lt=. -<Uses - 24;24;24;64;72;64;72;152 + Defines + - com.umlet.element.Relation + com.umlet.element.Package - 656 - 472 - 40 - 88 + 248 + 320 + 248 + 160 - lt=<<<<- - 24;72;24;24 + Defines + com.umlet.element.Relation @@ -274,4 +231,47 @@ m2=1..1 Uses> 24;40;80;40;120;40;120;144 + + com.umlet.element.Relation + + 656 + 472 + 40 + 88 + + lt=<<<<- + 24;72;24;24 + + + com.umlet.element.Class + + 560 + 544 + 232 + 136 + + <<Interface>> +Parser +-- +Functions: +vector<struct> Parse(); +- +Privates: +enum headerType; +const int FileHeaderSize; +const int FileVersion; + + + + + com.umlet.element.Package + + 552 + 320 + 584 + 368 + + LevelLoader + + diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 6b66a9d5..bfa96d35 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -184,6 +184,8 @@ + + @@ -202,6 +204,8 @@ + + diff --git a/Code/Game/GameLogic/LevelLoader.cpp b/Code/Game/GameLogic/LevelLoader.cpp new file mode 100644 index 00000000..0e302d37 --- /dev/null +++ b/Code/Game/GameLogic/LevelLoader.cpp @@ -0,0 +1,17 @@ +////////////////////////////////// +// Created by Sam Svensson 2013 // +////////////////////////////////// + +#include "LevelLoader.h" +using namespace GameLogic; +using namespace GameLogic::LevelLoader; + +std::vector LevelLoader::LoadLevel(std::string fileName) +{ + Parser->parse(fileName); +} + +std::vector LevelLoader::LoadLevelHeader(std::string fileName) +{ + parser->parseHeader(fileName); +} \ No newline at end of file diff --git a/Code/Game/GameLogic/LevelLoader.h b/Code/Game/GameLogic/LevelLoader.h new file mode 100644 index 00000000..c33cd09b --- /dev/null +++ b/Code/Game/GameLogic/LevelLoader.h @@ -0,0 +1,29 @@ +////////////////////////////////// +// Created by Sam Svensson 2013 // +////////////////////////////////// + +#ifndef LEVELLOADER_H +#define LEVELLOADER_H + +#include +#include +#include "ObjectDefines.h" +#include "LevelParser.h" + +namespace GameLogic +{ + class LevelLoader + { + + public: + LevelLoader(){this->parser = new Parser()}; + ~LevelLoader(){}; + std::vector LoadLevel(std::string fileName); //loads the level and objects from file + std::vector LoadLevelHeader(std::string fileName); //just for fast access for the meta information about the level. + + private: + LevelParser parser; + }; +} + +#endif \ No newline at end of file diff --git a/Code/Game/GameLogic/Loader.cpp b/Code/Game/GameLogic/Loader.cpp new file mode 100644 index 00000000..3cc68c50 --- /dev/null +++ b/Code/Game/GameLogic/Loader.cpp @@ -0,0 +1,18 @@ +////////////////////////////////// +// Created by Sam Svensson 2013 // +////////////////////////////////// + +#include "Loader.h" + +using namespace GameLogic::LevelLoader; +using namespace Oyster::Resource; +using namespace std; + +char* Loader::LoadFile(std::string fileName) +{ + //convert from string to wstring + std::wstring temp(fileName.begin(), fileName.end()); + + //convert from wstring to wchar then loads the file + return OysterResource::LoadResource(temp.c_str(), Oyster::Resource::ResourceType::ResourceType_Byte_Raw, -1 , false); +} \ No newline at end of file diff --git a/Code/Game/GameLogic/Loader.h b/Code/Game/GameLogic/Loader.h new file mode 100644 index 00000000..0d0a662f --- /dev/null +++ b/Code/Game/GameLogic/Loader.h @@ -0,0 +1,28 @@ +////////////////////////////////// +// Created by Sam Svensson 2013 // +////////////////////////////////// + +#ifndef LOADER_H +#define LOADER_H + +#include "Resource\OysterResource.h" +#include + +namespace GameLogic +{ + namespace LevelLoader + { + class Loader + { + public: + Loader(){}; + ~Loader(){}; + char* LoadFile(std::string fileName); + + //TODO: + //Add functionality to load physicsObjects (hitboxes) + }; + } +} + +#endif; \ No newline at end of file