Inverted control flow, engine as library

This commit is contained in:
2021-10-04 17:45:18 -04:00
parent e0fdb2d42f
commit bc22dc89af
15 changed files with 387 additions and 136 deletions

View File

@@ -3,6 +3,7 @@
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <ostream>
@@ -21,7 +22,8 @@ enum WorldType {
};
using StringVec = std::vector<std::string>;
using StringMap = std::map<std::string, std::string>;
using StringPair = std::pair<std::string, std::string>;
using LuaSource = std::vector<StringPair>;
using HashValue = std::pair<uint64_t, uint64_t>;
using IdVector = std::vector<int64_t>;
@@ -73,14 +75,8 @@ std::string trim(std::string s);
// Calculate distance between two points
double distance_squared(double x1, double y1, double x2, double y2);
// Read a file as one big string.
std::string get_file_contents(const std::string &path);
// Read a file as a vector of lines.
StringVec get_file_lines(const std::string &path);
// Get a file's fingerprint - ie, size and modification time.
std::string get_file_fingerprint(const std::string &path);
// Read the lua source code from the specified directory.
LuaSource read_lua_source(const std::string &directory);
// An XYZ coordinate, general purpose.
struct XYZ {