Nebula
Loading...
Searching...
No Matches
levelparser.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
34//------------------------------------------------------------------------------
35#include "core/refcounted.h"
36#include "io/jsonreader.h"
37#include "game/entity.h"
38#include "util/guid.h"
39
40namespace Game
41{
42class World;
43}
44
45namespace BaseGameFeature
46{
47
49{
51public:
55 virtual ~LevelParser();
56
59
61 bool LoadJsonLevel(const Ptr<IO::JsonReader> & reader);
62
63protected:
67 virtual void BeginLoad(){}
69 virtual void AddEntity(Game::Entity entity, Util::Guid const& guid){}
71 virtual void SetName(Game::Entity entity, const Util::String & name){}
73 virtual void CommitEntity(Game::Entity entity) {}
75 virtual void CommitLevel(){}
76
77private:
80};
81
82} // namespace BaseGameFeature
83//------------------------------------------------------------------------------
Base class for level parsing.
Definition levelparser.h:49
virtual void SetName(Game::Entity entity, const Util::String &name)
set entity name
Definition levelparser.h:71
virtual void CommitEntity(Game::Entity entity)
entity loaded completely
Definition levelparser.h:73
virtual void BeginLoad()
called at beginning of load
Definition levelparser.h:67
bool LoadJsonLevel(const Ptr< IO::JsonReader > &reader)
Loads a level from a json file in work:levels.
Definition levelparser.cc:46
Game::Entity LoadEntity(const Ptr< IO::JsonReader > &reader)
parse a single object
Definition levelparser.cc:118
LevelParser()
constructor
Definition levelparser.cc:20
Util::Array< Util::String > invalidAttrs
Definition levelparser.h:78
Game::World * world
Definition levelparser.h:79
virtual void CommitLevel()
parsing done
Definition levelparser.h:75
virtual void AddEntity(Game::Entity entity, Util::Guid const &guid)
add entity
Definition levelparser.h:69
virtual ~LevelParser()
destructor
Definition levelparser.cc:28
void SetWorld(Game::World *world)
Set the world that we want to load the levels into.
Definition levelparser.cc:37
The common base class of Nebula.
Definition refcounted.h:38
Definition world.h:50
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
Implements a GUID.
Definition basegamefeatureunit.cc:23
Game::EditorState.
Definition orientation.h:7
An entity is essentially just an Id with some utility functions attached.
Definition entity.h:35
Nebula's universal string class.
Definition string.h:50