Explorar el Código

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

Dexter89 hace 12 años
padre
commit
6442837774

+ 2 - 0
engine/Config.h.in

@@ -35,6 +35,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 #cmakedefine CROWN_DEVELOPMENT
 #cmakedefine CROWN_RELEASE
 
+#define CE_PIXELS_PER_METER					32
+
 #define CE_MAX_TEXTURE_UNITS				8
 #define CE_MAX_TEXTURES						32
 #define CE_MAX_RENDER_TARGETS				32

+ 1 - 1
engine/core/json/JSONParser.cpp

@@ -271,7 +271,7 @@ void JSONElement::to_keys(Vector<DynamicString>& keys) const
 	Map<DynamicString, const char*> object(default_allocator());
 	json::parse_object(m_at, object);
 
-	const typename Map<DynamicString, const char*>::Node* it = map::begin(object);
+	const Map<DynamicString, const char*>::Node* it = map::begin(object);
 	while (it != map::end(object))
 	{
 		vector::push_back(keys, (*it).key);

+ 3 - 4
engine/resource/SpriteResource.cpp

@@ -34,6 +34,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "SpriteResource.h"
 #include "StringUtils.h"
 #include "Array.h"
+#include "Config.h"
 
 namespace crown
 {
@@ -116,11 +117,9 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		const float u1 = fd.x0 + fd.x1;
 		const float v1 = fd.y0 + fd.y1;
 
-		const float aspect = (fd.x1 * width) / (fd.y1 * height);
-
 		// Compute positions
-		const float w = aspect;
-		const float h = 1;
+		const float w = (fd.x1 - fd.x0) * (width / CE_PIXELS_PER_METER);
+		const float h = (fd.y1 - fd.y0) * (height / CE_PIXELS_PER_METER);
 
 		const float x0 = fd.scale_x * (-w * 0.5) + fd.offset_x;
 		const float y0 = fd.scale_y * (-h * 0.5) + fd.offset_y;

+ 2 - 0
utils/crown-android.rb

@@ -37,6 +37,8 @@ $config_h =
 #define PRIi64 \"lli\"
 #define PRIx64 \"llx\"
 
+#define CE_PIXELS_PER_METER					32
+
 #define CE_MAX_TEXTURE_UNITS				8
 #define CE_MAX_TEXTURES						32
 #define CE_MAX_RENDER_TARGETS				32