Преглед изворни кода

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini пре 10 година
родитељ
комит
b44de57679

+ 1 - 2
src/core/json/json_parser.h

@@ -8,9 +8,8 @@
 #include "types.h"
 #include "container_types.h"
 #include "math_types.h"
-#include "matrix4x4.h"
-#include "quaternion.h"
 #include "macros.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 2 - 2
src/core/string_id.cpp

@@ -3,10 +3,10 @@
  * License: https://github.com/taylor001/crown/blob/master/LICENSE
  */
 
-#include "types.h"
+#include "string_id.h"
 #include "murmur.h"
 #include "string_utils.h"
-#include <inttypes.h>
+#include <inttypes.h> // PRIx64
 
 namespace crown
 {

+ 51 - 0
src/core/string_id.h

@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
+ * License: https://github.com/taylor001/crown/blob/master/LICENSE
+ */
+
+#pragma once
+
+#include "types.h"
+
+namespace crown
+{
+
+struct StringId32
+{
+	uint32_t _id;
+
+	StringId32() : _id(0) {}
+	explicit StringId32(uint32_t idx) : _id(idx) {}
+	explicit StringId32(const char* str);
+	explicit StringId32(const char* str, uint32_t len);
+	StringId32 operator=(StringId32 a) { _id = a._id; return *this; }
+	bool operator==(StringId32 a) const { return _id == a._id; }
+	bool operator!=(StringId32 a) const { return _id != a._id; }
+	bool operator<(StringId32 a) const { return _id < a._id; }
+	uint32_t id() const { return _id; }
+	const char* to_string(char* buf);
+
+	static const uint32_t STRING_LENGTH = 32;
+};
+
+struct StringId64
+{
+	uint64_t _id;
+
+	StringId64() : _id(0) {}
+	explicit StringId64(uint64_t idx) : _id(idx) {}
+	explicit StringId64(const char* str);
+	explicit StringId64(const char* str, uint32_t len);
+	StringId64 operator=(StringId64 a) { _id = a._id; return *this; }
+	bool operator==(StringId64 a) const { return _id == a._id; }
+	bool operator!=(StringId64 a) const { return _id != a._id; }
+	bool operator<(StringId64 a) const { return _id < a._id; }
+	uint64_t id() const { return _id; }
+	const char* to_string(char* buf);
+
+	static const uint32_t STRING_LENGTH = 32;
+};
+
+typedef StringId64 ResourceId;
+
+} // namespace crown

+ 1 - 0
src/core/strings/dynamic_string.h

@@ -10,6 +10,7 @@
 #include "string_utils.h"
 #include "array.h"
 #include "string_utils.h"
+#include "string_id.h"
 #include <algorithm>
 #include <cstring>
 

+ 1 - 41
src/core/types.h

@@ -5,52 +5,12 @@
 
 #pragma once
 
-#include "config.h"
-#include <cstddef>
+#include <stddef.h> // NULL
 #include <stdint.h>
-#include <stdio.h>
 
 namespace crown
 {
 
-struct StringId32
-{
-	uint32_t _id;
-
-	StringId32() : _id(0) {}
-	explicit StringId32(uint32_t idx) : _id(idx) {}
-	explicit StringId32(const char* str);
-	explicit StringId32(const char* str, uint32_t len);
-	StringId32 operator=(StringId32 a) { _id = a._id; return *this; }
-	bool operator==(StringId32 a) const { return _id == a._id; }
-	bool operator!=(StringId32 a) const { return _id != a._id; }
-	bool operator<(StringId32 a) const { return _id < a._id; }
-	uint32_t id() const { return _id; }
-	const char* to_string(char* buf);
-
-	static const uint32_t STRING_LENGTH = 32;
-};
-
-struct StringId64
-{
-	uint64_t _id;
-
-	StringId64() : _id(0) {}
-	explicit StringId64(uint64_t idx) : _id(idx) {}
-	explicit StringId64(const char* str);
-	explicit StringId64(const char* str, uint32_t len);
-	StringId64 operator=(StringId64 a) { _id = a._id; return *this; }
-	bool operator==(StringId64 a) const { return _id == a._id; }
-	bool operator!=(StringId64 a) const { return _id != a._id; }
-	bool operator<(StringId64 a) const { return _id < a._id; }
-	uint64_t id() const { return _id; }
-	const char* to_string(char* buf);
-
-	static const uint32_t STRING_LENGTH = 32;
-};
-
-typedef StringId64 ResourceId;
-
 #define INVALID_ID 65535
 
 struct Id

+ 1 - 0
src/device.h

@@ -16,6 +16,7 @@
 #include "input_types.h"
 #include "device_options.h"
 #include "os_event_queue.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/input/input_manager.h

@@ -5,6 +5,7 @@
 
 #pragma once
 
+#include "config.h"
 #include "types.h"
 #include "input_types.h"
 

+ 1 - 0
src/lua/lua_stack.h

@@ -12,6 +12,7 @@
 #include "matrix4x4.h"
 #include "string_utils.h"
 #include "color4.h"
+#include "string_id.h"
 #include <lua.hpp>
 
 #if CROWN_DEBUG

+ 1 - 0
src/physics/physics_world.h

@@ -5,6 +5,7 @@
 
 #pragma once
 
+#include "config.h"
 #include "id_array.h"
 #include "pool_allocator.h"
 #include "physics_types.h"

+ 1 - 0
src/renderers/shader.h

@@ -10,6 +10,7 @@
 #include "filesystem_types.h"
 #include "memory_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 0
src/resource/font_resource.h

@@ -10,6 +10,7 @@
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/level_resource.h

@@ -10,6 +10,7 @@
 #include "math_types.h"
 #include "resource_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/material_resource.h

@@ -10,6 +10,7 @@
 #include "filesystem_types.h"
 #include "math_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/physics_resource.h

@@ -10,6 +10,7 @@
 #include "filesystem_types.h"
 #include "math_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/resource_loader.h

@@ -11,6 +11,7 @@
 #include "container_types.h"
 #include "mutex.h"
 #include "memory_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/resource_manager.h

@@ -9,6 +9,7 @@
 #include "container_types.h"
 #include "proxy_allocator.h"
 #include "resource_loader.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/resource_package.h

@@ -7,6 +7,7 @@
 
 #include "types.h"
 #include "resource_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/resource_registry.h

@@ -10,6 +10,7 @@
 #include "resource_types.h"
 #include "compiler_types.h"
 #include "filesystem_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/sound_resource.h

@@ -10,6 +10,7 @@
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 
 namespace crown
 {

+ 1 - 0
src/resource/sprite_resource.h

@@ -10,6 +10,7 @@
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "compiler_types.h"
+#include "string_id.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 0
src/world/world.h

@@ -23,6 +23,7 @@
 #include "resource_types.h"
 #include "quaternion.h"
 #include "lua_types.h"
+#include "string_id.h"
 
 namespace crown
 {