Daniele Bartolini %!s(int64=10) %!d(string=hai) anos
pai
achega
2c71f004f2
Modificáronse 100 ficheiros con 1126 adicións e 1113 borrados
  1. 11 11
      src/console_server.cpp
  2. 2 2
      src/console_server.h
  3. 21 21
      src/core/containers/array.h
  4. 26 26
      src/core/containers/container_types.h
  5. 4 4
      src/core/containers/event_stream.h
  6. 44 44
      src/core/containers/hash.h
  7. 44 44
      src/core/containers/map.h
  8. 21 21
      src/core/containers/queue.h
  9. 5 5
      src/core/containers/sort_map.h
  10. 27 27
      src/core/containers/vector.h
  11. 8 8
      src/core/filesystem/apk_file.cpp
  12. 6 6
      src/core/filesystem/apk_file.h
  13. 1 1
      src/core/filesystem/apk_filesystem.cpp
  14. 1 1
      src/core/filesystem/apk_filesystem.h
  15. 6 6
      src/core/filesystem/disk_file.cpp
  16. 6 6
      src/core/filesystem/disk_file.h
  17. 1 1
      src/core/filesystem/disk_filesystem.cpp
  18. 1 1
      src/core/filesystem/disk_filesystem.h
  19. 6 6
      src/core/filesystem/file.h
  20. 1 1
      src/core/filesystem/filesystem.h
  21. 8 8
      src/core/filesystem/null_file.h
  22. 11 11
      src/core/filesystem/os_file.h
  23. 2 2
      src/core/filesystem/path.cpp
  24. 4 4
      src/core/filesystem/reader_writer.h
  25. 2 2
      src/core/integer.h
  26. 7 7
      src/core/json/json.cpp
  27. 5 5
      src/core/json/json.h
  28. 8 8
      src/core/json/sjson.cpp
  29. 5 5
      src/core/json/sjson.h
  30. 14 14
      src/core/math/aabb.h
  31. 26 26
      src/core/math/color4.h
  32. 2 2
      src/core/math/frustum.h
  33. 31 31
      src/core/math/intersection.cpp
  34. 4 4
      src/core/math/intersection.h
  35. 8 6
      src/core/math/math_types.h
  36. 28 28
      src/core/math/math_utils.h
  37. 22 22
      src/core/math/matrix3x3.h
  38. 59 59
      src/core/math/matrix4x4.h
  39. 4 4
      src/core/math/plane.h
  40. 8 8
      src/core/math/quaternion.cpp
  41. 22 22
      src/core/math/quaternion.h
  42. 11 11
      src/core/math/random.h
  43. 13 13
      src/core/math/sphere.h
  44. 16 16
      src/core/math/vector2.h
  45. 16 16
      src/core/math/vector3.h
  46. 16 16
      src/core/math/vector4.h
  47. 5 5
      src/core/memory/allocator.h
  48. 4 4
      src/core/memory/linear_allocator.cpp
  49. 7 7
      src/core/memory/linear_allocator.h
  50. 24 24
      src/core/memory/memory.cpp
  51. 2 2
      src/core/memory/memory.h
  52. 6 6
      src/core/memory/pool_allocator.cpp
  53. 8 8
      src/core/memory/pool_allocator.h
  54. 1 1
      src/core/memory/proxy_allocator.cpp
  55. 3 3
      src/core/memory/proxy_allocator.h
  56. 6 6
      src/core/memory/stack_allocator.cpp
  57. 8 8
      src/core/memory/stack_allocator.h
  58. 5 5
      src/core/memory/temp_allocator.h
  59. 14 14
      src/core/murmur.cpp
  60. 2 2
      src/core/murmur.h
  61. 8 8
      src/core/network/net_address.h
  62. 16 16
      src/core/network/socket.h
  63. 11 11
      src/core/os.h
  64. 29 29
      src/core/os_event_queue.h
  65. 12 12
      src/core/profiler.cpp
  66. 9 9
      src/core/profiler.h
  67. 2 2
      src/core/string_id.cpp
  68. 10 10
      src/core/string_id.h
  69. 10 10
      src/core/strings/dynamic_string.h
  70. 5 5
      src/core/strings/fixed_string.h
  71. 16 16
      src/core/strings/string_stream.h
  72. 7 7
      src/core/strings/string_utils.h
  73. 1 1
      src/core/thread/atomic_int.h
  74. 3 3
      src/core/thread/semaphore.h
  75. 6 6
      src/core/thread/thread.h
  76. 11 0
      src/core/types.h
  77. 24 24
      src/device.cpp
  78. 15 15
      src/device.h
  79. 12 12
      src/device_options.h
  80. 23 23
      src/input/input_device.cpp
  81. 17 17
      src/input/input_device.h
  82. 5 5
      src/input/input_manager.cpp
  83. 2 2
      src/input/input_manager.h
  84. 23 23
      src/lua/lua_api.cpp
  85. 3 3
      src/lua/lua_environment.cpp
  86. 4 4
      src/lua/lua_environment.h
  87. 6 6
      src/lua/lua_stack.cpp
  88. 11 11
      src/lua/lua_stack.h
  89. 4 4
      src/main/display.h
  90. 29 29
      src/main/main_android.cpp
  91. 25 25
      src/main/main_linux.cpp
  92. 33 33
      src/main/main_windows.cpp
  93. 3 3
      src/main/window.h
  94. 7 7
      src/resource/bundle_compiler.cpp
  95. 3 3
      src/resource/bundle_compiler.h
  96. 2 2
      src/resource/compile_options.h
  97. 1 1
      src/resource/config_resource.cpp
  98. 10 10
      src/resource/font_resource.cpp
  99. 13 13
      src/resource/font_resource.h
  100. 6 6
      src/resource/level_resource.cpp

+ 11 - 11
src/console_server.cpp

@@ -21,7 +21,7 @@ ConsoleServer::ConsoleServer(Allocator& a)
 {
 }
 
-void ConsoleServer::init(uint16_t port, bool wait)
+void ConsoleServer::init(u16 port, bool wait)
 {
 	_server.bind(port);
 	_server.listen(5);
@@ -42,7 +42,7 @@ void ConsoleServer::init(uint16_t port, bool wait)
 
 void ConsoleServer::shutdown()
 {
-	for (uint32_t i = 0; i < vector::size(_clients); ++i)
+	for (u32 i = 0; i < vector::size(_clients); ++i)
 		_clients[i].close();
 
 	_server.close();
@@ -50,14 +50,14 @@ void ConsoleServer::shutdown()
 
 void ConsoleServer::send(TCPSocket client, const char* json)
 {
-	uint32_t len = strlen32(json);
+	u32 len = strlen32(json);
 	client.write((const char*)&len, 4);
 	client.write(json, len);
 }
 
 void ConsoleServer::send(const char* json)
 {
-	for (uint32_t i = 0; i < vector::size(_clients); ++i)
+	for (u32 i = 0; i < vector::size(_clients); ++i)
 		send(_clients[i], json);
 }
 
@@ -69,10 +69,10 @@ void ConsoleServer::update()
 		add_client(client);
 
 	TempAllocator256 alloc;
-	Array<uint32_t> to_remove(alloc);
+	Array<u32> to_remove(alloc);
 
 	// Update all clients
-	for (uint32_t i = 0; i < vector::size(_clients); ++i)
+	for (u32 i = 0; i < vector::size(_clients); ++i)
 	{
 		ReadResult rr = update_client(_clients[i]);
 		if (rr.error != ReadResult::NO_ERROR)
@@ -80,10 +80,10 @@ void ConsoleServer::update()
 	}
 
 	// Remove clients
-	for (uint32_t i = 0; i < array::size(to_remove); ++i)
+	for (u32 i = 0; i < array::size(to_remove); ++i)
 	{
-		const uint32_t last = vector::size(_clients) - 1;
-		const uint32_t c = to_remove[i];
+		const u32 last = vector::size(_clients) - 1;
+		const u32 c = to_remove[i];
 
 		_clients[c].close();
 		_clients[c] = _clients[last];
@@ -98,7 +98,7 @@ void ConsoleServer::add_client(TCPSocket socket)
 
 ReadResult ConsoleServer::update_client(TCPSocket client)
 {
-	uint32_t msg_len = 0;
+	u32 msg_len = 0;
 	ReadResult rr = client.read_nonblock(&msg_len, 4);
 
 	// If no data received, return
@@ -195,7 +195,7 @@ namespace console_server_globals
 	char _buffer[sizeof(ConsoleServer)];
 	ConsoleServer* _console = NULL;
 
-	void init(uint16_t port, bool wait)
+	void init(u16 port, bool wait)
 	{
 		_console = new (_buffer) ConsoleServer(default_allocator());
 		_console->init(port, wait);

+ 2 - 2
src/console_server.h

@@ -32,7 +32,7 @@ public:
 
 	/// Listens on the given @a port. If @a wait is true, this function
 	/// blocks until a client is connected.
-	void init(uint16_t port, bool wait);
+	void init(u16 port, bool wait);
 
 	/// Shutdowns the server.
 	void shutdown();
@@ -48,7 +48,7 @@ public:
 namespace console_server_globals
 {
 	// Creates the global console server.
-	void init(uint16_t port, bool wait);
+	void init(u16 port, bool wait);
 
 	/// Destroys the global console server.
 	void shutdown();

+ 21 - 21
src/core/containers/array.h

@@ -22,40 +22,40 @@ namespace array
 	template <typename T> bool empty(const Array<T>& a);
 
 	/// Returns the number of items in the array @a a.
-	template <typename T> uint32_t size(const Array<T>& a);
+	template <typename T> u32 size(const Array<T>& a);
 
 	/// Returns the maximum number of items the array @a a can hold.
-	template <typename T> uint32_t capacity(const Array<T>& a);
+	template <typename T> u32 capacity(const Array<T>& a);
 
 	/// Resizes the array @a a to the given @a size.
 	/// @note
 	/// Old items will be copied to the newly created array.
 	/// If the new capacity is smaller than the previous one, the
 	/// array will be truncated.
-	template <typename T> void resize(Array<T>& a, uint32_t size);
+	template <typename T> void resize(Array<T>& a, u32 size);
 
 	/// Reserves space in the array @a a for at least @a capacity items.
-	template <typename T> void reserve(Array<T>& a, uint32_t capacity);
+	template <typename T> void reserve(Array<T>& a, u32 capacity);
 
 	/// Sets the capacity of array @a a.
-	template <typename T> void set_capacity(Array<T>& a, uint32_t capacity);
+	template <typename T> void set_capacity(Array<T>& a, u32 capacity);
 
 	/// Grows the array @a a to contain at least @a min_capacity items.
-	template <typename T> void grow(Array<T>& a, uint32_t min_capacity);
+	template <typename T> void grow(Array<T>& a, u32 min_capacity);
 
 	/// Condenses the array @a a so that its capacity matches the actual number
 	/// of items in the array.
 	template <typename T> void condense(Array<T>& a);
 
 	/// Appends an item to the array @a a and returns its index.
-	template <typename T> uint32_t push_back(Array<T>& a, const T& item);
+	template <typename T> u32 push_back(Array<T>& a, const T& item);
 
 	/// Removes the last item from the array @a a.
 	template <typename T> void pop_back(Array<T>& a);
 
 	/// Appends @a count @a items to the array @a a and returns the number
 	/// of items in the array after the append operation.
-	template <typename T> uint32_t push(Array<T>& a, const T* items, uint32_t count);
+	template <typename T> u32 push(Array<T>& a, const T* items, u32 count);
 
 	/// Clears the content of the array @a a.
 	/// @note
@@ -83,19 +83,19 @@ namespace array
 	}
 
 	template <typename T>
-	inline uint32_t size(const Array<T>& a)
+	inline u32 size(const Array<T>& a)
 	{
 		return a._size;
 	}
 
 	template <typename T>
-	inline uint32_t capacity(const Array<T>& a)
+	inline u32 capacity(const Array<T>& a)
 	{
 		return a._capacity;
 	}
 
 	template <typename T>
-	inline void resize(Array<T>& a, uint32_t size)
+	inline void resize(Array<T>& a, u32 size)
 	{
 		if (size > a._capacity)
 			set_capacity(a, size);
@@ -104,14 +104,14 @@ namespace array
 	}
 
 	template <typename T>
-	inline void reserve(Array<T>& a, uint32_t capacity)
+	inline void reserve(Array<T>& a, u32 capacity)
 	{
 		if (capacity > a._capacity)
 			grow(a, capacity);
 	}
 
 	template <typename T>
-	inline void set_capacity(Array<T>& a, uint32_t capacity)
+	inline void set_capacity(Array<T>& a, u32 capacity)
 	{
 		if (capacity == a._capacity)
 			return;
@@ -133,9 +133,9 @@ namespace array
 	}
 
 	template <typename T>
-	inline void grow(Array<T>& a, uint32_t min_capacity)
+	inline void grow(Array<T>& a, u32 min_capacity)
 	{
-		uint32_t new_capacity = a._capacity * 2 + 1;
+		u32 new_capacity = a._capacity * 2 + 1;
 
 		if (new_capacity < min_capacity)
 			new_capacity = min_capacity;
@@ -150,7 +150,7 @@ namespace array
 	}
 
 	template <typename T>
-	inline uint32_t push_back(Array<T>& a, const T& item)
+	inline u32 push_back(Array<T>& a, const T& item)
 	{
 		if (a._capacity == a._size)
 			grow(a, 0);
@@ -168,7 +168,7 @@ namespace array
 	}
 
 	template <typename T>
-	inline uint32_t push(Array<T>& a, const T* items, uint32_t count)
+	inline u32 push(Array<T>& a, const T* items, u32 count)
 	{
 		if (a._capacity <= a._size + count)
 			grow(a, a._size + count);
@@ -248,7 +248,7 @@ inline Array<T>::Array(Allocator& a)
 }
 
 template <typename T>
-inline Array<T>::Array(Allocator& a, uint32_t capacity)
+inline Array<T>::Array(Allocator& a, u32 capacity)
 	: _allocator(&a)
 	, _capacity(0)
 	, _size(0)
@@ -274,14 +274,14 @@ inline Array<T>::~Array()
 }
 
 template <typename T>
-inline T& Array<T>::operator[](uint32_t index)
+inline T& Array<T>::operator[](u32 index)
 {
 	CE_ASSERT(index < _size, "Index out of bounds");
 	return _data[index];
 }
 
 template <typename T>
-inline const T& Array<T>::operator[](uint32_t index) const
+inline const T& Array<T>::operator[](u32 index) const
 {
 	CE_ASSERT(index < _size, "Index out of bounds");
 	return _data[index];
@@ -290,7 +290,7 @@ inline const T& Array<T>::operator[](uint32_t index) const
 template <typename T>
 inline Array<T>& Array<T>::operator=(const Array<T>& other)
 {
-	const uint32_t size = other._size;
+	const u32 size = other._size;
 	array::resize(*this, size);
 	memcpy(_data, other._data, sizeof(T) * size);
 	return *this;

+ 26 - 26
src/core/containers/container_types.h

@@ -24,16 +24,16 @@ struct Array
 	ALLOCATOR_AWARE;
 
 	Allocator* _allocator;
-	uint32_t _capacity;
-	uint32_t _size;
+	u32 _capacity;
+	u32 _size;
 	T* _data;
 
 	Array(Allocator& a);
-	Array(Allocator& a, uint32_t capacity);
+	Array(Allocator& a, u32 capacity);
 	Array(const Array<T>& other);
 	~Array();
-	T& operator[](uint32_t index);
-	const T& operator[](uint32_t index) const;
+	T& operator[](u32 index);
+	const T& operator[](u32 index) const;
 	Array<T>& operator=(const Array<T>& other);
 };
 
@@ -51,20 +51,20 @@ struct Vector
 	ALLOCATOR_AWARE;
 
 	Allocator* _allocator;
-	uint32_t _capacity;
-	uint32_t _size;
+	u32 _capacity;
+	u32 _size;
 	T* _data;
 
 	Vector(Allocator& a);
-	Vector(Allocator& a, uint32_t capacity);
+	Vector(Allocator& a, u32 capacity);
 	Vector(const Vector<T>& other);
 	~Vector();
-	T& operator[](uint32_t index);
-	const T& operator[](uint32_t index) const;
+	T& operator[](u32 index);
+	const T& operator[](u32 index) const;
 	const Vector<T>& operator=(const Vector<T>& other);
 };
 
-/// Circular buffer double-ended queue of POD items.
+/// Circular buffer f64-ended queue of POD items.
 /// @note
 /// Does not call constructors/destructors so it is not very suitable for non-POD items.
 ///
@@ -74,13 +74,13 @@ struct Queue
 {
 	ALLOCATOR_AWARE;
 
-	uint32_t _read;
-	uint32_t _size;
+	u32 _read;
+	u32 _size;
 	Array<T> _queue;
 
 	Queue(Allocator& a);
-	T& operator[](uint32_t index);
-	const T& operator[](uint32_t index) const;
+	T& operator[](u32 index);
+	const T& operator[](u32 index) const;
 };
 
 /// Priority queue of POD items.
@@ -96,8 +96,8 @@ struct PriorityQueue
 	PriorityQueue(Allocator& a);
 };
 
-/// Hash from an uint64_t to POD items. If you want to use a generic key
-/// item, use a hash function to map that item to an uint64_t.
+/// Hash from an u64 to POD items. If you want to use a generic key
+/// item, use a hash function to map that item to an u64.
 ///
 /// @ingroup Containers
 template<typename T>
@@ -107,12 +107,12 @@ struct Hash
 
 	struct Entry
 	{
-		uint64_t key;
-		uint32_t next;
+		u64 key;
+		u32 next;
 		T value;
 	};
 
-	Array<uint32_t> _hash;
+	Array<u32> _hash;
 	Array<Entry> _data;
 
 	Hash(Allocator &a);
@@ -132,10 +132,10 @@ struct Map
 		ALLOCATOR_AWARE;
 
 		PAIR(TKey, TValue) pair;
-		uint32_t left;
-		uint32_t right;
-		uint32_t parent;
-		uint32_t color;
+		u32 left;
+		u32 right;
+		u32 parent;
+		u32 color;
 
 		Node(Allocator& a)
 			: pair(a)
@@ -143,8 +143,8 @@ struct Map
 		}
 	};
 
-	uint32_t _root;
-	uint32_t _sentinel;
+	u32 _root;
+	u32 _sentinel;
 	Vector<Node> _data;
 
 	Map(Allocator& a);

+ 4 - 4
src/core/containers/event_stream.h

@@ -25,12 +25,12 @@ namespace event_stream
 {
 	struct Header
 	{
-		uint32_t type;
-		uint32_t size;
+		u32 type;
+		u32 size;
 	};
 
 	/// Appends the @a event of the given @a type and @a size to the stream @a s.
-	inline void write(EventStream& s, uint32_t type, uint32_t size, const void* event)
+	inline void write(EventStream& s, u32 type, u32 size, const void* event)
 	{
 		Header header;
 		header.type = type;
@@ -42,7 +42,7 @@ namespace event_stream
 
 	/// Appends the @a event of the given @a type to the stream @a s
 	template <typename T>
-	inline void write(EventStream& s, uint32_t type, const T& event)
+	inline void write(EventStream& s, u32 type, const T& event)
 	{
 		event_stream::write(s, type, sizeof(T), &event);
 	}

+ 44 - 44
src/core/containers/hash.h

@@ -25,21 +25,21 @@ namespace crown
 	namespace hash
 	{
 		/// Returns true if the specified key exists in the hash.
-		template<typename T> bool has(const Hash<T>& h, uint64_t key);
+		template<typename T> bool has(const Hash<T>& h, u64 key);
 
 		/// Returns the value stored for the specified key, or deffault if the key
 		/// does not exist in the hash.
-		template<typename T> const T& get(const Hash<T>& h, uint64_t key, const T& deffault);
+		template<typename T> const T& get(const Hash<T>& h, u64 key, const T& deffault);
 
 		/// Sets the value for the key.
-		template<typename T> void set(Hash<T>& h, uint64_t key, const T& value);
+		template<typename T> void set(Hash<T>& h, u64 key, const T& value);
 
 		/// Removes the key from the hash if it exists.
-		template<typename T> void remove(Hash<T>& h, uint64_t key);
+		template<typename T> void remove(Hash<T>& h, u64 key);
 
 		/// Resizes the hash lookup table to the specified size.
 		/// (The table will grow automatically when 70 % full.)
-		template<typename T> void reserve(Hash<T>& h, uint32_t size);
+		template<typename T> void reserve(Hash<T>& h, u32 size);
 
 		/// Remove all elements from the hash.
 		template<typename T> void clear(Hash<T>& h);
@@ -56,50 +56,50 @@ namespace crown
 	namespace multi_hash
 	{
 		/// Finds the first entry with the specified key.
-		template<typename T> const typename Hash<T>::Entry* find_first(const Hash<T>& h, uint64_t key);
+		template<typename T> const typename Hash<T>::Entry* find_first(const Hash<T>& h, u64 key);
 
 		/// Finds the next entry with the same key as e.
 		template<typename T> const typename Hash<T>::Entry* find_next(const Hash<T>& h, const typename Hash<T>::Entry* e);
 
 		/// Returns the number of entries with the key.
-		template<typename T> uint32_t count(const Hash<T>& h, uint64_t key);
+		template<typename T> u32 count(const Hash<T>& h, u64 key);
 
 		/// Returns all the entries with the specified key.
 		/// Use a TempAllocator for the array to avoid allocating memory.
-		template<typename T> void get(const Hash<T>& h, uint64_t key, Array<T> &items);
+		template<typename T> void get(const Hash<T>& h, u64 key, Array<T> &items);
 
 		/// Inserts the value as an aditional value for the key.
-		template<typename T> void insert(Hash<T>& h, uint64_t key, const T& value);
+		template<typename T> void insert(Hash<T>& h, u64 key, const T& value);
 
 		/// Removes the specified entry.
 		template<typename T> void remove(Hash<T>& h, const typename Hash<T>::Entry* e);
 
 		/// Removes all entries with the specified key.
-		template<typename T> void remove_all(Hash<T>& h, uint64_t key);
+		template<typename T> void remove_all(Hash<T>& h, u64 key);
 	}
 
 	namespace hash_internal
 	{
-		const uint32_t END_OF_LIST = 0xffffffffu;
+		const u32 END_OF_LIST = 0xffffffffu;
 
 		struct FindResult
 		{
-			uint32_t hash_i;
-			uint32_t data_prev;
-			uint32_t data_i;
+			u32 hash_i;
+			u32 data_prev;
+			u32 data_i;
 		};
 
-		template<typename T> uint32_t add_entry(Hash<T>& h, uint64_t key)
+		template<typename T> u32 add_entry(Hash<T>& h, u64 key)
 		{
 			typename Hash<T>::Entry e;
 			e.key = key;
 			e.next = END_OF_LIST;
-			uint32_t ei = array::size(h._data);
+			u32 ei = array::size(h._data);
 			array::push_back(h._data, e);
 			return ei;
 		}
 
-		template<typename T> FindResult find(const Hash<T>& h, uint64_t key)
+		template<typename T> FindResult find(const Hash<T>& h, u64 key)
 		{
 			FindResult fr;
 			fr.hash_i = END_OF_LIST;
@@ -162,18 +162,18 @@ namespace crown
 				h._hash[last.hash_i] = fr.data_i;
 		}
 
-		template<typename T> uint32_t find_or_fail(const Hash<T>& h, uint64_t key)
+		template<typename T> u32 find_or_fail(const Hash<T>& h, u64 key)
 		{
 			return find(h, key).data_i;
 		}
 
-		template<typename T> uint32_t find_or_make(Hash<T>& h, uint64_t key)
+		template<typename T> u32 find_or_make(Hash<T>& h, u64 key)
 		{
 			const FindResult fr = find(h, key);
 			if (fr.data_i != END_OF_LIST)
 				return fr.data_i;
 
-			uint32_t i = add_entry(h, key);
+			u32 i = add_entry(h, key);
 			if (fr.data_prev == END_OF_LIST)
 				h._hash[fr.hash_i] = i;
 			else
@@ -181,10 +181,10 @@ namespace crown
 			return i;
 		}
 
-		template<typename T> uint32_t make(Hash<T>& h, uint64_t key)
+		template<typename T> u32 make(Hash<T>& h, u64 key)
 		{
 			const FindResult fr = find(h, key);
-			const uint32_t i = add_entry(h, key);
+			const u32 i = add_entry(h, key);
 
 			if (fr.data_prev == END_OF_LIST)
 				h._hash[fr.hash_i] = i;
@@ -195,21 +195,21 @@ namespace crown
 			return i;
 		}
 
-		template<typename T> void find_and_erase(Hash<T>& h, uint64_t key)
+		template<typename T> void find_and_erase(Hash<T>& h, u64 key)
 		{
 			const FindResult fr = find(h, key);
 			if (fr.data_i != END_OF_LIST)
 				erase(h, fr);
 		}
 
-		template<typename T> void rehash(Hash<T>& h, uint32_t new_size)
+		template<typename T> void rehash(Hash<T>& h, u32 new_size)
 		{
 			Hash<T> nh(*h._hash._allocator);
 			array::resize(nh._hash, new_size);
 			array::reserve(nh._data, array::size(h._data));
-			for (uint32_t i=0; i<new_size; ++i)
+			for (u32 i=0; i<new_size; ++i)
 				nh._hash[i] = END_OF_LIST;
-			for (uint32_t i=0; i<array::size(h._data); ++i) {
+			for (u32 i=0; i<array::size(h._data); ++i) {
 				const typename Hash<T>::Entry &e = h._data[i];
 				multi_hash::insert(nh, e.key, e.value);
 			}
@@ -222,47 +222,47 @@ namespace crown
 
 		template<typename T> bool full(const Hash<T>& h)
 		{
-			const float max_load_factor = 0.7f;
+			const f32 max_load_factor = 0.7f;
 			return array::size(h._data) >= array::size(h._hash) * max_load_factor;
 		}
 
 		template<typename T> void grow(Hash<T>& h)
 		{
-			const uint32_t new_size = array::size(h._data) * 2 + 10;
+			const u32 new_size = array::size(h._data) * 2 + 10;
 			rehash(h, new_size);
 		}
 	}
 
 	namespace hash
 	{
-		template<typename T> bool has(const Hash<T>& h, uint64_t key)
+		template<typename T> bool has(const Hash<T>& h, u64 key)
 		{
 			return hash_internal::find_or_fail(h, key) != hash_internal::END_OF_LIST;
 		}
 
-		template<typename T> const T& get(const Hash<T>& h, uint64_t key, const T& deffault)
+		template<typename T> const T& get(const Hash<T>& h, u64 key, const T& deffault)
 		{
-			const uint32_t i = hash_internal::find_or_fail(h, key);
+			const u32 i = hash_internal::find_or_fail(h, key);
 			return i == hash_internal::END_OF_LIST ? deffault : h._data[i].value;
 		}
 
-		template<typename T> void set(Hash<T>& h, uint64_t key, const T& value)
+		template<typename T> void set(Hash<T>& h, u64 key, const T& value)
 		{
 			if (array::size(h._hash) == 0)
 				hash_internal::grow(h);
 
-			const uint32_t i = hash_internal::find_or_make(h, key);
+			const u32 i = hash_internal::find_or_make(h, key);
 			h._data[i].value = value;
 			if (hash_internal::full(h))
 				hash_internal::grow(h);
 		}
 
-		template<typename T> void remove(Hash<T>& h, uint64_t key)
+		template<typename T> void remove(Hash<T>& h, u64 key)
 		{
 			hash_internal::find_and_erase(h, key);
 		}
 
-		template<typename T> void reserve(Hash<T>& h, uint32_t size)
+		template<typename T> void reserve(Hash<T>& h, u32 size)
 		{
 			hash_internal::rehash(h, size);
 		}
@@ -286,15 +286,15 @@ namespace crown
 
 	namespace multi_hash
 	{
-		template<typename T> const typename Hash<T>::Entry* find_first(const Hash<T>& h, uint64_t key)
+		template<typename T> const typename Hash<T>::Entry* find_first(const Hash<T>& h, u64 key)
 		{
-			const uint32_t i = hash_internal::find_or_fail(h, key);
+			const u32 i = hash_internal::find_or_fail(h, key);
 			return i == hash_internal::END_OF_LIST ? 0 : &h._data[i];
 		}
 
 		template<typename T> const typename Hash<T>::Entry* find_next(const Hash<T>& h, const typename Hash<T>::Entry* e)
 		{
-			uint32_t i = e->next;
+			u32 i = e->next;
 			while (i != hash_internal::END_OF_LIST) {
 				if (h._data[i].key == e->key)
 					return &h._data[i];
@@ -303,9 +303,9 @@ namespace crown
 			return 0;
 		}
 
-		template<typename T> uint32_t count(const Hash<T>& h, uint64_t key)
+		template<typename T> u32 count(const Hash<T>& h, u64 key)
 		{
-			uint32_t i = 0;
+			u32 i = 0;
 			const typename Hash<T>::Entry* e = find_first(h, key);
 			while (e) {
 				++i;
@@ -314,7 +314,7 @@ namespace crown
 			return i;
 		}
 
-		template<typename T> void get(const Hash<T>& h, uint64_t key, Array<T> &items)
+		template<typename T> void get(const Hash<T>& h, u64 key, Array<T> &items)
 		{
 			const typename Hash<T>::Entry* e = find_first(h, key);
 			while (e) {
@@ -323,12 +323,12 @@ namespace crown
 			}
 		}
 
-		template<typename T> void insert(Hash<T>& h, uint64_t key, const T& value)
+		template<typename T> void insert(Hash<T>& h, u64 key, const T& value)
 		{
 			if (array::size(h._hash) == 0)
 				hash_internal::grow(h);
 
-			const uint32_t i = hash_internal::make(h, key);
+			const u32 i = hash_internal::make(h, key);
 			h._data[i].value = value;
 			if (hash_internal::full(h))
 				hash_internal::grow(h);
@@ -341,7 +341,7 @@ namespace crown
 				hash_internal::erase(h, fr);
 		}
 
-		template<typename T> void remove_all(Hash<T>& h, uint64_t key)
+		template<typename T> void remove_all(Hash<T>& h, u64 key)
 		{
 			while (hash::has(h, key))
 				hash::remove(h, key);

+ 44 - 44
src/core/containers/map.h

@@ -18,7 +18,7 @@ namespace crown
 namespace map
 {
 	/// Returns the number of items in the map @a m.
-	template <typename TKey, typename TValue> uint32_t size(const Map<TKey, TValue>& m);
+	template <typename TKey, typename TValue> u32 size(const Map<TKey, TValue>& m);
 
 	/// Returns whether the given @a key exists in the map @a m.
 	template <typename TKey, typename TValue> bool has(const Map<TKey, TValue>& m, const TKey& key);
@@ -45,39 +45,39 @@ namespace map
 
 namespace map_internal
 {
-	const uint32_t BLACK = 0xB1B1B1B1u;
-	const uint32_t RED = 0xEDEDEDEDu;
-	const uint32_t NIL = 0xFFFFFFFFu;
+	const u32 BLACK = 0xB1B1B1B1u;
+	const u32 RED = 0xEDEDEDEDu;
+	const u32 NIL = 0xFFFFFFFFu;
 
 	template <typename TKey, typename TValue>
-	inline uint32_t root(const Map<TKey, TValue>& m)
+	inline u32 root(const Map<TKey, TValue>& m)
 	{
 		return m._root;
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t parent(const Map<TKey, TValue>& m, uint32_t n)
+	inline u32 parent(const Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 		return m._data[n].parent;
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t left(const Map<TKey, TValue>& m, uint32_t n)
+	inline u32 left(const Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 		return m._data[n].left;
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t right(const Map<TKey, TValue>& m, uint32_t n)
+	inline u32 right(const Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 		return m._data[n].right;
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t color(const Map<TKey, TValue>& m, uint32_t n)
+	inline u32 color(const Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 		return m._data[n].color;
@@ -85,7 +85,7 @@ namespace map_internal
 
 	#ifdef RBTREE_VERIFY
 	template<typename TKey, typename TValue>
-	inline int32_t dbg_verify(Map<TKey, TValue>& m, uint32_t n)
+	inline s32 dbg_verify(Map<TKey, TValue>& m, u32 n)
 	{
 		if (n == m._sentinel)
 		{
@@ -104,8 +104,8 @@ namespace map_internal
 			CE_ASSERT(m._data[n].pair.first < m._data[right(m, n)].pair.first, "Bad RBTree");
 		}
 
-		int32_t bhL = dbg_verify(m, left(m, n));
-		int32_t bhR = dbg_verify(m, right(m, n));
+		s32 bhL = dbg_verify(m, left(m, n));
+		s32 bhR = dbg_verify(m, right(m, n));
 		CE_ASSERT(bhL == bhR, "Bad RBTree");
 
 		if (color(m, n) == BLACK)
@@ -124,9 +124,9 @@ namespace map_internal
 	}
 
 	template<typename TKey, typename TValue>
-	inline int32_t dump(Map<TKey, TValue>& m)
+	inline s32 dump(Map<TKey, TValue>& m)
 	{
-		for (uint32_t i = 0; i < vector::size(m._data); i++)
+		for (u32 i = 0; i < vector::size(m._data); i++)
 		{
 			printf("%d = [%d, %d, %d] ", i, parent(m, i), left(m, i), right(m, i));
 		}
@@ -136,7 +136,7 @@ namespace map_internal
 	#endif
 
 	template <typename TKey, typename TValue>
-	inline uint32_t min(const Map<TKey, TValue>& m, uint32_t x)
+	inline u32 min(const Map<TKey, TValue>& m, u32 x)
 	{
 		if (x == m._sentinel)
 		{
@@ -152,7 +152,7 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t max(const Map<TKey, TValue>& m, uint32_t x)
+	inline u32 max(const Map<TKey, TValue>& m, u32 x)
 	{
 		if (x == m._sentinel)
 		{
@@ -168,14 +168,14 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t successor(const Map<TKey, TValue>& m, uint32_t x)
+	inline u32 successor(const Map<TKey, TValue>& m, u32 x)
 	{
 		if (right(m, x) != m._sentinel)
 		{
 			return min(m, right(m, x));
 		}
 
-		uint32_t y = parent(m, x);
+		u32 y = parent(m, x);
 
 		while (y != NIL && x == right(m, y))
 		{
@@ -187,14 +187,14 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t predecessor(const Map<TKey, TValue>& m, uint32_t x)
+	inline u32 predecessor(const Map<TKey, TValue>& m, u32 x)
 	{
 		if (left(m, x) != m._sentinel)
 		{
 			return max(m, left(m, x));
 		}
 
-		uint32_t y = parent(m, x);
+		u32 y = parent(m, x);
 
 		while (y != NIL && x == left(m, y))
 		{
@@ -206,11 +206,11 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline void rotate_left(Map<TKey, TValue>& m, uint32_t x)
+	inline void rotate_left(Map<TKey, TValue>& m, u32 x)
 	{
 		CE_ASSERT(x < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), x);
 
-		uint32_t y = right(m, x);
+		u32 y = right(m, x);
 		m._data[x].right = left(m, y);
 
 		if (left(m, y) != m._sentinel)
@@ -241,11 +241,11 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline void rotate_right(Map<TKey, TValue>& m, uint32_t x)
+	inline void rotate_right(Map<TKey, TValue>& m, u32 x)
 	{
 		CE_ASSERT(x < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), x);
 
-		uint32_t y = left(m, x);
+		u32 y = left(m, x);
 		m._data[x].left = right(m, y);
 
 		if (right(m, y) != m._sentinel)
@@ -276,11 +276,11 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline void destroy(Map<TKey, TValue>& m, uint32_t n)
+	inline void destroy(Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 
-		uint32_t x = vector::size(m._data) - 1;
+		u32 x = vector::size(m._data) - 1;
 
 		if (x == m._root)
 		{
@@ -323,12 +323,12 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline void insert_fixup(Map<TKey, TValue>& m, uint32_t n)
+	inline void insert_fixup(Map<TKey, TValue>& m, u32 n)
 	{
 		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 
-		uint32_t x;
-		uint32_t y;
+		u32 x;
+		u32 y;
 
 		while (n != root(m) && color(m, parent(m, n)) == RED)
 		{
@@ -390,9 +390,9 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t inner_find(const Map<TKey, TValue>& m, const TKey& key)
+	inline u32 inner_find(const Map<TKey, TValue>& m, const TKey& key)
 	{
-		uint32_t x = m._root;
+		u32 x = m._root;
 
 		while (x != m._sentinel)
 		{
@@ -424,9 +424,9 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t find_or_fail(const Map<TKey, TValue>& m, const TKey& key)
+	inline u32 find_or_fail(const Map<TKey, TValue>& m, const TKey& key)
 	{
-		uint32_t p = inner_find(m, key);
+		u32 p = inner_find(m, key);
 
 		if (p != m._sentinel && m._data[p].pair.first == key)
 			return p;
@@ -435,9 +435,9 @@ namespace map_internal
 	}
 
 	template <typename TKey, typename TValue>
-	inline uint32_t find_or_add(Map<TKey, TValue>& m, const TKey& key)
+	inline u32 find_or_add(Map<TKey, TValue>& m, const TKey& key)
 	{
-		uint32_t p = inner_find(m, key);
+		u32 p = inner_find(m, key);
 
 		if (p != m._sentinel && m._data[p].pair.first == key)
 		{
@@ -485,7 +485,7 @@ namespace map_internal
 namespace map
 {
 	template <typename TKey, typename TValue>
-	uint32_t size(const Map<TKey, TValue>& m)
+	u32 size(const Map<TKey, TValue>& m)
 	{
 		CE_ASSERT(vector::size(m._data) > 0, "Bad Map"); // There should be at least sentinel
 		return vector::size(m._data) - 1;
@@ -500,7 +500,7 @@ namespace map
 	template <typename TKey, typename TValue>
 	inline const TValue& get(const Map<TKey, TValue>& m, const TKey& key, const TValue& deffault)
 	{
-		uint32_t p = map_internal::inner_find(m, key);
+		u32 p = map_internal::inner_find(m, key);
 
 		if (p != m._sentinel && m._data[p].pair.first == key)
 		{
@@ -520,9 +520,9 @@ namespace map
 		node.left = m._sentinel;
 		node.right = m._sentinel;
 		node.parent = map_internal::NIL;
-		uint32_t n = vector::push_back(m._data, node);
-		uint32_t x = m._root;
-		uint32_t y = map_internal::NIL;
+		u32 n = vector::push_back(m._data, node);
+		u32 x = m._root;
+		u32 y = map_internal::NIL;
 
 		if (x == m._sentinel)
 			m._root = n;
@@ -558,15 +558,15 @@ namespace map
 	{
 		using namespace map_internal;
 
-		uint32_t n = inner_find(m, key);
+		u32 n = inner_find(m, key);
 
 		if (!(m._data[n].pair.first == key))
 		{
 			return;
 		}
 
-		uint32_t x;
-		uint32_t y;
+		u32 x;
+		u32 y;
 
 		if (left(m, n) == m._sentinel || right(m, n) == m._sentinel)
 		{
@@ -613,7 +613,7 @@ namespace map
 		// Do the fixup
 		if (color(m, y) == map_internal::BLACK)
 		{
-			uint32_t y;
+			u32 y;
 
 			while (x != m._root && color(m, x) == map_internal::BLACK)
 			{

+ 21 - 21
src/core/containers/queue.h

@@ -21,24 +21,24 @@ namespace queue
 	template<typename T> bool empty(const Queue<T>& q);
 
 	/// Returns the number of items in the queue
-	template<typename T> uint32_t size(const Queue<T>& q);
+	template<typename T> u32 size(const Queue<T>& q);
 
 	/// Returns the number of items the queue can hold before
 	/// a resize must occur.
-	template<typename T> uint32_t space(const Queue<T>& q);
+	template<typename T> u32 space(const Queue<T>& q);
 
 	/// Increase or decrease the capacity of the queue.
 	/// @note
 	/// Old items will be copied to the newly created queue.
 	/// If the new @a capacity is smaller than the previous one, the
 	/// queue will be truncated.
-	template<typename T> void increase_capacity(Queue<T>& q, uint32_t capacity);
+	template<typename T> void increase_capacity(Queue<T>& q, u32 capacity);
 
 	/// Grows the queue to contain at least @a min_capacity items.
 	/// If @a min_capacity is set to 0, the queue automatically
 	/// determines the new capacity based on its size at the
 	/// time of call.
-	template<typename T> void grow(Queue<T>& q, uint32_t min_capacity);
+	template<typename T> void grow(Queue<T>& q, u32 min_capacity);
 
 	/// Appends an @a item to the back of the queue
 	template<typename T> void push_back(Queue<T>& q, const T& item);
@@ -53,10 +53,10 @@ namespace queue
 	template<typename T> void pop_front(Queue<T>& q);
 
 	/// Appends @a n @a items to the back of the queue
-	template<typename T> void push(Queue<T>& q, const T *items, uint32_t n);
+	template<typename T> void push(Queue<T>& q, const T *items, u32 n);
 
 	/// Removes @a n items from the front of the queue
-	template<typename T> void pop(Queue<T>& q, uint32_t n);
+	template<typename T> void pop(Queue<T>& q, u32 n);
 
 	/// Clears the content of the queue.
 	/// @note
@@ -84,21 +84,21 @@ namespace queue
 	}
 
 	template <typename T>
-	inline uint32_t size(const Queue<T>& q)
+	inline u32 size(const Queue<T>& q)
 	{
 		return q._size;
 	}
 
 	template <typename T>
-	inline uint32_t space(const Queue<T>& q)
+	inline u32 space(const Queue<T>& q)
 	{
 		return array::size(q._queue) - q._size;
 	}
 
 	template <typename T>
-	inline void increase_capacity(Queue<T>& q, uint32_t capacity)
+	inline void increase_capacity(Queue<T>& q, u32 capacity)
 	{
-		uint32_t old_size = array::size(q._queue);
+		u32 old_size = array::size(q._queue);
 
 		array::resize(q._queue, capacity);
 
@@ -110,9 +110,9 @@ namespace queue
 	}
 
 	template <typename T>
-	inline void grow(Queue<T>& q, uint32_t min_capacity)
+	inline void grow(Queue<T>& q, u32 min_capacity)
 	{
-		uint32_t new_capacity = array::size(q._queue) * 2 + 1;
+		u32 new_capacity = array::size(q._queue) * 2 + 1;
 
 		if (new_capacity < min_capacity)
 			new_capacity = min_capacity;
@@ -161,15 +161,15 @@ namespace queue
 	}
 
 	template <typename T>
-	inline void push(Queue<T>& q, const T *items, uint32_t n)
+	inline void push(Queue<T>& q, const T *items, u32 n)
 	{
 		if (q.space() < n)
 			q.grow(q.size() + n);
 
-		const uint32_t size = array::size(q._queue);
-		const uint32_t insert = (q._read + q._size) % size;
+		const u32 size = array::size(q._queue);
+		const u32 insert = (q._read + q._size) % size;
 
-		uint32_t to_insert = n;
+		u32 to_insert = n;
 		if (insert + to_insert > size)
 			to_insert = size - insert;
 
@@ -184,7 +184,7 @@ namespace queue
 	}
 
 	template <typename T>
-	inline void pop(Queue<T>& q, uint32_t n)
+	inline void pop(Queue<T>& q, u32 n)
 	{
 		CE_ASSERT(q._size > 0, "The queue is empty");
 
@@ -214,14 +214,14 @@ namespace queue
 	template <typename T>
 	inline T* end(Queue<T>& q)
 	{
-		const uint32_t end = q._read + q._size;
+		const u32 end = q._read + q._size;
 		return end >= array::size(q._queue) ? array::end(q._queue) : array::begin(q._queue) + end;
 	}
 
 	template <typename T>
 	inline const T* end(const Queue<T>& q)
 	{
-		const uint32_t end = q._read + q._size;
+		const u32 end = q._read + q._size;
 		return end >= array::size(q._queue) ? array::end(q._queue) : array::begin(q._queue) + end;
 	}
 
@@ -264,13 +264,13 @@ inline Queue<T>::Queue(Allocator& a)
 }
 
 template <typename T>
-inline T& Queue<T>::operator[](uint32_t index)
+inline T& Queue<T>::operator[](u32 index)
 {
 	return _queue[(_read + index) % array::size(_queue)];
 }
 
 template <typename T>
-inline const T& Queue<T>::operator[](uint32_t index) const
+inline const T& Queue<T>::operator[](u32 index) const
 {
 	return _queue[(_read + index) % array::size(_queue)];
 }

+ 5 - 5
src/core/containers/sort_map.h

@@ -16,7 +16,7 @@ namespace crown
 namespace sort_map
 {
 	/// Returns the number of items in the map @m.
-	template <typename TKey, typename TValue, typename Compare> uint32_t size(const SortMap<TKey, TValue, Compare>& m);
+	template <typename TKey, typename TValue, typename Compare> u32 size(const SortMap<TKey, TValue, Compare>& m);
 
 	/// Returns whether the @a key exists in the map.
 	template <typename TKey, typename TValue, typename Compare> bool has(const SortMap<TKey, TValue, Compare>& m, const TKey& key);
@@ -48,11 +48,11 @@ namespace sort_map
 
 namespace sort_map_internal
 {
-	const uint32_t END_OF_LIST = 0xffffffffu;
+	const u32 END_OF_LIST = 0xffffffffu;
 
 	struct FindResult
 	{
-		uint32_t item_i;
+		u32 item_i;
 	};
 
 	template <typename TKey, typename TValue, typename Compare>
@@ -86,7 +86,7 @@ namespace sort_map_internal
 			sort_map_internal::CompareEntry<TKey, TValue, Compare>());
 
 		if (first != vector::end(m._data) && !(key < first->pair.first))
-			result.item_i = uint32_t(first - vector::begin(m._data));
+			result.item_i = u32(first - vector::begin(m._data));
 
 		return result;
 	}
@@ -95,7 +95,7 @@ namespace sort_map_internal
 namespace sort_map
 {
 	template <typename TKey, typename TValue, typename Compare>
-	inline uint32_t size(const SortMap<TKey, TValue, Compare>& m)
+	inline u32 size(const SortMap<TKey, TValue, Compare>& m)
 	{
 		return vector::size(m._data);
 	}

+ 27 - 27
src/core/containers/vector.h

@@ -21,40 +21,40 @@ namespace vector
 	template <typename T> bool empty(const Vector<T>& v);
 
 	/// Returns the number of items in the vector @a v.
-	template <typename T> uint32_t size(const Vector<T>& v);
+	template <typename T> u32 size(const Vector<T>& v);
 
 	/// Returns the maximum number of items the vector @a v can hold.
-	template <typename T> uint32_t capacity(const Vector<T>& v);
+	template <typename T> u32 capacity(const Vector<T>& v);
 
 	/// Resizes the vector @a v to the given @a size.
 	/// @note
 	/// Old items will be copied to the newly created vector.
 	/// If the new capacity is smaller than the previous one, the
 	/// vector will be truncated.
-	template <typename T> void resize(Vector<T>& v, uint32_t size);
+	template <typename T> void resize(Vector<T>& v, u32 size);
 
 	/// Reserves space in the vector @a v for at least @a capacity items.
-	template <typename T> void reserve(Vector<T>& v, uint32_t capacity);
+	template <typename T> void reserve(Vector<T>& v, u32 capacity);
 
 	/// Sets the capacity of vector @a v.
-	template <typename T> void set_capacity(Vector<T>& v, uint32_t capacity);
+	template <typename T> void set_capacity(Vector<T>& v, u32 capacity);
 
 	/// Grows the vector @a v to contain at least @a min_capacity items.
-	template <typename T> void grow(Vector<T>& v, uint32_t min_capacity);
+	template <typename T> void grow(Vector<T>& v, u32 min_capacity);
 
 	/// Condenses the vector @a v so that its capacity matches the actual number
 	/// of items in the vector.
 	template <typename T> void condense(Vector<T>& v);
 
 	/// Appends an item to the vector @a v and returns its index.
-	template <typename T> uint32_t push_back(Vector<T>& v, const T& item);
+	template <typename T> u32 push_back(Vector<T>& v, const T& item);
 
 	/// Removes the last item from the vector @a v.
 	template <typename T> void pop_back(Vector<T>& v);
 
 	/// Appends @a count @a items to the vector @a v and returns the number
 	/// of items in the vector after the append operation.
-	template <typename T> uint32_t push(Vector<T>& v, const T* items, uint32_t count);
+	template <typename T> u32 push(Vector<T>& v, const T* items, u32 count);
 
 	/// Clears the content of the vector @a v.
 	/// @note
@@ -81,19 +81,19 @@ namespace vector
 	}
 
 	template <typename T>
-	inline uint32_t size(const Vector<T>& v)
+	inline u32 size(const Vector<T>& v)
 	{
 		return v._size;
 	}
 
 	template <typename T>
-	inline uint32_t capacity(const Vector<T>& v)
+	inline u32 capacity(const Vector<T>& v)
 	{
 		return v._capacity;
 	}
 
 	template <typename T>
-	inline void resize(Vector<T>& v, uint32_t size)
+	inline void resize(Vector<T>& v, u32 size)
 	{
 		if (size > v._capacity)
 			set_capacity(v, size);
@@ -102,14 +102,14 @@ namespace vector
 	}
 
 	template <typename T>
-	inline void reserve(Vector<T>& v, uint32_t capacity)
+	inline void reserve(Vector<T>& v, u32 capacity)
 	{
 		if (capacity > v._capacity)
 			grow(v, capacity);
 	}
 
 	template <typename T>
-	inline void set_capacity(Vector<T>& v, uint32_t capacity)
+	inline void set_capacity(Vector<T>& v, u32 capacity)
 	{
 		if (capacity == v._capacity)
 			return;
@@ -123,14 +123,14 @@ namespace vector
 			v._capacity = capacity;
 			v._data = (T*)v._allocator->allocate(capacity * sizeof(T), CE_ALIGNOF(T));
 
-			for (uint32_t i = 0; i < v._size; ++i)
+			for (u32 i = 0; i < v._size; ++i)
 			{
 				new (v._data + i) T(tmp[i]);
 			}
 
 			if (tmp)
 			{
-				for (uint32_t i = 0; i < v._size; ++i)
+				for (u32 i = 0; i < v._size; ++i)
 				{
 					tmp[i].~T();
 				}
@@ -140,9 +140,9 @@ namespace vector
 	}
 
 	template <typename T>
-	inline void grow(Vector<T>& v, uint32_t min_capacity)
+	inline void grow(Vector<T>& v, u32 min_capacity)
 	{
-		uint32_t new_capacity = v._capacity * 2 + 1;
+		u32 new_capacity = v._capacity * 2 + 1;
 
 		if (new_capacity < min_capacity)
 			new_capacity = min_capacity;
@@ -157,7 +157,7 @@ namespace vector
 	}
 
 	template <typename T>
-	inline uint32_t push_back(Vector<T>& v, const T& item)
+	inline u32 push_back(Vector<T>& v, const T& item)
 	{
 		if (v._capacity == v._size)
 			grow(v, 0);
@@ -177,13 +177,13 @@ namespace vector
 	}
 
 	template <typename T>
-	inline uint32_t push(Vector<T>& v, const T* items, uint32_t count)
+	inline u32 push(Vector<T>& v, const T* items, u32 count)
 	{
 		if (v._capacity <= v._size + count)
 			grow(v, v._size + count);
 
 		T* arr = &v._data[v._size];
-		for (uint32_t i = 0; i < count; ++i)
+		for (u32 i = 0; i < count; ++i)
 			arr[i] = items[i];
 
 		v._size += count;
@@ -193,7 +193,7 @@ namespace vector
 	template <typename T>
 	inline void clear(Vector<T>& v)
 	{
-		for (uint32_t i = 0; i < v._size; ++i)
+		for (u32 i = 0; i < v._size; ++i)
 			v._data[i].~T();
 
 		v._size = 0;
@@ -262,7 +262,7 @@ inline Vector<T>::Vector(Allocator& a)
 }
 
 template <typename T>
-inline Vector<T>::Vector(Allocator& a, uint32_t capacity)
+inline Vector<T>::Vector(Allocator& a, u32 capacity)
 	: _allocator(&a)
 	, _capacity(0)
 	, _size(0)
@@ -284,21 +284,21 @@ inline Vector<T>::Vector(const Vector<T>& other)
 template <typename T>
 inline Vector<T>::~Vector()
 {
-	for (uint32_t i = 0; i < _size; ++i)
+	for (u32 i = 0; i < _size; ++i)
 		_data[i].~T();
 
 	_allocator->deallocate(_data);
 }
 
 template <typename T>
-inline T& Vector<T>::operator[](uint32_t index)
+inline T& Vector<T>::operator[](u32 index)
 {
 	CE_ASSERT(index < _size, "Index out of bounds");
 	return _data[index];
 }
 
 template <typename T>
-inline const T& Vector<T>::operator[](uint32_t index) const
+inline const T& Vector<T>::operator[](u32 index) const
 {
 	CE_ASSERT(index < _size, "Index out of bounds");
 	return _data[index];
@@ -307,10 +307,10 @@ inline const T& Vector<T>::operator[](uint32_t index) const
 template <typename T>
 inline const Vector<T>& Vector<T>::operator=(const Vector<T>& other)
 {
-	const uint32_t size = vector::size(other);
+	const u32 size = vector::size(other);
 	vector::resize(*this, size);
 
-	for (uint32_t i = 0; i < size; ++i)
+	for (u32 i = 0; i < size; ++i)
 		_data[i] = other._data[i];
 
 	return *this;

+ 8 - 8
src/core/filesystem/apk_file.cpp

@@ -41,7 +41,7 @@ void ApkFile::close()
 	}
 }
 
-void ApkFile::seek(uint32_t position)
+void ApkFile::seek(u32 position)
 {
 	off_t seek_result = AAsset_seek(_asset, (off_t)position, SEEK_SET);
 	CE_ASSERT(seek_result != (off_t)-1, "AAsset_seek: error");
@@ -55,20 +55,20 @@ void ApkFile::seek_to_end()
 	CE_UNUSED(seek_result);
 }
 
-void ApkFile::skip(uint32_t bytes)
+void ApkFile::skip(u32 bytes)
 {
 	off_t seek_result = AAsset_seek(_asset, (off_t)bytes, SEEK_CUR);
 	CE_ASSERT(seek_result != (off_t)-1, "AAsset_seek: error");
 	CE_UNUSED(seek_result);
 }
 
-uint32_t ApkFile::read(void* data, uint32_t size)
+u32 ApkFile::read(void* data, u32 size)
 {
 	CE_ASSERT_NOT_NULL(data);
-	return (uint32_t)AAsset_read(_asset, data, size);
+	return (u32)AAsset_read(_asset, data, size);
 }
 
-uint32_t ApkFile::write(const void* /*data*/, uint32_t /*size*/)
+u32 ApkFile::write(const void* /*data*/, u32 /*size*/)
 {
 	CE_ASSERT(false, "Apk files are read only!");
 	return 0;
@@ -89,14 +89,14 @@ bool ApkFile::end_of_file()
 	return AAsset_getRemainingLength(_asset) == 0;
 }
 
-uint32_t ApkFile::size()
+u32 ApkFile::size()
 {
 	return AAsset_getLength(_asset);
 }
 
-uint32_t ApkFile::position()
+u32 ApkFile::position()
 {
-	return (uint32_t)(AAsset_getLength(_asset) - AAsset_getRemainingLength(_asset));
+	return (u32)(AAsset_getLength(_asset) - AAsset_getRemainingLength(_asset));
 }
 
 } // namespace crown

+ 6 - 6
src/core/filesystem/apk_file.h

@@ -35,19 +35,19 @@ public:
 	void close();
 
 	/// @copydoc File::seek()
-	void seek(uint32_t position);
+	void seek(u32 position);
 
 	/// @copydoc File::seek_to_end()
 	void seek_to_end();
 
 	/// @copydoc File::skip()
-	void skip(uint32_t bytes);
+	void skip(u32 bytes);
 
 	/// @copydoc File::read()
-	uint32_t read(void* data, uint32_t size);
+	u32 read(void* data, u32 size);
 
 	/// @copydoc File::write()
-	uint32_t write(const void* data, uint32_t size);
+	u32 write(const void* data, u32 size);
 
 	/// @copydoc File::flush()
 	void flush();
@@ -59,10 +59,10 @@ public:
 	bool end_of_file();
 
 	/// @copydoc File::size()
-	uint32_t size();
+	u32 size();
 
 	/// @copydoc File::position()
-	uint32_t position();
+	u32 position();
 };
 
 } // namespace crown

+ 1 - 1
src/core/filesystem/apk_filesystem.cpp

@@ -49,7 +49,7 @@ bool ApkFilesystem::is_file(const char* path)
 	return true;
 }
 
-uint64_t ApkFilesystem::last_modified_time(const char* path)
+u64 ApkFilesystem::last_modified_time(const char* path)
 {
 	return 0;
 }

+ 1 - 1
src/core/filesystem/apk_filesystem.h

@@ -42,7 +42,7 @@ public:
 	bool is_file(const char* path);
 
 	/// @copydoc Filesystem::last_modified_time()
-	uint64_t last_modified_time(const char* path);
+	u64 last_modified_time(const char* path);
 
 	/// @copydoc Filesystem::create_directory()
 	void create_directory(const char* path);

+ 6 - 6
src/core/filesystem/disk_file.cpp

@@ -26,7 +26,7 @@ void DiskFile::close()
 	_file.close();
 }
 
-void DiskFile::seek(uint32_t position)
+void DiskFile::seek(u32 position)
 {
 	_file.seek(position);
 }
@@ -36,17 +36,17 @@ void DiskFile::seek_to_end()
 	_file.seek_to_end();
 }
 
-void DiskFile::skip(uint32_t bytes)
+void DiskFile::skip(u32 bytes)
 {
 	_file.skip(bytes);
 }
 
-uint32_t DiskFile::read(void* data, uint32_t size)
+u32 DiskFile::read(void* data, u32 size)
 {
 	return _file.read(data, size);
 }
 
-uint32_t DiskFile::write(const void* data, uint32_t size)
+u32 DiskFile::write(const void* data, u32 size)
 {
 	return _file.write(data, size);
 }
@@ -66,12 +66,12 @@ void DiskFile::flush()
 	_file.flush();
 }
 
-uint32_t DiskFile::position()
+u32 DiskFile::position()
 {
 	return _file.position();
 }
 
-uint32_t DiskFile::size()
+u32 DiskFile::size()
 {
 	return _file.size();
 }

+ 6 - 6
src/core/filesystem/disk_file.h

@@ -29,19 +29,19 @@ public:
 	void close();
 
 	/// @copydoc File::seek()
-	void seek(uint32_t position);
+	void seek(u32 position);
 
 	/// @copydoc File::seek_to_end()
 	void seek_to_end();
 
 	/// @copydoc File::skip()
-	void skip(uint32_t bytes);
+	void skip(u32 bytes);
 
 	/// @copydoc File::read()
-	uint32_t read(void* data, uint32_t size);
+	u32 read(void* data, u32 size);
 
 	/// @copydoc File::write()
-	uint32_t write(const void* data, uint32_t size);
+	u32 write(const void* data, u32 size);
 
 	/// @copydoc File::flush()
 	void flush();
@@ -53,10 +53,10 @@ public:
 	bool is_valid();
 
 	/// @copydoc File::size()
-	uint32_t size();
+	u32 size();
 
 	/// @copydoc File::position()
-	uint32_t position();
+	u32 position();
 };
 
 } // namespace crown

+ 1 - 1
src/core/filesystem/disk_filesystem.cpp

@@ -78,7 +78,7 @@ bool DiskFilesystem::is_file(const char* path)
 	return os::is_file(abs_path.c_str());
 }
 
-uint64_t DiskFilesystem::last_modified_time(const char* path)
+u64 DiskFilesystem::last_modified_time(const char* path)
 {
 	CE_ASSERT_NOT_NULL(path);
 

+ 1 - 1
src/core/filesystem/disk_filesystem.h

@@ -49,7 +49,7 @@ public:
 	bool is_file(const char* path);
 
 	/// @copydoc Filesystem::last_modified_time()
-	uint64_t last_modified_time(const char* path);
+	u64 last_modified_time(const char* path);
 
 	/// @copydoc Filesystem::create_directory()
 	void create_directory(const char* path);

+ 6 - 6
src/core/filesystem/file.h

@@ -27,19 +27,19 @@ public:
 	virtual void close() = 0;
 
 	/// Sets the position indicator of the file to position.
-	virtual void seek(uint32_t position) = 0;
+	virtual void seek(u32 position) = 0;
 
 	/// Sets the position indicator to the end of the file
 	virtual void seek_to_end() = 0;
 
 	/// Sets the position indicator to bytes after current position
-	virtual void skip(uint32_t bytes) = 0;
+	virtual void skip(u32 bytes) = 0;
 
 	/// Reads a block of data from the file.
-	virtual uint32_t read(void* data, uint32_t size) = 0;
+	virtual u32 read(void* data, u32 size) = 0;
 
 	/// Writes a block of data to the file.
-	virtual uint32_t write(const void* data, uint32_t size) = 0;
+	virtual u32 write(const void* data, u32 size) = 0;
 
 	/// Forces the previouses write operations to complete.
 	virtual void flush() = 0;
@@ -54,12 +54,12 @@ public:
 	virtual bool end_of_file() = 0;
 
 	/// Returns the size of file in bytes.
-	virtual uint32_t size() = 0;
+	virtual u32 size() = 0;
 
 	/// Returns the current position in file.
 	/// Generally, for binary data, it means the number of bytes
 	/// from the beginning of the file.
-	virtual uint32_t position() = 0;
+	virtual u32 position() = 0;
 };
 
 } // namespace crown

+ 1 - 1
src/core/filesystem/filesystem.h

@@ -38,7 +38,7 @@ public:
 	virtual bool is_file(const char* path) = 0;
 
 	/// Returns the time of last modify operaton to @a path.
-	virtual uint64_t last_modified_time(const char* path) = 0;
+	virtual u64 last_modified_time(const char* path) = 0;
 
 	/// Creates the directory at the given @a path.
 	virtual void create_directory(const char* path) = 0;

+ 8 - 8
src/core/filesystem/null_file.h

@@ -30,28 +30,28 @@ public:
 	void close() {}
 
 	/// @copydoc File::seek()
-	void seek(uint32_t position) { (void)position; }
+	void seek(u32 position) { (void)position; }
 
 	/// @copydoc File::seek_to_end()
 	void seek_to_end() {}
 
 	/// @copydoc File::skip()
-	void skip(uint32_t bytes) { (void)bytes; }
+	void skip(u32 bytes) { (void)bytes; }
 
 	/// @copydoc File::read()
 	/// @note
 	///	Fills buffer with zeroes
-	uint32_t read(void* data, uint32_t size)
+	u32 read(void* data, u32 size)
 	{
-		for (uint32_t i = 0; i < size; ++i)
+		for (u32 i = 0; i < size; ++i)
 		{
-			((uint8_t*)data)[i] = 0;
+			((u8*)data)[i] = 0;
 		}
 		return size;
 	}
 
 	/// @copydoc File::write()
-	uint32_t write(const void* /*data*/, uint32_t size)
+	u32 write(const void* /*data*/, u32 size)
 	{
 		return size;
 	}
@@ -72,12 +72,12 @@ public:
 	/// @copydoc File::size()
 	/// @note
 	///	Returns always 0xFFFFFFFF
-	uint32_t size() { return ~0; }
+	u32 size() { return ~0; }
 
 	/// @copydoc File::position()
 	/// @note
 	///	Returns always zero
-	uint32_t position() { return 0; }
+	u32 position() { return 0; }
 };
 
 } // namespace crown

+ 11 - 11
src/core/filesystem/os_file.h

@@ -99,7 +99,7 @@ public:
 	}
 
 	/// Return the size of the file in bytes.
-	uint32_t size() const
+	u32 size() const
 	{
 #if CROWN_PLATFORM_POSIX
 		size_t pos = position();
@@ -113,7 +113,7 @@ public:
 		CE_ASSERT(err == 0, "fseek: errno = %d", errno);
 		CE_UNUSED(err);
 
-		return (uint32_t)size;
+		return (u32)size;
 #elif CROWN_PLATFORM_WINDOWS
 		return GetFileSize(_file, NULL);
 #endif
@@ -121,13 +121,13 @@ public:
 
 	/// Reads @a size bytes from the file and stores it into @a data.
 	/// Returns the number of bytes read.
-	uint32_t read(void* data, uint32_t size)
+	u32 read(void* data, u32 size)
 	{
 		CE_ASSERT(data != NULL, "Data must be != NULL");
 #if CROWN_PLATFORM_POSIX
 		size_t bytes_read = fread(data, 1, size, _file);
 		CE_ASSERT(ferror(_file) == 0, "fread error");
-		return (uint32_t)bytes_read;
+		return (u32)bytes_read;
 #elif CROWN_PLATFORM_WINDOWS
 		DWORD bytes_read;
 		BOOL result = ReadFile(_file, data, size, &bytes_read, NULL);
@@ -142,13 +142,13 @@ public:
 
 	/// Writes @a size bytes of data stored in @a data and returns the
 	/// number of bytes written.
-	uint32_t write(const void* data, uint32_t size)
+	u32 write(const void* data, u32 size)
 	{
 		CE_ASSERT(data != NULL, "Data must be != NULL");
 #if CROWN_PLATFORM_POSIX
 		size_t bytes_written = fwrite(data, 1, size, _file);
 		CE_ASSERT(ferror(_file) == 0, "fwrite error");
-		return (uint32_t)bytes_written;
+		return (u32)bytes_written;
 #elif CROWN_PLATFORM_WINDOWS
 		DWORD bytes_written;
 		WriteFile(_file, data, size, &bytes_written, NULL);
@@ -170,7 +170,7 @@ public:
 	}
 
 	/// Moves the file pointer to the given @a position.
-	void seek(uint32_t position)
+	void seek(u32 position)
 	{
 #if CROWN_PLATFORM_POSIX
 		int err = fseek(_file, (long)position, SEEK_SET);
@@ -197,7 +197,7 @@ public:
 
 	/// Moves the file pointer @a bytes bytes ahead the current
 	/// file pointer position.
-	void skip(uint32_t bytes)
+	void skip(u32 bytes)
 	{
 #if CROWN_PLATFORM_POSIX
 		int err = fseek(_file, bytes, SEEK_CUR);
@@ -211,16 +211,16 @@ public:
 
 	/// Returns the position of the file pointer from the
 	/// start of the file in bytes.
-	uint32_t position() const
+	u32 position() const
 	{
 #if CROWN_PLATFORM_POSIX
 		long pos = ftell(_file);
 		CE_ASSERT(pos != -1, "ftell: errno = %d", errno);
-		return (uint32_t)pos;
+		return (u32)pos;
 #elif CROWN_PLATFORM_WINDOWS
 		DWORD pos = SetFilePointer(_file, 0, NULL, FILE_CURRENT);
 		CE_ASSERT(pos != INVALID_SET_FILE_POINTER, "SetFilePointer: GetLastError = %d", GetLastError());
-		return (uint32_t)pos;
+		return (u32)pos;
 #endif
 		CE_UNUSED(pos);
 	}

+ 2 - 2
src/core/filesystem/path.cpp

@@ -33,8 +33,8 @@ namespace path
 
 	void join(const char* a, const char* b, DynamicString& path)
 	{
-		const uint32_t la = strlen32(a);
-		const uint32_t lb = strlen32(b);
+		const u32 la = strlen32(a);
+		const u32 lb = strlen32(b);
 		path.reserve(la + lb + 1);
 		path += a;
 		path += PATH_SEPARATOR;

+ 4 - 4
src/core/filesystem/reader_writer.h

@@ -24,7 +24,7 @@ public:
 	{
 	}
 
-	void write(const void* data, uint32_t size)
+	void write(const void* data, u32 size)
 	{
 		_file.write(data, size);
 	}
@@ -35,7 +35,7 @@ public:
 		_file.write(&data, sizeof(T));
 	}
 
-	void skip(uint32_t bytes)
+	void skip(u32 bytes)
 	{
 		_file.skip(bytes);
 	}
@@ -55,7 +55,7 @@ public:
 	{
 	}
 
-	void read(void* data, uint32_t size)
+	void read(void* data, u32 size)
 	{
 		_file.read(data, size);
 	}
@@ -66,7 +66,7 @@ public:
 		_file.read(&data, sizeof(T));
 	}
 
-	void skip(uint32_t bytes)
+	void skip(u32 bytes)
 	{
 		_file.skip(bytes);
 	}

+ 2 - 2
src/core/integer.h

@@ -9,7 +9,7 @@
 
 namespace crown
 {
-inline uint32_t next_pow_2(uint32_t x)
+inline u32 next_pow_2(u32 x)
 {
 	x--;
 
@@ -22,7 +22,7 @@ inline uint32_t next_pow_2(uint32_t x)
 	return ++x;
 }
 
-inline bool is_pow_2(uint32_t x)
+inline bool is_pow_2(u32 x)
 {
 	return !(x & (x - 1)) && x;
 }

+ 7 - 7
src/core/json/json.cpp

@@ -118,7 +118,7 @@ namespace json
 		CE_FATAL("Bad string");
 	}
 
-	double parse_number(const char* json)
+	f64 parse_number(const char* json)
 	{
 		CE_ASSERT_NOT_NULL(json);
 
@@ -165,9 +165,9 @@ namespace json
 		// Ensure null terminated
 		array::push_back(number, '\0');
 
-		double val;
+		f64 val;
 		int ok = sscanf(array::begin(number), "%lf", &val);
-		CE_ASSERT(ok == 1, "Failed to parse double: %s", array::begin(number));
+		CE_ASSERT(ok == 1, "Failed to parse f64: %s", array::begin(number));
 		CE_UNUSED(ok);
 		return val;
 	}
@@ -203,14 +203,14 @@ namespace json
 		}
 	}
 
-	int32_t parse_int(const char* json)
+	s32 parse_int(const char* json)
 	{
-		return (int32_t) parse_number(json);
+		return (s32) parse_number(json);
 	}
 
-	float parse_float(const char* json)
+	f32 parse_float(const char* json)
 	{
-		return (float) parse_number(json);
+		return (f32) parse_number(json);
 	}
 
 	void parse_array(const char* json, JsonArray& array)

+ 5 - 5
src/core/json/json.h

@@ -21,14 +21,14 @@ namespace json
 	/// Parses the JSON string @a json ad puts it into @a string.
 	void parse_string(const char* json, DynamicString& string);
 
-	/// Returns the JSON number @a json as double.
-	double parse_number(const char* json);
+	/// Returns the JSON number @a json as f64.
+	f64 parse_number(const char* json);
 
 	/// Returns the JSON number @a json as int.
-	int32_t parse_int(const char* json);
+	s32 parse_int(const char* json);
 
-	/// Returns the JSON number @a json as float.
-	float parse_float(const char* json);
+	/// Returns the JSON number @a json as f32.
+	f32 parse_float(const char* json);
 
 	/// Returns the JSON boolean @a json as bool.
 	bool parse_bool(const char* json);

+ 8 - 8
src/core/json/sjson.cpp

@@ -185,7 +185,7 @@ namespace sjson
 		return NULL;
 	}
 
-	double parse_number(const char* json)
+	f64 parse_number(const char* json)
 	{
 		CE_ASSERT_NOT_NULL(json);
 
@@ -232,9 +232,9 @@ namespace sjson
 		// Ensure null terminated
 		array::push_back(number, '\0');
 
-		double val;
+		f64 val;
 		int ok = sscanf(array::begin(number), "%lf", &val);
-		CE_ASSERT(ok == 1, "Failed to parse double: %s", array::begin(number));
+		CE_ASSERT(ok == 1, "Failed to parse f64: %s", array::begin(number));
 		CE_UNUSED(ok);
 		return val;
 	}
@@ -270,14 +270,14 @@ namespace sjson
 		}
 	}
 
-	int32_t parse_int(const char* json)
+	s32 parse_int(const char* json)
 	{
-		return (int32_t) parse_number(json);
+		return (s32) parse_number(json);
 	}
 
-	float parse_float(const char* json)
+	f32 parse_float(const char* json)
 	{
-		return (float) parse_number(json);
+		return (f32) parse_number(json);
 	}
 
 	void parse_array(const char* json, JsonArray& array)
@@ -537,7 +537,7 @@ namespace sjson
 		axis.y = sjson::parse_float(array[1]);
 		axis.z = sjson::parse_float(array[2]);
 
-		float angle = sjson::parse_float(array[3]);
+		f32 angle = sjson::parse_float(array[3]);
 
 		return quaternion(axis, angle);
 	}

+ 5 - 5
src/core/json/sjson.h

@@ -22,14 +22,14 @@ namespace sjson
 	/// Parses the SJSON string @a json ad puts it into @a string.
 	void parse_string(const char* json, DynamicString& string);
 
-	/// Returns the SJSON number @a json as double.
-	double parse_number(const char* json);
+	/// Returns the SJSON number @a json as f64.
+	f64 parse_number(const char* json);
 
 	/// Returns the SJSON number @a json as int.
-	int32_t parse_int(const char* json);
+	s32 parse_int(const char* json);
 
-	/// Returns the SJSON number @a json as float.
-	float parse_float(const char* json);
+	/// Returns the SJSON number @a json as f32.
+	f32 parse_float(const char* json);
 
 	/// Returns the SJSON boolean @a json as bool.
 	bool parse_bool(const char* json);

+ 14 - 14
src/core/math/aabb.h

@@ -25,25 +25,25 @@ namespace aabb
 	Vector3 center(const AABB& b);
 
 	/// Returns the radius of the box @a b.
-	float radius(const AABB& b);
+	f32 radius(const AABB& b);
 
 	/// Returns the volume of the box @a b.
-	float volume(const AABB& b);
+	f32 volume(const AABB& b);
 
 	/// Adds @a num @a points to the box @a b, expanding its bounds if necessary.
-	void add_points(AABB& a, uint32_t num, uint32_t stride, const void* points);
+	void add_points(AABB& a, u32 num, u32 stride, const void* points);
 
 	/// Adds @a num @a points to the box @a b, expanding its bounds if necessary.
-	void add_points(AABB& b, uint32_t num, const Vector3* points);
+	void add_points(AABB& b, u32 num, const Vector3* points);
 
 	/// Adds @a num @a boxes to the box @a b, expanding its bounds if necessary.
-	void add_boxes(AABB& b, uint32_t num, const AABB* boxes);
+	void add_boxes(AABB& b, u32 num, const AABB* boxes);
 
 	/// Returns whether point @a p is contained in the box @a b.
 	bool contains_point(const AABB& b, const Vector3& p);
 
 	/// Returns the @a index -th vertex of the box.
-	Vector3 vertex(const AABB& b, uint32_t index);
+	Vector3 vertex(const AABB& b, u32 index);
 
 	/// Returns the box enclosing @a b transformed by @a m.
 	AABB transformed(const AABB& b, const Matrix4x4& m);
@@ -68,18 +68,18 @@ namespace aabb
 		return (b.min + b.max) * 0.5f;
 	}
 
-	inline float radius(const AABB& b)
+	inline f32 radius(const AABB& b)
 	{
 		return length(b.max - (b.min + b.max) * 0.5f);
 	}
-	inline float volume(const AABB& b)
+	inline f32 volume(const AABB& b)
 	{
 		return (b.max.x - b.min.x) * (b.max.y - b.min.y) * (b.max.z - b.min.z);
 	}
 
-	inline void add_points(AABB& b, uint32_t num, uint32_t stride, const void* points)
+	inline void add_points(AABB& b, u32 num, u32 stride, const void* points)
 	{
-		for (uint32_t i = 0; i < num; ++i)
+		for (u32 i = 0; i < num; ++i)
 		{
 			const Vector3* p = (const Vector3*)points;
 
@@ -94,14 +94,14 @@ namespace aabb
 		}
 	}
 
-	inline void add_points(AABB& b, uint32_t num, const Vector3* points)
+	inline void add_points(AABB& b, u32 num, const Vector3* points)
 	{
 		add_points(b, num, sizeof(Vector3), points);
 	}
 
-	inline void add_boxes(AABB& b, uint32_t num, const AABB* boxes)
+	inline void add_boxes(AABB& b, u32 num, const AABB* boxes)
 	{
-		for (uint32_t i = 0; i < num; ++i)
+		for (u32 i = 0; i < num; ++i)
 		{
 			const AABB& box = boxes[i];
 
@@ -125,7 +125,7 @@ namespace aabb
 			;
 	}
 
-	inline Vector3 vertex(const AABB& b, uint32_t index)
+	inline Vector3 vertex(const AABB& b, u32 index)
 	{
 		switch (index)
 		{

+ 26 - 26
src/core/math/color4.h

@@ -14,7 +14,7 @@ namespace crown
 /// @{
 
 /// Returns a new color from individual elements.
-inline Color4 color4(float r, float g, float b, float a)
+inline Color4 color4(f32 r, f32 g, f32 b, f32 a)
 {
 	Color4 c;
 	c.x = r;
@@ -25,7 +25,7 @@ inline Color4 color4(float r, float g, float b, float a)
 }
 
 /// Returns a new color from individual elements. Alpha is set to 255.
-inline Color4 from_rgb(uint8_t r, uint8_t g, uint8_t b)
+inline Color4 from_rgb(u8 r, u8 g, u8 b)
 {
 	Color4 c;
 	c.x = 1.0f/255.0f * r;
@@ -36,7 +36,7 @@ inline Color4 from_rgb(uint8_t r, uint8_t g, uint8_t b)
 }
 
 /// Returns a new color from individual elements.
-inline Color4 from_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
+inline Color4 from_rgba(u8 r, u8 g, u8 b, u8 a)
 {
 	Color4 c;
 	c.x = 1.0f/255.0f * r;
@@ -47,7 +47,7 @@ inline Color4 from_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 }
 
 /// Returns a new color from packed RGBA integer.
-inline Color4 from_rgba(uint32_t rgba)
+inline Color4 from_rgba(u32 rgba)
 {
 	Color4 c;
 	c.x = 1.0f/255.0f * ((rgba & 0xff000000) >> 24);
@@ -58,46 +58,46 @@ inline Color4 from_rgba(uint32_t rgba)
 }
 
 /// Returns the color as a packed RGBA integer. Alpha is set to 255.
-inline uint32_t to_rgb(const Color4& c)
+inline u32 to_rgb(const Color4& c)
 {
-	uint32_t rgba;
-	rgba =	(uint32_t)(255.0f * c.x) << 24;
-	rgba |= (uint32_t)(255.0f * c.y) << 16;
-	rgba |= (uint32_t)(255.0f * c.z) << 8;
+	u32 rgba;
+	rgba =	(u32)(255.0f * c.x) << 24;
+	rgba |= (u32)(255.0f * c.y) << 16;
+	rgba |= (u32)(255.0f * c.z) << 8;
 	rgba |= 255;
 	return rgba;
 }
 
 /// Returns the color as a packed ABGR integer. Alpha is set to 255.
-inline uint32_t to_bgr(const Color4& c)
+inline u32 to_bgr(const Color4& c)
 {
-	uint32_t abgr;
+	u32 abgr;
 	abgr =	255 << 24;
-	abgr |= (uint32_t)(255.0f * c.z) << 16;
-	abgr |= (uint32_t)(255.0f * c.y) << 8;
-	abgr |= (uint32_t)(255.0f * c.x);
+	abgr |= (u32)(255.0f * c.z) << 16;
+	abgr |= (u32)(255.0f * c.y) << 8;
+	abgr |= (u32)(255.0f * c.x);
 	return abgr;
 }
 
 /// Returns the color as a packed 32-bit integer. (RGBA order)
-inline uint32_t to_rgba(const Color4& c)
+inline u32 to_rgba(const Color4& c)
 {
-	uint32_t rgba;
-	rgba =	(uint32_t)(255.0f * c.x) << 24;
-	rgba |= (uint32_t)(255.0f * c.y) << 16;
-	rgba |= (uint32_t)(255.0f * c.z) << 8;
-	rgba |= (uint32_t)(255.0f * c.w);
+	u32 rgba;
+	rgba =	(u32)(255.0f * c.x) << 24;
+	rgba |= (u32)(255.0f * c.y) << 16;
+	rgba |= (u32)(255.0f * c.z) << 8;
+	rgba |= (u32)(255.0f * c.w);
 	return rgba;
 }
 
 /// Returns the color as a packed 32-bit integer. (ABGR order)
-inline uint32_t to_abgr(const Color4& c)
+inline u32 to_abgr(const Color4& c)
 {
-	uint32_t abgr;
-	abgr =	(uint32_t)(255.0f * c.w) << 24;
-	abgr |= (uint32_t)(255.0f * c.z) << 16;
-	abgr |= (uint32_t)(255.0f * c.y) << 8;
-	abgr |= (uint32_t)(255.0f * c.x);
+	u32 abgr;
+	abgr =	(u32)(255.0f * c.w) << 24;
+	abgr |= (u32)(255.0f * c.z) << 16;
+	abgr |= (u32)(255.0f * c.y) << 8;
+	abgr |= (u32)(255.0f * c.x);
 	return abgr;
 }
 

+ 2 - 2
src/core/math/frustum.h

@@ -34,7 +34,7 @@ namespace frustum
 	/// 5 = Far bottom right
 	/// 6 = Far top right
 	/// 7 = Far top left
-	Vector3 vertex(const Frustum& f, uint32_t index);
+	Vector3 vertex(const Frustum& f, u32 index);
 
 	/// Returns the AABB enclosing the frustum @a f.
 	AABB to_aabb(const Frustum& f);
@@ -93,7 +93,7 @@ namespace frustum
 			);
 	}
 
-	inline Vector3 vertex(const Frustum& f, uint32_t index)
+	inline Vector3 vertex(const Frustum& f, u32 index)
 	{
 		CE_ASSERT(index < 8, "Index out of bounds");
 

+ 31 - 31
src/core/math/intersection.cpp

@@ -11,10 +11,10 @@
 
 namespace crown
 {
-float ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plane& p)
+f32 ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plane& p)
 {
-	const float num = dot(from, p.n);
-	const float den = dot(dir, p.n);
+	const f32 num = dot(from, p.n);
+	const f32 den = dot(dir, p.n);
 
 	if (fequal(den, 0.0f))
 		return -1.0f;
@@ -22,10 +22,10 @@ float ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plan
 	return (-p.d - num) / den;
 }
 
-float ray_disc_intersection(const Vector3& from, const Vector3& dir, const Vector3& center, float radius, const Vector3& normal)
+f32 ray_disc_intersection(const Vector3& from, const Vector3& dir, const Vector3& center, f32 radius, const Vector3& normal)
 {
 	const Plane p = plane::from_point_and_normal(center, normal);
-	const float t = ray_plane_intersection(from, dir, p);
+	const f32 t = ray_plane_intersection(from, dir, p);
 
 	if (t == -1.0f)
 		return -1.0f;
@@ -37,13 +37,13 @@ float ray_disc_intersection(const Vector3& from, const Vector3& dir, const Vecto
 	return -1.0f;
 }
 
-float ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sphere& s)
+f32 ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sphere& s)
 {
 	const Vector3 v = s.c - from;
-	const float b   = dot(v, dir);
-	const float rr  = s.r * s.r;
-	const float bb  = b * b;
-	const float det = rr - dot(v, v) + bb;
+	const f32 b   = dot(v, dir);
+	const f32 rr  = s.r * s.r;
+	const f32 bb  = b * b;
+	const f32 det = rr - dot(v, v) + bb;
 
 	if (det < 0.0f || b < s.r)
 		return -1.0f;
@@ -52,26 +52,26 @@ float ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sph
 }
 
 // http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-custom-ray-obb-function/
-float ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix4x4& tm, const Vector3& half_extents)
+f32 ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix4x4& tm, const Vector3& half_extents)
 {
-	float tmin = 0.0f;
-	float tmax = 100000.0f;
+	f32 tmin = 0.0f;
+	f32 tmax = 100000.0f;
 
 	const Vector3 obb_pos = vector3(tm.t.x, tm.t.y, tm.t.z);
 	const Vector3 delta = obb_pos - from;
 
 	{
 		const Vector3 xaxis = vector3(tm.x.x, tm.x.y, tm.x.z);
-		const float e = dot(xaxis, delta);
-		const float f = dot(dir, xaxis);
+		const f32 e = dot(xaxis, delta);
+		const f32 f = dot(dir, xaxis);
 
 		if (fabs(f) > 0.001f)
 		{
-			float t1 = (e-half_extents.x)/f;
-			float t2 = (e+half_extents.x)/f;
+			f32 t1 = (e-half_extents.x)/f;
+			f32 t2 = (e+half_extents.x)/f;
 
 			if (t1>t2){
-				float w=t1;t1=t2;t2=w;
+				f32 w=t1;t1=t2;t2=w;
 			}
 
 			if (t2 < tmax)
@@ -92,15 +92,15 @@ float ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix
 
 	{
 		const Vector3 yaxis = vector3(tm.y.x, tm.y.y, tm.y.z);
-		const float e = dot(yaxis, delta);
-		const float f = dot(dir, yaxis);
+		const f32 e = dot(yaxis, delta);
+		const f32 f = dot(dir, yaxis);
 
 		if (fabs(f) > 0.001f){
 
-			float t1 = (e-half_extents.y)/f;
-			float t2 = (e+half_extents.y)/f;
+			f32 t1 = (e-half_extents.y)/f;
+			f32 t2 = (e+half_extents.y)/f;
 
-			if (t1>t2){float w=t1;t1=t2;t2=w;}
+			if (t1>t2){f32 w=t1;t1=t2;t2=w;}
 
 			if (t2 < tmax)
 				tmax = t2;
@@ -119,15 +119,15 @@ float ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix
 
 	{
 		const Vector3 zaxis = vector3(tm.z.x, tm.z.y, tm.z.z);
-		const float e = dot(zaxis, delta);
-		const float f = dot(dir, zaxis);
+		const f32 e = dot(zaxis, delta);
+		const f32 f = dot(dir, zaxis);
 
 		if (fabs(f) > 0.001f){
 
-			float t1 = (e-half_extents.z)/f;
-			float t2 = (e+half_extents.z)/f;
+			f32 t1 = (e-half_extents.z)/f;
+			f32 t2 = (e+half_extents.z)/f;
 
-			if (t1>t2){float w=t1;t1=t2;t2=w;}
+			if (t1>t2){f32 w=t1;t1=t2;t2=w;}
 
 			if (t2 < tmax)
 				tmax = t2;
@@ -153,12 +153,12 @@ bool plane_3_intersection(const Plane& a, const Plane& b, const Plane& c, Vector
 	const Vector3 na = a.n;
 	const Vector3 nb = b.n;
 	const Vector3 nc = c.n;
-	const float den  = -dot(cross(na, nb), nc);
+	const f32 den  = -dot(cross(na, nb), nc);
 
 	if (fequal(den, 0.0f))
 		return false;
 
-	const float inv_den = 1.0f / den;
+	const f32 inv_den = 1.0f / den;
 
 	const Vector3 nbnc = a.d * cross(nb, nc);
 	const Vector3 ncna = b.d * cross(nc, na);
@@ -203,7 +203,7 @@ bool frustum_box_intersection(const Frustum& f, const AABB& b)
 	const Vector3 v6 = aabb::vertex(b, 6);
 	const Vector3 v7 = aabb::vertex(b, 7);
 
-	uint8_t out = 0;
+	u8 out = 0;
 	out += (plane::distance_to_point(f.left, v0) < 0.0f) ? 1 : 0;
 	out += (plane::distance_to_point(f.left, v1) < 0.0f) ? 1 : 0;
 	out += (plane::distance_to_point(f.left, v2) < 0.0f) ? 1 : 0;

+ 4 - 4
src/core/math/intersection.h

@@ -14,19 +14,19 @@ namespace crown
 
 /// Returns the distance along ray (from, dir) to intersection point with plane @a p
 /// or -1.0 if no intersection.
-float ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plane& p);
+f32 ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plane& p);
 
 /// Returns the distance along ray (from, dir) to intersection point with disc defined by
 /// @a center, @a radius and @a normal or -1.0 if no intersection.
-float ray_disc_intersection(const Vector3& from, const Vector3& dir, const Vector3& center, float radius, const Vector3& normal);
+f32 ray_disc_intersection(const Vector3& from, const Vector3& dir, const Vector3& center, f32 radius, const Vector3& normal);
 
 /// Returns the distance along ray (from, dir) to intersection point with sphere @a s
 /// or -1.0 if no intersection.
-float ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sphere& s);
+f32 ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sphere& s);
 
 /// Returns the distance along ray (from, dir) to intersection point with the oriented
 /// bounding box (tm, half_extents) or -1.0 if no intersection.
-float ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix4x4& tm, const Vector3& half_extents);
+f32 ray_obb_intersection(const Vector3& from, const Vector3& dir, const Matrix4x4& tm, const Vector3& half_extents);
 
 /// Returns whether the planes @a a, @a b and @a c intersects and if so fills @a ip with the intersection point.
 bool plane_3_intersection(const Plane& a, const Plane& b, const Plane& c, Vector3& ip);

+ 8 - 6
src/core/math/math_types.h

@@ -5,25 +5,27 @@
 
 #pragma once
 
+#include "types.h"
+
 /// @defgroup Math Math
 namespace crown
 {
 /// @ingroup Math
 struct Vector2
 {
-	float x, y;
+	f32 x, y;
 };
 
 /// @ingroup Math
 struct Vector3
 {
-	float x, y, z;
+	f32 x, y, z;
 };
 
 /// @ingroup Math
 struct Vector4
 {
-	float x, y, z, w;
+	f32 x, y, z, w;
 };
 
 /// Holds RGBA color as four floats.
@@ -32,7 +34,7 @@ typedef Vector4 Color4;
 /// @ingroup Math
 struct Quaternion
 {
-	float x, y, z, w;
+	f32 x, y, z, w;
 };
 
 /// @ingroup Math
@@ -69,7 +71,7 @@ struct OBB
 struct Plane
 {
 	Vector3 n;
-	float d;
+	f32 d;
 };
 
 /// @ingroup Math
@@ -87,7 +89,7 @@ struct Frustum
 struct Sphere
 {
 	Vector3 c;
-	float r;
+	f32 r;
 };
 
 const Vector2 VECTOR2_ZERO = { 0.0f, 0.0f };

+ 28 - 28
src/core/math/math_utils.h

@@ -12,75 +12,75 @@ namespace crown
 /// @addtogroup Math
 /// @{
 
-const float PI              = 3.1415926535897932f;
-const float TWO_PI          = PI * 2.0f;
-const float HALF_PI         = PI * 0.5f;
-const float FLOAT_PRECISION = 1.0e-7f;
+const f32 PI              = 3.1415926535897932f;
+const f32 TWO_PI          = PI * 2.0f;
+const f32 HALF_PI         = PI * 0.5f;
+const f32 FLOAT_PRECISION = 1.0e-7f;
 
-inline bool fequal(float a, float b, float precision = FLOAT_PRECISION)
+inline bool fequal(f32 a, f32 b, f32 precision = FLOAT_PRECISION)
 {
 	return ((b <= (a + precision)) && (b >= (a - precision)));
 }
 
-inline float fmin(float a, float b)
+inline f32 fmin(f32 a, f32 b)
 {
 	return a < b ? a : b;
 }
 
-inline float fmax(float a, float b)
+inline f32 fmax(f32 a, f32 b)
 {
 	return a < b ? b : a;
 }
 
-inline float fclamp(float min, float max, float val)
+inline f32 fclamp(f32 min, f32 max, f32 val)
 {
 	return fmin(fmax(min, val), max);
 }
 
-inline float to_rad(float deg)
+inline f32 to_rad(f32 deg)
 {
 	return deg * PI / 180.0f;
 }
 
-inline float to_deg(float rad)
+inline f32 to_deg(f32 rad)
 {
 	return rad * 180.0f / PI;
 }
 
 /// Returns the linear interpolated value between @a p0 and @a p1 at time @a t
-inline float lerp(const float p0, const float p1, float t)
+inline f32 lerp(const f32 p0, const f32 p1, f32 t)
 {
 	return (1.0f - t) * p0 + t * p1;
 }
 
 /// Returns the cosine interpolated value between @a p0 and @a p1 at time @a t
-inline float cosine(const float p0, const float p1, float t)
+inline f32 cosine(const f32 p0, const f32 p1, f32 t)
 {
-	const float f = t * PI;
-	const float g = (1.0f - cosf(f)) * 0.5f;
+	const f32 f = t * PI;
+	const f32 g = (1.0f - cosf(f)) * 0.5f;
 
 	return p0 + g * (p1 - p0);
 }
 
 /// Returns the cubic interpolated value between @a p0 and @a p1 at time @a t
-inline float cubic(const float p0, const float p1, float t)
+inline f32 cubic(const f32 p0, const f32 p1, f32 t)
 {
-	const float tt  = t * t;
-	const float ttt = tt * t;
+	const f32 tt  = t * t;
+	const f32 ttt = tt * t;
 
 	return p0 * (2.0f * ttt - 3.0f * tt + 1.0f) + p1 * (3.0f * tt  - 2.0f * ttt);
 }
 
 /// Bezier interpolation
-inline float bezier(const float p0, const float p1, const float p2, const float p3, float t)
+inline f32 bezier(const f32 p0, const f32 p1, const f32 p2, const f32 p3, f32 t)
 {
-	const float u   = 1.0f - t;
-	const float tt  = t * t ;
-	const float uu  = u * u;
-	const float uuu = uu * u;
-	const float ttt = tt * t;
+	const f32 u   = 1.0f - t;
+	const f32 tt  = t * t ;
+	const f32 uu  = u * u;
+	const f32 uuu = uu * u;
+	const f32 ttt = tt * t;
 
-	const float tmp = (uuu * p0)
+	const f32 tmp = (uuu * p0)
 		+ (3.0f * uu * t * p1)
 		+ (3.0f * u * tt * p2)
 		+ (ttt * p3);
@@ -89,12 +89,12 @@ inline float bezier(const float p0, const float p1, const float p2, const float
 }
 
 /// Catmull-Rom interpolation
-inline float catmull_rom(const float p0, const float p1, const float p2, const float p3, float t)
+inline f32 catmull_rom(const f32 p0, const f32 p1, const f32 p2, const f32 p3, f32 t)
 {
-	const float tt  = t * t;
-	const float ttt = tt * t;
+	const f32 tt  = t * t;
+	const f32 ttt = tt * t;
 
-	const float tmp = (2.0f * p1)
+	const f32 tmp = (2.0f * p1)
 		+ (-p0 + p2) * t
 		+ ((2.0f * p0) - (5.0f * p1) + (4.0f * p2) - p3) * tt
 		+ (-p0 + (3.0f * p1) + (-3.0f * p2) + p3) * ttt;

+ 22 - 22
src/core/math/matrix3x3.h

@@ -57,7 +57,7 @@ inline Matrix3x3& operator-=(Matrix3x3& a, const Matrix3x3& b)
 	return a;
 }
 
-inline Matrix3x3& operator*=(Matrix3x3& a, float k)
+inline Matrix3x3& operator*=(Matrix3x3& a, f32 k)
 {
 	a.x *= k;
 	a.y *= k;
@@ -99,14 +99,14 @@ inline Matrix3x3 operator-(Matrix3x3 a, const Matrix3x3& b)
 }
 
 /// Multiplies the matrix @a a by the scalar @a k and returns the result.
-inline Matrix3x3 operator*(Matrix3x3 a, float k)
+inline Matrix3x3 operator*(Matrix3x3 a, f32 k)
 {
 	a *= k;
 	return a;
 }
 
 /// Multiplies the matrix @a a by the scalar @a k and returns the result.
-inline Matrix3x3 operator*(float k, Matrix3x3 a)
+inline Matrix3x3 operator*(f32 k, Matrix3x3 a)
 {
 	a *= k;
 	return a;
@@ -132,7 +132,7 @@ inline Matrix3x3 operator*(Matrix3x3 a, const Matrix3x3& b)
 /// Transposes the matrix @a m and returns the result.
 inline Matrix3x3& transpose(Matrix3x3& m)
 {
-	float tmp;
+	f32 tmp;
 
 	tmp = m.x.y;
 	m.x.y = m.y.x;
@@ -157,7 +157,7 @@ inline Matrix3x3 get_transposed(Matrix3x3 m)
 }
 
 /// Returns the determinant of the matrix @a m.
-inline float determinant(const Matrix3x3& m)
+inline f32 determinant(const Matrix3x3& m)
 {
 	return	+ m.x.x * (m.y.y * m.z.z - m.z.y * m.y.z)
 			- m.y.x * (m.x.y * m.z.z - m.z.y * m.x.z)
@@ -168,18 +168,18 @@ inline float determinant(const Matrix3x3& m)
 /// Inverts the matrix @a m and returns the result.
 inline Matrix3x3& invert(Matrix3x3& m)
 {
-	const float xx = m.x.x;
-	const float xy = m.x.y;
-	const float xz = m.x.z;
-	const float yx = m.y.x;
-	const float yy = m.y.y;
-	const float yz = m.y.z;
-	const float zx = m.z.x;
-	const float zy = m.z.y;
-	const float zz = m.z.z;
-
-	const float det = determinant(m);
-	const float inv_det = 1.0f / det;
+	const f32 xx = m.x.x;
+	const f32 xy = m.x.y;
+	const f32 xz = m.x.z;
+	const f32 yx = m.y.x;
+	const f32 yy = m.y.y;
+	const f32 yz = m.y.z;
+	const f32 zx = m.z.x;
+	const f32 zy = m.z.y;
+	const f32 zz = m.z.z;
+
+	const f32 det = determinant(m);
+	const f32 inv_det = 1.0f / det;
 
 	m.x.x = + (yy*zz - zy*yz) * inv_det;
 	m.x.y = - (xy*zz - zy*xz) * inv_det;
@@ -222,9 +222,9 @@ inline void set_identity(Matrix3x3& m)
 /// Returns the scale of the matrix @a m.
 inline Vector3 scale(const Matrix3x3& m)
 {
-	const float sx = length(m.x);
-	const float sy = length(m.y);
-	const float sz = length(m.z);
+	const f32 sx = length(m.x);
+	const f32 sy = length(m.y);
+	const f32 sz = length(m.z);
 	Vector3 v;
 	v.x = sx;
 	v.y = sy;
@@ -241,13 +241,13 @@ inline void set_scale(Matrix3x3& m, const Vector3& s)
 }
 
 /// Returns the pointer to the matrix's data
-inline float* to_float_ptr(Matrix3x3& m)
+inline f32* to_float_ptr(Matrix3x3& m)
 {
 	return &m.x.x;
 }
 
 /// Returns the pointer to the matrix's data
-inline const float* to_float_ptr(const Matrix3x3& m)
+inline const f32* to_float_ptr(const Matrix3x3& m)
 {
 	return &m.x.x;
 }

+ 59 - 59
src/core/math/matrix4x4.h

@@ -16,10 +16,10 @@ namespace crown
 /// @{
 
 /// Returns a new matrix from individual elements.
-inline Matrix4x4 matrix4x4(float xx, float xy, float xz, float xw
-	, float yx, float yy, float yz, float yw
-	, float zx, float zy, float zz, float zw
-	, float tx, float ty, float tz, float tw
+inline Matrix4x4 matrix4x4(f32 xx, f32 xy, f32 xz, f32 xw
+	, f32 yx, f32 yy, f32 yz, f32 yw
+	, f32 zx, f32 zy, f32 zz, f32 zw
+	, f32 tx, f32 ty, f32 tz, f32 tw
 	)
 {
 	Matrix4x4 m;
@@ -46,7 +46,7 @@ inline Matrix4x4 matrix4x4(float xx, float xy, float xz, float xw
 }
 
 /// Returns a new matrix from individual elements.
-inline Matrix4x4 matrix4x4(const float a[16])
+inline Matrix4x4 matrix4x4(const f32 a[16])
 {
 	Matrix4x4 m;
 	m.x.x = a[0];
@@ -167,7 +167,7 @@ inline Matrix4x4& operator-=(Matrix4x4& a, const Matrix4x4& b)
 	return a;
 }
 
-inline Matrix4x4& operator*=(Matrix4x4& a, float k)
+inline Matrix4x4& operator*=(Matrix4x4& a, f32 k)
 {
 	a.x *= k;
 	a.y *= k;
@@ -219,14 +219,14 @@ inline Matrix4x4 operator-(Matrix4x4 a, const Matrix4x4& b)
 }
 
 /// Multiplies the matrix @a a by the scalar @a k and returns the result.
-inline Matrix4x4 operator*(Matrix4x4 a, float k)
+inline Matrix4x4 operator*(Matrix4x4 a, f32 k)
 {
 	a *= k;
 	return a;
 }
 
 /// Multiplies the matrix @a a by the scalar @a k and returns the result.
-inline Matrix4x4 operator*(float k, Matrix4x4 a)
+inline Matrix4x4 operator*(f32 k, Matrix4x4 a)
 {
 	a *= k;
 	return a;
@@ -261,12 +261,12 @@ inline Matrix4x4 operator*(Matrix4x4 a, const Matrix4x4& b)
 }
 
 /// Sets the matrix @a m to perspective.
-inline void perspective(Matrix4x4& m, float fovy, float aspect, float near, float far)
+inline void perspective(Matrix4x4& m, f32 fovy, f32 aspect, f32 near, f32 far)
 {
-	const float height = 1.0f / tanf(to_rad(fovy) * 0.5f);
-	const float width = height * 1.0f / aspect;
-	const float aa = far / (far - near);
-	const float bb = -near * aa;
+	const f32 height = 1.0f / tanf(to_rad(fovy) * 0.5f);
+	const f32 width = height * 1.0f / aspect;
+	const f32 aa = far / (far - near);
+	const f32 bb = -near * aa;
 
 	m.x.x = width;
 	m.x.y = 0.0f;
@@ -290,7 +290,7 @@ inline void perspective(Matrix4x4& m, float fovy, float aspect, float near, floa
 }
 
 /// Sets the matrix @a m to orthographic.
-inline void orthographic(Matrix4x4& m, float left, float right, float bottom, float top, float near, float far)
+inline void orthographic(Matrix4x4& m, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far)
 {
 	m.x.x = 2.0f / (right - left);
 	m.x.y = 0.0f;
@@ -316,7 +316,7 @@ inline void orthographic(Matrix4x4& m, float left, float right, float bottom, fl
 /// Transposes the matrix @a m and returns the result.
 inline Matrix4x4& transpose(Matrix4x4& m)
 {
-	float tmp;
+	f32 tmp;
 
 	tmp = m.x.y;
 	m.x.y = m.y.x;
@@ -382,26 +382,26 @@ inline void look(Matrix4x4& m, const Vector3& pos, const Vector3& target, const
 }
 
 /// Returns the determinant of the matrix @a m.
-inline float determinant(const Matrix4x4& m)
-{
-	const float xx = m.x.x;
-	const float xy = m.x.y;
-	const float xz = m.x.z;
-	const float xw = m.x.w;
-	const float yx = m.y.x;
-	const float yy = m.y.y;
-	const float yz = m.y.z;
-	const float yw = m.y.w;
-	const float zx = m.z.x;
-	const float zy = m.z.y;
-	const float zz = m.z.z;
-	const float zw = m.z.w;
-	const float tx = m.t.x;
-	const float ty = m.t.y;
-	const float tz = m.t.z;
-	const float tw = m.t.w;
-
-	float det = 0.0f;
+inline f32 determinant(const Matrix4x4& m)
+{
+	const f32 xx = m.x.x;
+	const f32 xy = m.x.y;
+	const f32 xz = m.x.z;
+	const f32 xw = m.x.w;
+	const f32 yx = m.y.x;
+	const f32 yy = m.y.y;
+	const f32 yz = m.y.z;
+	const f32 yw = m.y.w;
+	const f32 zx = m.z.x;
+	const f32 zy = m.z.y;
+	const f32 zz = m.z.z;
+	const f32 zw = m.z.w;
+	const f32 tx = m.t.x;
+	const f32 ty = m.t.y;
+	const f32 tz = m.t.z;
+	const f32 tw = m.t.w;
+
+	f32 det = 0.0f;
 	det += + xx * (yy * (zz*tw - tz*zw) - zy * (yz*tw - tz*yw) + ty * (yz*zw - zz*yw));
 	det += - yx * (xy * (zz*tw - tz*zw) - zy * (xz*tw - tz*xw) + ty * (xz*zw - zz*xw));
 	det += + zx * (xy * (yz*tw - tz*yw) - yy * (xz*tw - tz*xw) + ty * (xz*yw - yz*xw));
@@ -413,25 +413,25 @@ inline float determinant(const Matrix4x4& m)
 /// Inverts the matrix @a m and returns the result.
 inline Matrix4x4& invert(Matrix4x4& m)
 {
-	const float xx = m.x.x;
-	const float xy = m.x.y;
-	const float xz = m.x.z;
-	const float xw = m.x.w;
-	const float yx = m.y.x;
-	const float yy = m.y.y;
-	const float yz = m.y.z;
-	const float yw = m.y.w;
-	const float zx = m.z.x;
-	const float zy = m.z.y;
-	const float zz = m.z.z;
-	const float zw = m.z.w;
-	const float tx = m.t.x;
-	const float ty = m.t.y;
-	const float tz = m.t.z;
-	const float tw = m.t.w;
-
-	const float det = determinant(m);
-	const float inv_det = 1.0f / det;
+	const f32 xx = m.x.x;
+	const f32 xy = m.x.y;
+	const f32 xz = m.x.z;
+	const f32 xw = m.x.w;
+	const f32 yx = m.y.x;
+	const f32 yy = m.y.y;
+	const f32 yz = m.y.z;
+	const f32 yw = m.y.w;
+	const f32 zx = m.z.x;
+	const f32 zy = m.z.y;
+	const f32 zz = m.z.z;
+	const f32 zw = m.z.w;
+	const f32 tx = m.t.x;
+	const f32 ty = m.t.y;
+	const f32 tz = m.t.z;
+	const f32 tw = m.t.w;
+
+	const f32 det = determinant(m);
+	const f32 inv_det = 1.0f / det;
 
 	m.x.x = + (yy * (zz*tw - tz*zw) - zy * (yz*tw - tz*yw) + ty * (yz*zw - zz*yw)) * inv_det;
 	m.x.y = - (xy * (zz*tw - tz*zw) - zy * (xz*tw - tz*xw) + ty * (xz*zw - zz*xw)) * inv_det;
@@ -608,9 +608,9 @@ inline void set_rotation(Matrix4x4& m, const Quaternion& rot)
 /// Returns the scale of the matrix @a m.
 inline Vector3 scale(const Matrix4x4& m)
 {
-	const float sx = length(to_vector3(m.x));
-	const float sy = length(to_vector3(m.y));
-	const float sz = length(to_vector3(m.z));
+	const f32 sx = length(to_vector3(m.x));
+	const f32 sy = length(to_vector3(m.y));
+	const f32 sz = length(to_vector3(m.z));
 	Vector3 v;
 	v.x = sx;
 	v.y = sy;
@@ -627,13 +627,13 @@ inline void set_scale(Matrix4x4& m, const Vector3& s)
 }
 
 /// Returns the pointer to the matrix's data
-inline float* to_float_ptr(Matrix4x4& m)
+inline f32* to_float_ptr(Matrix4x4& m)
 {
 	return to_float_ptr(m.x);
 }
 
 /// Returns the pointer to the matrix's data
-inline const float* to_float_ptr(const Matrix4x4& m)
+inline const f32* to_float_ptr(const Matrix4x4& m)
 {
 	return to_float_ptr(m.x);
 }

+ 4 - 4
src/core/math/plane.h

@@ -22,7 +22,7 @@ namespace plane
 	Plane& normalize(Plane& p);
 
 	/// Returns the signed distance between plane @a p and point @a point.
-	float distance_to_point(const Plane& p, const Vector3& point);
+	f32 distance_to_point(const Plane& p, const Vector3& point);
 
 } // namespace plane
 
@@ -38,12 +38,12 @@ namespace plane
 
 	inline Plane& normalize(Plane& p)
 	{
-		const float len = length(p.n);
+		const f32 len = length(p.n);
 
 		if (fequal(len, 0.0f))
 			return p;
 
-		const float inv_len = 1.0f / len;
+		const f32 inv_len = 1.0f / len;
 
 		p.n *= inv_len;
 		p.d *= inv_len;
@@ -51,7 +51,7 @@ namespace plane
 		return p;
 	}
 
-	inline float distance_to_point(const Plane& p, const Vector3& point)
+	inline f32 distance_to_point(const Plane& p, const Vector3& point)
 	{
 		return dot(p.n, point) + p.d;
 	}

+ 8 - 8
src/core/math/quaternion.cpp

@@ -12,12 +12,12 @@ namespace crown
 /// Returns the rotation portion of the matrix @a m as a Quaternion.
 Quaternion quaternion(const Matrix3x3& m)
 {
-	const float ww = m.x.x + m.y.y + m.z.z;
-	const float xx = m.x.x - m.y.y - m.z.z;
-	const float yy = m.y.y - m.x.x - m.z.z;
-	const float zz = m.z.z - m.x.x - m.y.y;
-	float max = ww;
-	uint32_t index = 0;
+	const f32 ww = m.x.x + m.y.y + m.z.z;
+	const f32 xx = m.x.x - m.y.y - m.z.z;
+	const f32 yy = m.y.y - m.x.x - m.z.z;
+	const f32 zz = m.z.z - m.x.x - m.y.y;
+	f32 max = ww;
+	u32 index = 0;
 
 	if (xx > max)
 	{
@@ -37,8 +37,8 @@ Quaternion quaternion(const Matrix3x3& m)
 		index = 3;
 	}
 
-	const float biggest = sqrtf(max + 1.0f) * 0.5f;
-	const float mult = 0.25f / biggest;
+	const f32 biggest = sqrtf(max + 1.0f) * 0.5f;
+	const f32 mult = 0.25f / biggest;
 
 	Quaternion tmp;
 	switch (index)

+ 22 - 22
src/core/math/quaternion.h

@@ -15,7 +15,7 @@ namespace crown
 /// @{
 
 /// Returns a new quaternion from individual elements.
-inline Quaternion quaternion(float x, float y, float z, float w)
+inline Quaternion quaternion(f32 x, f32 y, f32 z, f32 w)
 {
 	Quaternion q;
 	q.x = x;
@@ -26,11 +26,11 @@ inline Quaternion quaternion(float x, float y, float z, float w)
 }
 
 /// Returns a new quaternion from @a axis and @a angle.
-inline Quaternion quaternion(const Vector3& axis, float angle)
+inline Quaternion quaternion(const Vector3& axis, f32 angle)
 {
-	const float ha = angle * 0.5f;
-	const float sa = sinf(ha);
-	const float ca = cosf(ha);
+	const f32 ha = angle * 0.5f;
+	const f32 sa = sinf(ha);
+	const f32 ca = cosf(ha);
 	Quaternion q;
 	q.x = axis.x * sa;
 	q.y = axis.y * sa;
@@ -44,10 +44,10 @@ Quaternion quaternion(const Matrix3x3& m);
 
 inline Quaternion& operator*=(Quaternion& a, const Quaternion& b)
 {
-	const float tx = a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y;
-	const float ty = a.w*b.y + a.y*b.w + a.z*b.x - a.x*b.z;
-	const float tz = a.w*b.z + a.z*b.w + a.x*b.y - a.y*b.x;
-	const float tw = a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z;
+	const f32 tx = a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y;
+	const f32 ty = a.w*b.y + a.y*b.w + a.z*b.x - a.x*b.z;
+	const f32 tz = a.w*b.z + a.z*b.w + a.x*b.y - a.y*b.x;
+	const f32 tw = a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z;
 	a.x = tx;
 	a.y = ty;
 	a.z = tz;
@@ -74,7 +74,7 @@ inline Quaternion operator*(Quaternion a, const Quaternion& b)
 }
 
 /// Multiplies the quaternion @a a by the scalar @a k.
-inline Quaternion operator*(const Quaternion& q, float k)
+inline Quaternion operator*(const Quaternion& q, f32 k)
 {
 	Quaternion r;
 	r.x = q.x * k;
@@ -85,13 +85,13 @@ inline Quaternion operator*(const Quaternion& q, float k)
 }
 
 /// Returns the dot product between quaternions @a a and @a b.
-inline float dot(const Quaternion& a, const Quaternion& b)
+inline f32 dot(const Quaternion& a, const Quaternion& b)
 {
 	return a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z;
 }
 
 /// Returns the length of @a q.
-inline float length(const Quaternion& q)
+inline f32 length(const Quaternion& q)
 {
 	return sqrtf(dot(q, q));
 }
@@ -99,8 +99,8 @@ inline float length(const Quaternion& q)
 /// Normalizes the quaternion @a q and returns the result.
 inline Quaternion& normalize(Quaternion& q)
 {
-	const float len = length(q);
-	const float inv_len = 1.0f / len;
+	const f32 len = length(q);
+	const f32 inv_len = 1.0f / len;
 	q.x *= inv_len;
 	q.y *= inv_len;
 	q.z *= inv_len;
@@ -122,19 +122,19 @@ inline Quaternion conjugate(const Quaternion& q)
 /// Returns the inverse of quaternion @a q.
 inline Quaternion inverse(const Quaternion& q)
 {
-	const float len = length(q);
-	const float inv_len = 1.0f / len;
+	const f32 len = length(q);
+	const f32 inv_len = 1.0f / len;
 	return conjugate(q) * inv_len;
 }
 
 /// Returns the quaternion @a q raised to the power of @a exp.
-inline Quaternion power(const Quaternion& q, float exp)
+inline Quaternion power(const Quaternion& q, f32 exp)
 {
 	if (fabs(q.w) < 0.9999)
 	{
-		const float alpha = acos(q.w); // alpha = theta/2
-		const float new_alpha = alpha * exp;
-		const float mult = sinf(new_alpha) / sinf(alpha);
+		const f32 alpha = acos(q.w); // alpha = theta/2
+		const f32 new_alpha = alpha * exp;
+		const f32 mult = sinf(new_alpha) / sinf(alpha);
 
 		Quaternion r;
 		r.w = cosf(new_alpha);
@@ -182,9 +182,9 @@ inline Vector3 forward(const Quaternion& q)
 }
 
 /// Returns the linearly interpolated quaternion between *a* and *b* at time *t* in [0, 1]. It uses NLerp.
-inline Quaternion lerp(const Quaternion& a, const Quaternion& b, float t)
+inline Quaternion lerp(const Quaternion& a, const Quaternion& b, f32 t)
 {
-	const float t1 = 1.0f - t;
+	const f32 t1 = 1.0f - t;
 
 	Quaternion r;
 

+ 11 - 11
src/core/math/random.h

@@ -13,41 +13,41 @@ namespace crown
 struct Random
 {
 	/// Initializes the generator with the given @a seed.
-	Random(int32_t seed);
+	Random(s32 seed);
 
 	/// Returns a pseudo-random integer in the range [0, 32767].
-	int32_t integer();
+	s32 integer();
 
 	/// Returns a pseudo-random integer in the range [0, max).
-	int32_t integer(int32_t max);
+	s32 integer(s32 max);
 
-	/// Returns a pseudo-random float in the range [0.0, 1.0].
-	float unit_float();
+	/// Returns a pseudo-random f32 in the range [0.0, 1.0].
+	f32 unit_float();
 
 private:
 
-	int32_t _seed;
+	s32 _seed;
 };
 
-inline Random::Random(int32_t seed)
+inline Random::Random(s32 seed)
 	: _seed(seed)
 {
 }
 
-inline int32_t Random::integer()
+inline s32 Random::integer()
 {
 	_seed = 214013 * _seed + 13737667;
 	return (_seed >> 16) & 0x7fff;
 }
 
-inline int32_t Random::integer(int32_t max)
+inline s32 Random::integer(s32 max)
 {
 	return (max == 0) ? 0 : integer() % max;
 }
 
-inline float Random::unit_float()
+inline f32 Random::unit_float()
 {
-	return integer() / (float)0x7fff;
+	return integer() / (f32)0x7fff;
 }
 
 } // namespace crown

+ 13 - 13
src/core/math/sphere.h

@@ -21,16 +21,16 @@ namespace sphere
 	void reset(Sphere& s);
 
 	/// Returns the volume of the sphere @a s.
-	float volume(const Sphere& s);
+	f32 volume(const Sphere& s);
 
 	/// Adds @a num @a points to the sphere @a s, expanding its bounds if necessary.
-	void add_points(Sphere& s, uint32_t num, uint32_t stride, const void* points);
+	void add_points(Sphere& s, u32 num, u32 stride, const void* points);
 
 	/// Adds @a num @a points to the sphere expanding if necessary.
-	void add_points(Sphere& s, uint32_t num, const Vector3* points);
+	void add_points(Sphere& s, u32 num, const Vector3* points);
 
 	/// Adds @a num @a spheres expanding if necessary.
-	void add_spheres(Sphere& s, uint32_t num, const Sphere* spheres);
+	void add_spheres(Sphere& s, u32 num, const Sphere* spheres);
 
 	/// Returns whether point @a p is contained into the sphere.
 	bool contains_point(const Sphere& s, const Vector3& p);
@@ -44,18 +44,18 @@ namespace sphere
 		s.r = 0.0f;
 	}
 
-	inline float volume(const Sphere& s)
+	inline f32 volume(const Sphere& s)
 	{
 		return (4.0f/3.0f*PI) * (s.r*s.r*s.r);
 	}
 
-	inline void add_points(Sphere& s, uint32_t num, uint32_t stride, const void* points)
+	inline void add_points(Sphere& s, u32 num, u32 stride, const void* points)
 	{
-		for (uint32_t i = 0; i < num; ++i)
+		for (u32 i = 0; i < num; ++i)
 		{
 			const Vector3* p = (const Vector3*)points;
 
-			const float dist = length_squared(*p - s.c);
+			const f32 dist = length_squared(*p - s.c);
 			if (dist > s.r*s.r)
 				s.r = sqrtf(dist);
 
@@ -63,17 +63,17 @@ namespace sphere
 		}
 	}
 
-	inline void add_points(Sphere& s, uint32_t num, const Vector3* points)
+	inline void add_points(Sphere& s, u32 num, const Vector3* points)
 	{
 		add_points(s, num, sizeof(Vector3), points);
 	}
 
-	inline void add_spheres(Sphere& s, uint32_t num, const Sphere* spheres)
+	inline void add_spheres(Sphere& s, u32 num, const Sphere* spheres)
 	{
-		for (uint32_t i = 0; i < num; ++i)
+		for (u32 i = 0; i < num; ++i)
 		{
 			const Sphere si = spheres[i];
-			const float dist = length_squared(si.c - s.c);
+			const f32 dist = length_squared(si.c - s.c);
 
 			if (dist < (si.r + s.r) * (si.r + s.r))
 			{
@@ -85,7 +85,7 @@ namespace sphere
 
 	inline bool contains_point(const Sphere& s, const Vector3& p)
 	{
-		float dist = length_squared(p - s.c);
+		f32 dist = length_squared(p - s.c);
 		return dist < s.r*s.r;
 	}
 } // namespace sphere

+ 16 - 16
src/core/math/vector2.h

@@ -14,7 +14,7 @@ namespace crown
 /// @{
 
 /// Returns a new vector from individual elements.
-inline Vector2 vector2(float x, float y)
+inline Vector2 vector2(f32 x, f32 y)
 {
 	Vector2 v;
 	v.x = x;
@@ -36,7 +36,7 @@ inline Vector2& operator-=(Vector2& a, const Vector2& b)
 	return a;
 }
 
-inline Vector2& operator*=(Vector2& a, float k)
+inline Vector2& operator*=(Vector2& a, f32 k)
 {
 	a.x *= k;
 	a.y *= k;
@@ -67,14 +67,14 @@ inline Vector2 operator-(Vector2 a, const Vector2& b)
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector2 operator*(Vector2 a, float k)
+inline Vector2 operator*(Vector2 a, f32 k)
 {
 	a *= k;
 	return a;
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector2 operator*(float k, Vector2 a)
+inline Vector2 operator*(f32 k, Vector2 a)
 {
 	a *= k;
 	return a;
@@ -87,19 +87,19 @@ inline bool operator==(const Vector2& a, const Vector2& b)
 }
 
 /// Returns the dot product between the vectors @a a and @a b.
-inline float dot(const Vector2& a, const Vector2& b)
+inline f32 dot(const Vector2& a, const Vector2& b)
 {
 	return a.x * b.x + a.y * b.y;
 }
 
 /// Returns the squared length of @a a.
-inline float length_squared(const Vector2& a)
+inline f32 length_squared(const Vector2& a)
 {
 	return dot(a, a);
 }
 
 /// Returns the length of @a a.
-inline float length(const Vector2& a)
+inline f32 length(const Vector2& a)
 {
 	return sqrtf(length_squared(a));
 }
@@ -107,15 +107,15 @@ inline float length(const Vector2& a)
 /// Normalizes @a a and returns the result.
 inline Vector2 normalize(Vector2& a)
 {
-	const float len = length(a);
-	const float inv_len = 1.0f / len;
+	const f32 len = length(a);
+	const f32 inv_len = 1.0f / len;
 	a.x *= inv_len;
 	a.y *= inv_len;
 	return a;
 }
 
 /// Sets the length of @a a to @a len.
-inline void set_length(Vector2& a, float len)
+inline void set_length(Vector2& a, f32 len)
 {
 	normalize(a);
 	a.x *= len;
@@ -123,19 +123,19 @@ inline void set_length(Vector2& a, float len)
 }
 
 /// Returns the squared distance between the points @a a and @a b.
-inline float distance_squared(const Vector2& a, const Vector2& b)
+inline f32 distance_squared(const Vector2& a, const Vector2& b)
 {
 	return length_squared(b - a);
 }
 
 /// Returns the distance between the points @a a and @a b.
-inline float distance(const Vector2& a, const Vector2& b)
+inline f32 distance(const Vector2& a, const Vector2& b)
 {
 	return length(b - a);
 }
 
 /// Returns the angle between the vectors @a a and @a b.
-inline float angle(const Vector2& a, const Vector2& b)
+inline f32 angle(const Vector2& a, const Vector2& b)
 {
 	return acos(dot(a, b) / (length(a) * length(b)));
 }
@@ -159,7 +159,7 @@ inline Vector2 min(const Vector2& a, const Vector2& b)
 }
 
 /// Returns the linearly interpolated vector between @a a and @a b at time @a t in [0, 1].
-inline Vector2 lerp(const Vector2& a, const Vector2& b, float t)
+inline Vector2 lerp(const Vector2& a, const Vector2& b, f32 t)
 {
 	Vector2 v;
 	v.x = lerp(a.x, b.x, t);
@@ -168,13 +168,13 @@ inline Vector2 lerp(const Vector2& a, const Vector2& b, float t)
 }
 
 /// Returns the pointer to the data of @a a.
-inline float* to_float_ptr(Vector2& a)
+inline f32* to_float_ptr(Vector2& a)
 {
 	return &a.x;
 }
 
 /// Returns the pointer to the data of @a a.
-inline const float* to_float_ptr(const Vector2& a)
+inline const f32* to_float_ptr(const Vector2& a)
 {
 	return &a.x;
 }

+ 16 - 16
src/core/math/vector3.h

@@ -14,7 +14,7 @@ namespace crown
 /// @{
 
 /// Returns a new vector from individual elements.
-inline Vector3 vector3(float x, float y, float z)
+inline Vector3 vector3(f32 x, f32 y, f32 z)
 {
 	Vector3 v;
 	v.x = x;
@@ -39,7 +39,7 @@ inline Vector3& operator-=(Vector3& a, const Vector3& b)
 	return a;
 }
 
-inline Vector3& operator*=(Vector3& a, float k)
+inline Vector3& operator*=(Vector3& a, f32 k)
 {
 	a.x *= k;
 	a.y *= k;
@@ -72,14 +72,14 @@ inline Vector3 operator-(Vector3 a, const Vector3& b)
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector3 operator*(Vector3 a, float k)
+inline Vector3 operator*(Vector3 a, f32 k)
 {
 	a *= k;
 	return a;
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector3 operator*(float k, Vector3 a)
+inline Vector3 operator*(f32 k, Vector3 a)
 {
 	a *= k;
 	return a;
@@ -92,7 +92,7 @@ inline bool operator==(const Vector3& a, const Vector3& b)
 }
 
 /// Returns the dot product between the vectors @a a and @a b.
-inline float dot(const Vector3& a, const Vector3& b)
+inline f32 dot(const Vector3& a, const Vector3& b)
 {
 	return a.x * b.x + a.y * b.y + a.z * b.z;
 }
@@ -108,13 +108,13 @@ inline Vector3 cross(const Vector3& a, const Vector3& b)
 }
 
 /// Returns the squared length of @a a.
-inline float length_squared(const Vector3& a)
+inline f32 length_squared(const Vector3& a)
 {
 	return dot(a, a);
 }
 
 /// Returns the length of @a a.
-inline float length(const Vector3& a)
+inline f32 length(const Vector3& a)
 {
 	return sqrtf(length_squared(a));
 }
@@ -122,8 +122,8 @@ inline float length(const Vector3& a)
 /// Normalizes @a a and returns the result.
 inline Vector3 normalize(Vector3& a)
 {
-	const float len = length(a);
-	const float inv_len = 1.0f / len;
+	const f32 len = length(a);
+	const f32 inv_len = 1.0f / len;
 	a.x *= inv_len;
 	a.y *= inv_len;
 	a.z *= inv_len;
@@ -131,7 +131,7 @@ inline Vector3 normalize(Vector3& a)
 }
 
 /// Sets the length of @a a to @a len.
-inline void set_length(Vector3& a, float len)
+inline void set_length(Vector3& a, f32 len)
 {
 	normalize(a);
 	a.x *= len;
@@ -140,19 +140,19 @@ inline void set_length(Vector3& a, float len)
 }
 
 /// Returns the squared distance between the points @a a and @a b.
-inline float distance_squared(const Vector3& a, const Vector3& b)
+inline f32 distance_squared(const Vector3& a, const Vector3& b)
 {
 	return length_squared(b - a);
 }
 
 /// Returns the distance between the points @a a and @a b.
-inline float distance(const Vector3& a, const Vector3& b)
+inline f32 distance(const Vector3& a, const Vector3& b)
 {
 	return length(b - a);
 }
 
 /// Returns the angle between the vectors @a a and @a b.
-inline float angle(const Vector3& a, const Vector3& b)
+inline f32 angle(const Vector3& a, const Vector3& b)
 {
 	return acos(dot(a, b) / (length(a) * length(b)));
 }
@@ -178,7 +178,7 @@ inline Vector3 min(const Vector3& a, const Vector3& b)
 }
 
 /// Returns the linearly interpolated vector between @a a and @a b at time @a t in [0, 1].
-inline Vector3 lerp(const Vector3& a, const Vector3& b, float t)
+inline Vector3 lerp(const Vector3& a, const Vector3& b, f32 t)
 {
 	Vector3 v;
 	v.x = lerp(a.x, b.x, t);
@@ -188,13 +188,13 @@ inline Vector3 lerp(const Vector3& a, const Vector3& b, float t)
 }
 
 /// Returns the pointer to the data of @a a.
-inline float* to_float_ptr(Vector3& a)
+inline f32* to_float_ptr(Vector3& a)
 {
 	return &a.x;
 }
 
 /// Returns the pointer to the data of @a a.
-inline const float* to_float_ptr(const Vector3& a)
+inline const f32* to_float_ptr(const Vector3& a)
 {
 	return &a.x;
 }

+ 16 - 16
src/core/math/vector4.h

@@ -14,7 +14,7 @@ namespace crown
 /// @{
 
 /// Returns a new vector from individual elements.
-inline Vector4 vector4(float x, float y, float z, float w)
+inline Vector4 vector4(f32 x, f32 y, f32 z, f32 w)
 {
 	Vector4 v;
 	v.x = x;
@@ -42,7 +42,7 @@ inline Vector4& operator-=(Vector4& a,	const Vector4& b)
 	return a;
 }
 
-inline Vector4& operator*=(Vector4& a, float k)
+inline Vector4& operator*=(Vector4& a, f32 k)
 {
 	a.x *= k;
 	a.y *= k;
@@ -77,14 +77,14 @@ inline Vector4 operator-(Vector4 a, const Vector4& b)
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector4 operator*(Vector4 a, float k)
+inline Vector4 operator*(Vector4 a, f32 k)
 {
 	a *= k;
 	return a;
 }
 
 /// Multiplies the vector @a a by the scalar @a k and returns the result.
-inline Vector4 operator*(float k, Vector4 a)
+inline Vector4 operator*(f32 k, Vector4 a)
 {
 	a *= k;
 	return a;
@@ -101,19 +101,19 @@ inline bool operator==(const Vector4& a, const Vector4& b)
 }
 
 /// Returns the dot product between the vectors @a a and @a b.
-inline float dot(const Vector4& a, const Vector4& b)
+inline f32 dot(const Vector4& a, const Vector4& b)
 {
 	return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
 }
 
 /// Returns the squared length of @a a.
-inline float length_squared(const Vector4& a)
+inline f32 length_squared(const Vector4& a)
 {
 	return dot(a, a);
 }
 
 /// Returns the length of @a a.
-inline float length(const Vector4& a)
+inline f32 length(const Vector4& a)
 {
 	return sqrtf(length_squared(a));
 }
@@ -121,8 +121,8 @@ inline float length(const Vector4& a)
 /// Normalizes @a a and returns the result.
 inline Vector4 normalize(Vector4& a)
 {
-	const float len = length(a);
-	const float inv_len = 1.0f / len;
+	const f32 len = length(a);
+	const f32 inv_len = 1.0f / len;
 	a.x *= inv_len;
 	a.y *= inv_len;
 	a.z *= inv_len;
@@ -131,7 +131,7 @@ inline Vector4 normalize(Vector4& a)
 }
 
 /// Sets the length of @a a to @a len.
-inline void set_length(Vector4& a, float len)
+inline void set_length(Vector4& a, f32 len)
 {
 	normalize(a);
 	a.x *= len;
@@ -141,19 +141,19 @@ inline void set_length(Vector4& a, float len)
 }
 
 /// Returns the squared distance between the points @a a and @a b.
-inline float distance_squared(const Vector4& a, const Vector4& b)
+inline f32 distance_squared(const Vector4& a, const Vector4& b)
 {
 	return length_squared(b - a);
 }
 
 /// Returns the distance between the points @a a and @a b.
-inline float distance(const Vector4& a, const Vector4& b)
+inline f32 distance(const Vector4& a, const Vector4& b)
 {
 	return length(b - a);
 }
 
 /// Returns the angle between the vectors @a a and @a b.
-inline float angle(const Vector4& a, const Vector4& b)
+inline f32 angle(const Vector4& a, const Vector4& b)
 {
 	return acos(dot(a, b) / (length(a) * length(b)));
 }
@@ -181,7 +181,7 @@ inline Vector4 min(const Vector4& a, const Vector4& b)
 }
 
 /// Returns the linearly interpolated vector between @a a and @a b at time @a t in [0, 1].
-inline Vector4 lerp(const Vector4& a, const Vector4& b, float t)
+inline Vector4 lerp(const Vector4& a, const Vector4& b, f32 t)
 {
 	Vector4 v;
 	v.x = lerp(a.x, b.x, t);
@@ -192,13 +192,13 @@ inline Vector4 lerp(const Vector4& a, const Vector4& b, float t)
 }
 
 /// Returns the pointer to the data of @a a.
-inline float* to_float_ptr(Vector4& a)
+inline f32* to_float_ptr(Vector4& a)
 {
 	return &a.x;
 }
 
 /// Returns the pointer to the data of @a a.
-inline const float* to_float_ptr(const Vector4& a)
+inline const f32* to_float_ptr(const Vector4& a)
 {
 	return &a.x;
 }

+ 5 - 5
src/core/memory/allocator.h

@@ -21,7 +21,7 @@ public:
 
 	/// Allocates @a size bytes of memory aligned to the specified
 	/// @a align byte and returns a pointer to the first allocated byte.
-	virtual void* allocate(uint32_t size, uint32_t align = DEFAULT_ALIGN) = 0;
+	virtual void* allocate(u32 size, u32 align = DEFAULT_ALIGN) = 0;
 
 	/// Deallocates a previously allocated block of memory pointed by @a data.
 	virtual void deallocate(void* data) = 0;
@@ -29,14 +29,14 @@ public:
 	/// Returns the size of the memory block pointed by @a ptr or SIZE_NOT_TRACKED
 	/// if the allocator does not support memory tracking.
 	/// @a ptr must be a pointer returned by Allocator::allocate().
-	virtual uint32_t allocated_size(const void* ptr) = 0;
+	virtual u32 allocated_size(const void* ptr) = 0;
 
 	/// Returns the total number of bytes allocated.
-	virtual uint32_t total_allocated() = 0;
+	virtual u32 total_allocated() = 0;
 
 	/// Default memory alignment in bytes.
-	static const uint32_t DEFAULT_ALIGN = 4;
-	static const uint32_t SIZE_NOT_TRACKED = 0xffffffffu;
+	static const u32 DEFAULT_ALIGN = 4;
+	static const u32 SIZE_NOT_TRACKED = 0xffffffffu;
 
 private:
 

+ 4 - 4
src/core/memory/linear_allocator.cpp

@@ -8,7 +8,7 @@
 
 namespace crown
 {
-LinearAllocator::LinearAllocator(Allocator& backing, uint32_t size)
+LinearAllocator::LinearAllocator(Allocator& backing, u32 size)
 	: _backing(&backing)
 	, _physical_start(NULL)
 	, _total_size(size)
@@ -17,7 +17,7 @@ LinearAllocator::LinearAllocator(Allocator& backing, uint32_t size)
 	_physical_start = backing.allocate(size);
 }
 
-LinearAllocator::LinearAllocator(void* start, uint32_t size)
+LinearAllocator::LinearAllocator(void* start, u32 size)
 	: _backing(NULL)
 	, _physical_start(start)
 	, _total_size(size)
@@ -36,9 +36,9 @@ LinearAllocator::~LinearAllocator()
 		);
 }
 
-void* LinearAllocator::allocate(uint32_t size, uint32_t align)
+void* LinearAllocator::allocate(u32 size, u32 align)
 {
-	const uint32_t actual_size = size + align;
+	const u32 actual_size = size + align;
 
 	// Out of memory
 	if (_offset + actual_size > _total_size)

+ 7 - 7
src/core/memory/linear_allocator.h

@@ -17,20 +17,20 @@ class LinearAllocator : public Allocator
 {
 	Allocator* _backing;
 	void* _physical_start;
-	uint32_t _total_size;
-	uint32_t _offset;
+	u32 _total_size;
+	u32 _offset;
 
 public:
 
 	/// Allocates @a size bytes from @a backing.
-	LinearAllocator(Allocator& backing, uint32_t size);
+	LinearAllocator(Allocator& backing, u32 size);
 
 	/// Uses @a size bytes of memory from @a start.
-	LinearAllocator(void* start, uint32_t size);
+	LinearAllocator(void* start, u32 size);
 	~LinearAllocator();
 
 	/// @copydoc Allocator::allocate()
-	void* allocate(uint32_t size, uint32_t align = Allocator::DEFAULT_ALIGN);
+	void* allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
 
 	/// @copydoc Allocator::deallocate()
 	/// @note
@@ -43,10 +43,10 @@ public:
 	void clear();
 
 	/// @copydoc Allocator::allocated_size()
-	uint32_t allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
+	u32 allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
 
 	/// @copydoc Allocator::total_allocated()
-	uint32_t total_allocated() { return _offset; }
+	u32 total_allocated() { return _offset; }
 };
 
 } // namespace crown

+ 24 - 24
src/core/memory/memory.cpp

@@ -40,15 +40,15 @@ namespace memory
 	// size of the allocated data.
 	struct Header
 	{
-		uint32_t size;
+		u32 size;
 	};
 
 	// If we need to align the memory allocation we pad the header with this
 	// value after storing the size. That way we can
-	const uint32_t HEADER_PAD_VALUE = 0xffffffffu;
+	const u32 HEADER_PAD_VALUE = 0xffffffffu;
 
 	// Given a pointer to the header, returns a pointer to the data that follows it.
-	inline void *data_pointer(Header* header, uint32_t align) {
+	inline void *data_pointer(Header* header, u32 align) {
 		void *p = header + 1;
 		return memory::align_top(p, align);
 	}
@@ -56,7 +56,7 @@ namespace memory
 	// Given a pointer to the data, returns a pointer to the header before it.
 	inline Header*header(const void* data)
 	{
-		uint32_t *p = (uint32_t*)data;
+		u32 *p = (u32*)data;
 		while (p[-1] == HEADER_PAD_VALUE)
 			--p;
 		return (Header*)p - 1;
@@ -64,22 +64,22 @@ namespace memory
 
 	// Stores the size in the header and pads with HEADER_PAD_VALUE up to the
 	// data pointer.
-	inline void fill(Header*header, void *data, uint32_t size)
+	inline void fill(Header*header, void *data, u32 size)
 	{
 		header->size = size;
-		uint32_t *p = (uint32_t*)(header + 1);
+		u32 *p = (u32*)(header + 1);
 		while (p < data)
 			*p++ = HEADER_PAD_VALUE;
 	}
 
-	inline uint32_t actual_allocation_size(uint32_t size, uint32_t align)
+	inline u32 actual_allocation_size(u32 size, u32 align)
 	{
 		return size + align + sizeof(Header);
 	}
 
 	inline void pad(Header* header, void* data)
 	{
-		uint32_t* p = (uint32_t*)(header + 1);
+		u32* p = (u32*)(header + 1);
 
 		while (p != data)
 		{
@@ -92,8 +92,8 @@ namespace memory
 	class HeapAllocator : public Allocator
 	{
 		Mutex _mutex;
-		uint32_t _allocated_size;
-		uint32_t _allocation_count;
+		u32 _allocated_size;
+		u32 _allocation_count;
 
 	public:
 
@@ -113,11 +113,11 @@ namespace memory
 		}
 
 		/// @copydoc Allocator::allocate()
-		void* allocate(uint32_t size, uint32_t align = Allocator::DEFAULT_ALIGN)
+		void* allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN)
 		{
 			ScopedMutex sm(_mutex);
 
-			uint32_t actual_size = actual_allocation_size(size, align);
+			u32 actual_size = actual_allocation_size(size, align);
 
 			Header* h = (Header*)malloc(actual_size);
 			h->size = actual_size;
@@ -149,20 +149,20 @@ namespace memory
 		}
 
 		/// @copydoc Allocator::allocated_size()
-		uint32_t allocated_size(const void* ptr)
+		u32 allocated_size(const void* ptr)
 		{
 			return get_size(ptr);
 		}
 
 		/// @copydoc Allocator::total_allocated()
-		uint32_t total_allocated()
+		u32 total_allocated()
 		{
 			ScopedMutex sm(_mutex);
 			return _allocated_size;
 		}
 
 		/// Returns the size in bytes of the block of memory pointed by @a data
-		uint32_t get_size(const void* data)
+		u32 get_size(const void* data)
 		{
 			ScopedMutex sm(_mutex);
 			Header* h = header(data);
@@ -204,7 +204,7 @@ namespace memory
 		/// that don't fit in the ring buffer.
 		///
 		/// size specifies the size of the ring buffer.
-		ScratchAllocator(Allocator &backing, uint32_t size) : _backing(backing)
+		ScratchAllocator(Allocator &backing, u32 size) : _backing(backing)
 		{
 			_begin = (char*)_backing.allocate(size);
 			_end = _begin + size;
@@ -227,7 +227,7 @@ namespace memory
 			return p >= _free || p < _allocate;
 		}
 
-		virtual void *allocate(uint32_t size, uint32_t align)
+		virtual void *allocate(u32 size, u32 align)
 		{
 			CE_ASSERT(align % 4 == 0, "Must be 4-byte aligned");
 			size = ((size + 3)/4)*4;
@@ -239,7 +239,7 @@ namespace memory
 
 			// Reached the end of the buffer, wrap around to the beginning.
 			if (p > _end) {
-				h->size = uint32_t(_end - (char*)h) | 0x80000000u;
+				h->size = u32(_end - (char*)h) | 0x80000000u;
 
 				p = _begin;
 				h = (Header*)p;
@@ -251,7 +251,7 @@ namespace memory
 			if (in_use(p))
 				return _backing.allocate(size, align);
 
-			fill(h, data, uint32_t(p - (char*)h));
+			fill(h, data, u32(p - (char*)h));
 			_allocate = p;
 			return data;
 		}
@@ -283,15 +283,15 @@ namespace memory
 			}
 		}
 
-		virtual uint32_t allocated_size(const void *p)
+		virtual u32 allocated_size(const void *p)
 		{
 			Header* h = header(p);
-			return h->size - uint32_t((char*)p - (char*)h);
+			return h->size - u32((char*)p - (char*)h);
 		}
 
-		virtual uint32_t total_allocated()
+		virtual u32 total_allocated()
 		{
-			return uint32_t(_end - _begin);
+			return u32(_end - _begin);
 		}
 	};
 } // namespace memory
@@ -300,7 +300,7 @@ namespace memory_globals
 {
 	using namespace memory;
 
-	static const uint32_t SIZE = sizeof(HeapAllocator)
+	static const u32 SIZE = sizeof(HeapAllocator)
 		+ sizeof(ScratchAllocator)
 		;
 	char _buffer[SIZE];

+ 2 - 2
src/core/memory/memory.h

@@ -20,13 +20,13 @@ Allocator& default_scratch_allocator();
 namespace memory
 {
 	/// Returns the pointer @a p aligned to the desired @a align byte
-	inline void* align_top(void* p, uint32_t align)
+	inline void* align_top(void* p, u32 align)
 	{
 		CE_ASSERT(align >= 1, "Alignment must be > 1");
 		CE_ASSERT(align % 2 == 0 || align == 1, "Alignment must be a power of two");
 
 		uintptr_t ptr = (uintptr_t)p;
-		const uint32_t mod = ptr % align;
+		const u32 mod = ptr % align;
 
 		if (mod)
 			ptr += align - mod;

+ 6 - 6
src/core/memory/pool_allocator.cpp

@@ -8,7 +8,7 @@
 
 namespace crown
 {
-PoolAllocator::PoolAllocator(Allocator& backing, uint32_t num_blocks, uint32_t block_size, uint32_t block_align)
+PoolAllocator::PoolAllocator(Allocator& backing, u32 num_blocks, u32 block_size, u32 block_align)
 	: _backing(backing)
 	, _start(NULL)
 	, _freelist(NULL)
@@ -21,14 +21,14 @@ PoolAllocator::PoolAllocator(Allocator& backing, uint32_t num_blocks, uint32_t b
 	CE_ASSERT(block_size > 0, "Unsupported block size");
 	CE_ASSERT(block_align > 0, "Unsupported block alignment");
 
-	uint32_t actual_block_size = block_size + block_align;
-	uint32_t pool_size = num_blocks * actual_block_size;
+	u32 actual_block_size = block_size + block_align;
+	u32 pool_size = num_blocks * actual_block_size;
 
 	char* mem = (char*) backing.allocate(pool_size, block_align);
 
 	// Initialize intrusive freelist
 	char* cur = mem;
-	for (uint32_t bb = 0; bb < num_blocks - 1; bb++)
+	for (u32 bb = 0; bb < num_blocks - 1; bb++)
 	{
 		uintptr_t* next = (uintptr_t*) cur;
 		*next = (uintptr_t) cur + actual_block_size;
@@ -47,7 +47,7 @@ PoolAllocator::~PoolAllocator()
 	_backing.deallocate(_start);
 }
 
-void* PoolAllocator::allocate(uint32_t size, uint32_t align)
+void* PoolAllocator::allocate(u32 size, u32 align)
 {
 	CE_ASSERT(size == _block_size, "Size must match block size");
 	CE_ASSERT(align == _block_align, "Align must match block align");
@@ -79,7 +79,7 @@ void PoolAllocator::deallocate(void* data)
 	_allocated_size -= _block_size;
 }
 
-uint32_t PoolAllocator::total_allocated()
+u32 PoolAllocator::total_allocated()
 {
 	return _allocated_size;
 }

+ 8 - 8
src/core/memory/pool_allocator.h

@@ -19,32 +19,32 @@ class PoolAllocator : public Allocator
 
 	void* _start;
 	void* _freelist;
-	uint32_t _block_size;
-	uint32_t _block_align;
+	u32 _block_size;
+	u32 _block_align;
 
-	uint32_t _num_allocations;
-	uint32_t _allocated_size;
+	u32 _num_allocations;
+	u32 _allocated_size;
 
 public:
 
 	/// Uses @a backing to allocate the memory pool for containing exactly
 	/// @a num_blocks blocks of @a block_size size each aligned to @a block_align.
-	PoolAllocator(Allocator& backing, uint32_t num_blocks, uint32_t block_size, uint32_t block_align = Allocator::DEFAULT_ALIGN);
+	PoolAllocator(Allocator& backing, u32 num_blocks, u32 block_size, u32 block_align = Allocator::DEFAULT_ALIGN);
 	~PoolAllocator();
 
 	/// Allocates a block of memory from the memory pool.
 	/// @note
 	/// The @a size and @a align must match those passed to PoolAllocator::PoolAllocator()
-	void* allocate(uint32_t size, uint32_t align = Allocator::DEFAULT_ALIGN);
+	void* allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
 
 	/// @copydoc Allocator::deallocate()
 	void deallocate(void* data);
 
 	/// @copydoc Allocator::allocated_size()
-	uint32_t allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
+	u32 allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
 
 	/// @copydoc Allocator::total_allocated()
-	uint32_t total_allocated();
+	u32 total_allocated();
 };
 
 } // namespace crown

+ 1 - 1
src/core/memory/proxy_allocator.cpp

@@ -16,7 +16,7 @@ ProxyAllocator::ProxyAllocator(Allocator& allocator, const char* name)
 	CE_ASSERT(name != NULL, "Name must be != NULL");
 }
 
-void* ProxyAllocator::allocate(uint32_t size, uint32_t align)
+void* ProxyAllocator::allocate(u32 size, u32 align)
 {
 	void* p = _allocator.allocate(size, align);
 	ALLOCATE_MEMORY(_name, _allocator.allocated_size(p));

+ 3 - 3
src/core/memory/proxy_allocator.h

@@ -25,16 +25,16 @@ public:
 	ProxyAllocator(Allocator& allocator, const char* name);
 
 	/// @copydoc Allocator::allocate()
-	void* allocate(uint32_t size, uint32_t align = Allocator::DEFAULT_ALIGN);
+	void* allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
 
 	/// @copydoc Allocator::deallocate()
 	void deallocate(void* data);
 
 	/// @copydoc Allocator::allocated_size()
-	uint32_t allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
+	u32 allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
 
 	/// @copydoc Allocator::total_allocated()
-	uint32_t total_allocated() { return SIZE_NOT_TRACKED; }
+	u32 total_allocated() { return SIZE_NOT_TRACKED; }
 
 	/// Returns the name of the proxy allocator
 	const char* name() const;

+ 6 - 6
src/core/memory/stack_allocator.cpp

@@ -8,7 +8,7 @@
 
 namespace crown
 {
-StackAllocator::StackAllocator(char* begin, uint32_t size)
+StackAllocator::StackAllocator(char* begin, u32 size)
 	: _begin(begin)
 	, _top(begin)
 	, _total_size(size)
@@ -25,9 +25,9 @@ StackAllocator::~StackAllocator()
 		);
 }
 
-void* StackAllocator::allocate(uint32_t size, uint32_t align)
+void* StackAllocator::allocate(u32 size, u32 align)
 {
-	const uint32_t actual_size = sizeof(Header) + size + align;
+	const u32 actual_size = sizeof(Header) + size + align;
 
 	// Memory exhausted
 	if (_top + actual_size > _begin + _total_size)
@@ -36,7 +36,7 @@ void* StackAllocator::allocate(uint32_t size, uint32_t align)
 	}
 
 	// The offset from TOS to the start of the buffer
-	uint32_t offset = uint32_t(_top - _begin);
+	u32 offset = u32(_top - _begin);
 
 	// Align user data only, ignore header alignment
 	_top = (char*)memory::align_top(_top + sizeof(Header), align) - sizeof(Header);
@@ -69,9 +69,9 @@ void StackAllocator::deallocate(void* data)
 	_allocation_count--;
 }
 
-uint32_t StackAllocator::total_allocated()
+u32 StackAllocator::total_allocated()
 {
-	return uint32_t(_top - _begin);
+	return u32(_top - _begin);
 }
 
 } // namespace crown

+ 8 - 8
src/core/memory/stack_allocator.h

@@ -18,22 +18,22 @@ class StackAllocator : public Allocator
 {
 	struct Header
 	{
-		uint32_t offset;
-		uint32_t alloc_id;
+		u32 offset;
+		u32 alloc_id;
 	};
 
 	char* _begin;
 	char* _top;
-	uint32_t _total_size;
-	uint32_t _allocation_count;
+	u32 _total_size;
+	u32 _allocation_count;
 
 public:
 
-	StackAllocator(char* begin, uint32_t size);
+	StackAllocator(char* begin, u32 size);
 	~StackAllocator();
 
 	/// @copydoc Allocator::allocate()
-	void* allocate(uint32_t size, uint32_t align = Allocator::DEFAULT_ALIGN);
+	void* allocate(u32 size, u32 align = Allocator::DEFAULT_ALIGN);
 
 	/// @copydoc Allocator::deallocate()
 	/// @note
@@ -42,10 +42,10 @@ public:
 	void deallocate(void* data);
 
 	/// @copydoc Allocator::allocated_size()
-	uint32_t allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
+	u32 allocated_size(const void* /*ptr*/) { return SIZE_NOT_TRACKED; }
 
 	/// @copydoc Allocator::total_allocated()
-	uint32_t total_allocated();
+	u32 total_allocated();
 };
 
 } // namespace crown

+ 5 - 5
src/core/memory/temp_allocator.h

@@ -30,17 +30,17 @@ namespace crown
 		TempAllocator(Allocator &backing = default_scratch_allocator());
 		virtual ~TempAllocator();
 
-		virtual void *allocate(uint32_t size, uint32_t align = DEFAULT_ALIGN);
+		virtual void *allocate(u32 size, u32 align = DEFAULT_ALIGN);
 
 		/// Deallocation is a NOP for the TempAllocator. The memory is automatically
 		/// deallocated when the TempAllocator is destroyed.
 		virtual void deallocate(void *) {}
 
 		/// Returns SIZE_NOT_TRACKED.
-		virtual uint32_t allocated_size(const void*) {return SIZE_NOT_TRACKED;}
+		virtual u32 allocated_size(const void*) {return SIZE_NOT_TRACKED;}
 
 		/// Returns SIZE_NOT_TRACKED.
-		virtual uint32_t total_allocated() {return SIZE_NOT_TRACKED;}
+		virtual u32 total_allocated() {return SIZE_NOT_TRACKED;}
 
 	private:
 
@@ -87,11 +87,11 @@ namespace crown
 	}
 
 	template <int BUFFER_SIZE>
-	void *TempAllocator<BUFFER_SIZE>::allocate(uint32_t size, uint32_t align)
+	void *TempAllocator<BUFFER_SIZE>::allocate(u32 size, u32 align)
 	{
 		_p = (char *)memory::align_top(_p, align);
 		if ((int)size > _end - _p) {
-			uint32_t to_allocate = sizeof(void *) + size + align;
+			u32 to_allocate = sizeof(void *) + size + align;
 			if (to_allocate < _chunk_size)
 				to_allocate = _chunk_size;
 			_chunk_size *= 2;

+ 14 - 14
src/core/murmur.cpp

@@ -20,7 +20,7 @@ namespace crown
 /// 1. It will not work incrementally.
 /// 2. It will not produce the same results on little-endian and big-endian
 ///    machines.
-uint32_t murmur32(const void* key, uint32_t len, uint32_t seed)
+u32 murmur32(const void* key, u32 len, u32 seed)
 {
 	// 'm' and 'r' are mixing constants generated offline.
 	// They're not really 'magic', they just happen to work well.
@@ -66,19 +66,19 @@ uint32_t murmur32(const void* key, uint32_t len, uint32_t seed)
 	return h;
 }
 
-uint64_t murmur64(const void* key, uint32_t len, uint64_t seed)
+u64 murmur64(const void* key, u32 len, u64 seed)
 {
-	const uint64_t m = 0xc6a4a7935bd1e995ull;
+	const u64 m = 0xc6a4a7935bd1e995ull;
 	const int r = 47;
 
-	uint64_t h = seed ^ (len * m);
+	u64 h = seed ^ (len * m);
 
-	const uint64_t * data = (const uint64_t *)key;
-	const uint64_t * end = data + (len/8);
+	const u64 * data = (const u64 *)key;
+	const u64 * end = data + (len/8);
 
 	while(data != end)
 	{
-		uint64_t k = *data++;
+		u64 k = *data++;
 
 		k *= m;
 		k ^= k >> r;
@@ -92,13 +92,13 @@ uint64_t murmur64(const void* key, uint32_t len, uint64_t seed)
 
 	switch(len & 7)
 	{
-		case 7: h ^= uint64_t(data2[6]) << 48;
-		case 6: h ^= uint64_t(data2[5]) << 40;
-		case 5: h ^= uint64_t(data2[4]) << 32;
-		case 4: h ^= uint64_t(data2[3]) << 24;
-		case 3: h ^= uint64_t(data2[2]) << 16;
-		case 2: h ^= uint64_t(data2[1]) << 8;
-		case 1: h ^= uint64_t(data2[0]);
+		case 7: h ^= u64(data2[6]) << 48;
+		case 6: h ^= u64(data2[5]) << 40;
+		case 5: h ^= u64(data2[4]) << 32;
+		case 4: h ^= u64(data2[3]) << 24;
+		case 3: h ^= u64(data2[2]) << 16;
+		case 2: h ^= u64(data2[1]) << 8;
+		case 1: h ^= u64(data2[0]);
 		h *= m;
 	};
 

+ 2 - 2
src/core/murmur.h

@@ -9,6 +9,6 @@
 
 namespace crown
 {
-uint32_t murmur32(const void* key, uint32_t len, uint32_t seed);
-uint64_t murmur64(const void* key, uint32_t len, uint64_t seed);
+u32 murmur32(const void* key, u32 len, u32 seed);
+u64 murmur64(const void* key, u32 len, u64 seed);
 } // namespace crown

+ 8 - 8
src/core/network/net_address.h

@@ -21,28 +21,28 @@ struct NetAddress
 		set(127, 0, 0, 1);
 	}
 
-	NetAddress(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
+	NetAddress(u8 a, u8 b, u8 c, u8 d)
 		: _addr(0)
 	{
 		set(a, b, c, d);
 	}
 
 	/// Returns the IP address as packed 32-bit integer.
-	uint32_t address() const
+	u32 address() const
 	{
 		return _addr;
 	}
 
-	void set(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
+	void set(u8 a, u8 b, u8 c, u8 d)
 	{
 		_addr = 0;
-		_addr |= uint32_t(a) << 24;
-		_addr |= uint32_t(b) << 16;
-		_addr |= uint32_t(c) << 8;
-		_addr |= uint32_t(d) << 0;
+		_addr |= u32(a) << 24;
+		_addr |= u32(b) << 16;
+		_addr |= u32(c) << 8;
+		_addr |= u32(d) << 0;
 	}
 
-	uint32_t _addr;
+	u32 _addr;
 };
 
 } // namespace crown

+ 16 - 16
src/core/network/socket.h

@@ -41,13 +41,13 @@ struct ConnectResult
 struct ReadResult
 {
 	enum { NO_ERROR, BAD_SOCKET, REMOTE_CLOSED, TIMEOUT, UNKNOWN } error;
-	uint32_t bytes_read;
+	u32 bytes_read;
 };
 
 struct WriteResult
 {
 	enum { NO_ERROR, BAD_SOCKET, REMOTE_CLOSED, TIMEOUT, UNKNOWN } error;
-	uint32_t bytes_wrote;
+	u32 bytes_wrote;
 };
 
 struct AcceptResult
@@ -80,7 +80,7 @@ struct TCPSocket
 #endif
 	}
 
-	ConnectResult connect(const NetAddress& ip, uint16_t port)
+	ConnectResult connect(const NetAddress& ip, u16 port)
 	{
 		close();
 		open();
@@ -130,7 +130,7 @@ struct TCPSocket
 #endif
 	}
 
-	bool bind(uint16_t port)
+	bool bind(u16 port)
 	{
 		close();
 		open();
@@ -158,7 +158,7 @@ struct TCPSocket
 #endif
 	}
 
-	void listen(uint32_t max)
+	void listen(u32 max)
 	{
 #if CROWN_PLATFORM_POSIX
 		int err = ::listen(_socket, max);
@@ -237,7 +237,7 @@ struct TCPSocket
 #endif
 	}
 
-	ReadResult read_internal(void* data, uint32_t size)
+	ReadResult read_internal(void* data, u32 size)
 	{
 		ReadResult rr;
 		rr.error = ReadResult::NO_ERROR;
@@ -245,7 +245,7 @@ struct TCPSocket
 
 #if CROWN_PLATFORM_POSIX
 		char* buf = (char*)data;
-		uint32_t to_read = size;
+		u32 to_read = size;
 
 		while (to_read > 0)
 		{
@@ -274,7 +274,7 @@ struct TCPSocket
 		return rr;
 #elif CROWN_PLATFORM_WINDOWS
 		char* buf = (char*)data;
-		uint32_t to_read = size;
+		u32 to_read = size;
 
 		while (to_read > 0)
 		{
@@ -302,19 +302,19 @@ struct TCPSocket
 #endif
 	}
 
-	ReadResult read_nonblock(void* data, uint32_t size)
+	ReadResult read_nonblock(void* data, u32 size)
 	{
 		set_blocking(false);
 		return read_internal(data, size);
 	}
 
-	ReadResult read(void* data, uint32_t size)
+	ReadResult read(void* data, u32 size)
 	{
 		set_blocking(true);
 		return read_internal(data, size);
 	}
 
-	WriteResult write_internal(const void* data, uint32_t size)
+	WriteResult write_internal(const void* data, u32 size)
 	{
 		WriteResult wr;
 		wr.error = WriteResult::NO_ERROR;
@@ -322,7 +322,7 @@ struct TCPSocket
 
 #if CROWN_PLATFORM_POSIX
 		const char* buf = (const char*)data;
-		uint32_t to_send = size;
+		u32 to_send = size;
 
 		while (to_send > 0)
 		{
@@ -354,7 +354,7 @@ struct TCPSocket
 		return wr;
 #elif CROWN_PLATFORM_WINDOWS
 		const char* buf = (const char*)data;
-		uint32_t to_send = size;
+		u32 to_send = size;
 
 		while (to_send > 0)
 		{
@@ -389,13 +389,13 @@ struct TCPSocket
 #endif
 	}
 
-	WriteResult write_nonblock(const void* data, uint32_t size)
+	WriteResult write_nonblock(const void* data, u32 size)
 	{
 		set_blocking(false);
 		return write_internal(data, size);
 	}
 
-	WriteResult write(const void* data, uint32_t size)
+	WriteResult write(const void* data, u32 size)
 	{
 		set_blocking(true);
 		return write_internal(data, size);
@@ -427,7 +427,7 @@ struct TCPSocket
 		CE_UNUSED(err);
 	}
 
-	void set_timeout(uint32_t seconds)
+	void set_timeout(u32 seconds)
 	{
 #if CROWN_PLATFORM_POSIX
 		struct timeval timeout;

+ 11 - 11
src/core/os.h

@@ -88,7 +88,7 @@ namespace os
 	}
 
 	/// Returns the last modification time of @a path.
-	inline uint64_t mtime(const char* path)
+	inline u64 mtime(const char* path)
 	{
 #if CROWN_PLATFORM_POSIX
 		struct stat info;
@@ -112,7 +112,7 @@ namespace os
 		CE_ASSERT(err != 0, "GetFileTime: GetLastError = %d", GetLastError());
 		CE_UNUSED(err);
 		CloseHandle(hfile);
-		return (uint64_t)((uint64_t(ftwrite.dwHighDateTime) << 32) | ftwrite.dwLowDateTime);
+		return (u64)((u64(ftwrite.dwHighDateTime) << 32) | ftwrite.dwLowDateTime);
 #endif
 	}
 
@@ -232,7 +232,7 @@ namespace os
 	}
 
 	/// Returns the current working directory.
-	inline const char* getcwd(char* buf, uint32_t size)
+	inline const char* getcwd(char* buf, u32 size)
 	{
 #if CROWN_PLATFORM_POSIX
 		return ::getcwd(buf, size);
@@ -252,33 +252,33 @@ namespace os
 #endif
 	}
 
-	inline int64_t clocktime()
+	inline s64 clocktime()
 	{
 #if CROWN_PLATFORM_LINUX || CROWN_PLATFORM_ANDROID
 		timespec now;
 		clock_gettime(CLOCK_MONOTONIC, &now);
-		return now.tv_sec * int64_t(1000000000) + now.tv_nsec;
+		return now.tv_sec * s64(1000000000) + now.tv_nsec;
 #elif CROWN_PLATFORM_OSX
 		struct timeval now;
 		gettimeofday(&now, NULL);
-		return now.tv_sec * int64_t(1000000) + now.tv_usec;
+		return now.tv_sec * s64(1000000) + now.tv_usec;
 #elif CROWN_PLATFORM_WINDOWS
 		LARGE_INTEGER ttime;
 		QueryPerformanceCounter(&ttime);
-		return (int64_t)ttime.QuadPart;
+		return (s64)ttime.QuadPart;
 #endif
 	}
 
-	inline int64_t clockfrequency()
+	inline s64 clockfrequency()
 	{
 #if CROWN_PLATFORM_LINUX || CROWN_PLATFORM_ANDROID
-		return int64_t(1000000000);
+		return s64(1000000000);
 #elif CROWN_PLATFORM_OSX
-		return int64_t(1000000);
+		return s64(1000000);
 #elif CROWN_PLATFORM_WINDOWS
 		LARGE_INTEGER freq;
 		QueryPerformanceFrequency(&freq);
-		return (int64_t)freq.QuadPart;
+		return (s64)freq.QuadPart;
 #endif
 	}
 

+ 29 - 29
src/core/os_event_queue.h

@@ -14,15 +14,15 @@ namespace crown
 {
 struct OsMetricsEvent
 {
-	uint16_t x;
-	uint16_t y;
-	uint16_t width;
-	uint16_t height;
+	u16 x;
+	u16 y;
+	u16 width;
+	u16 height;
 };
 
 struct OsExitEvent
 {
-	int32_t code;
+	s32 code;
 };
 
 /// Represents an event fired by mouse.
@@ -37,10 +37,10 @@ struct OsMouseEvent
 
 	OsMouseEvent::Enum type;
 	MouseButton::Enum button;
-	int16_t x;
-	int16_t y;
+	s16 x;
+	s16 y;
 	bool pressed;
-	float wheel;
+	f32 wheel;
 };
 
 /// Represents an event fired by keyboard.
@@ -60,9 +60,9 @@ struct OsTouchEvent
 	};
 
 	OsTouchEvent::Enum type;
-	uint8_t pointer_id;
-	int16_t x;
-	int16_t y;
+	u8 pointer_id;
+	s16 x;
+	s16 y;
 	bool pressed;
 };
 
@@ -77,21 +77,21 @@ struct OsJoypadEvent
 	};
 
 	OsJoypadEvent::Enum type;
-	uint8_t index;
+	u8 index;
 	bool connected;
-	uint8_t button;
+	u8 button;
 	bool pressed;
-	float x;
-	float y;
-	float z;
+	f32 x;
+	f32 y;
+	f32 z;
 };
 
 /// Represents an event fired by accelerometer.
 struct OsAccelerometerEvent
 {
-	float x;
-	float y;
-	float z;
+	f32 x;
+	f32 y;
+	f32 z;
 };
 
 struct OsEvent
@@ -139,7 +139,7 @@ struct OsEventQueue
 	{
 	}
 
-	void push_mouse_event(uint16_t x, uint16_t y)
+	void push_mouse_event(u16 x, u16 y)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::MOUSE;
@@ -150,7 +150,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_mouse_event(int16_t x, int16_t y, MouseButton::Enum b, bool pressed)
+	void push_mouse_event(s16 x, s16 y, MouseButton::Enum b, bool pressed)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::MOUSE;
@@ -163,7 +163,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_mouse_event(int16_t x, int16_t y, float wheel)
+	void push_mouse_event(s16 x, s16 y, f32 wheel)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::MOUSE;
@@ -185,7 +185,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_touch_event(int16_t x, int16_t y, uint8_t pointer_id)
+	void push_touch_event(s16 x, s16 y, u8 pointer_id)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::TOUCH;
@@ -197,7 +197,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_joypad_event(uint8_t i, bool connected)
+	void push_joypad_event(u8 i, bool connected)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::JOYPAD;
@@ -208,7 +208,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_joypad_event(uint8_t i, uint8_t button, bool pressed)
+	void push_joypad_event(u8 i, u8 button, bool pressed)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::JOYPAD;
@@ -220,7 +220,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_joypad_event(uint8_t i, uint8_t axis, float x, float y, float z)
+	void push_joypad_event(u8 i, u8 axis, f32 x, f32 y, f32 z)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::JOYPAD;
@@ -234,7 +234,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_touch_event(int16_t x, int16_t y, uint8_t pointer_id, bool pressed)
+	void push_touch_event(s16 x, s16 y, u8 pointer_id, bool pressed)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::TOUCH;
@@ -247,7 +247,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_exit_event(int32_t code)
+	void push_exit_event(s32 code)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::EXIT;
@@ -270,7 +270,7 @@ struct OsEventQueue
 		push_event(ev);
 	}
 
-	void push_metrics_event(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
+	void push_metrics_event(u16 x, u16 y, u16 width, u16 height)
 	{
 		OsEvent ev;
 		ev.type = OsEvent::METRICS;

+ 12 - 12
src/core/profiler.cpp

@@ -38,7 +38,7 @@ namespace profiler
 {
 	enum { THREAD_BUFFER_SIZE = 4 * 1024 };
 	static char _thread_buffer[THREAD_BUFFER_SIZE];
-	static uint32_t _thread_buffer_size = 0;
+	static u32 _thread_buffer_size = 0;
 	static Mutex _buffer_mutex;
 
 	static void flush_local_buffer()
@@ -51,17 +51,17 @@ namespace profiler
 	template <typename T>
 	static void push(ProfilerEventType::Enum type, const T& ev)
 	{
-		if (_thread_buffer_size + 2*sizeof(uint32_t) + sizeof(ev) >= THREAD_BUFFER_SIZE)
+		if (_thread_buffer_size + 2*sizeof(u32) + sizeof(ev) >= THREAD_BUFFER_SIZE)
 			flush_local_buffer();
 
 		char* p = _thread_buffer + _thread_buffer_size;
-		*(uint32_t*)p = type;
-		p += sizeof(uint32_t);
-		*(uint32_t*)p = sizeof(ev);
-		p += sizeof(uint32_t);
+		*(u32*)p = type;
+		p += sizeof(u32);
+		*(u32*)p = sizeof(ev);
+		p += sizeof(u32);
 		*(T*)p = ev;
 
-		_thread_buffer_size += 2*sizeof(uint32_t) + sizeof(ev);
+		_thread_buffer_size += 2*sizeof(u32) + sizeof(ev);
 	}
 
 	void enter_profile_scope(const char* name)
@@ -81,7 +81,7 @@ namespace profiler
 		push(ProfilerEventType::LEAVE_PROFILE_SCOPE, ev);
 	}
 
-	void record_float(const char* name, float value)
+	void record_float(const char* name, f32 value)
 	{
 		RecordFloat ev;
 		ev.name = name;
@@ -99,7 +99,7 @@ namespace profiler
 		push(ProfilerEventType::RECORD_VECTOR3, ev);
 	}
 
-	void allocate_memory(const char* name, uint32_t size)
+	void allocate_memory(const char* name, u32 size)
 	{
 		AllocateMemory ev;
 		ev.name = name;
@@ -108,7 +108,7 @@ namespace profiler
 		push(ProfilerEventType::ALLOCATE_MEMORY, ev);
 	}
 
-	void deallocate_memory(const char* name, uint32_t size)
+	void deallocate_memory(const char* name, u32 size)
 	{
 		DeallocateMemory ev;
 		ev.name = name;
@@ -123,8 +123,8 @@ namespace profiler_globals
 	void flush()
 	{
 		profiler::flush_local_buffer();
-		uint32_t end = ProfilerEventType::COUNT;
-		array::push(*_buffer, (const char*)&end, (uint32_t)sizeof(end));
+		u32 end = ProfilerEventType::COUNT;
+		array::push(*_buffer, (const char*)&end, (u32)sizeof(end));
 	}
 
 	void clear()

+ 9 - 9
src/core/profiler.h

@@ -32,7 +32,7 @@ struct ProfilerEventType
 struct RecordFloat
 {
 	const char* name;
-	float value;
+	f32 value;
 };
 
 struct RecordVector3
@@ -44,24 +44,24 @@ struct RecordVector3
 struct EnterProfileScope
 {
 	const char* name;
-	int64_t time;
+	s64 time;
 };
 
 struct LeaveProfileScope
 {
-	int64_t time;
+	s64 time;
 };
 
 struct AllocateMemory
 {
 	const char* name;
-	uint32_t size;
+	u32 size;
 };
 
 struct DeallocateMemory
 {
 	const char* name;
-	uint32_t size;
+	u32 size;
 };
 
 /// Functions to access profiler.
@@ -80,17 +80,17 @@ namespace profiler
 	/// Ends the last profile scope.
 	void leave_profile_scope();
 
-	/// Records the float @a value with the given @a name.
-	void record_float(const char* name, float value);
+	/// Records the f32 @a value with the given @a name.
+	void record_float(const char* name, f32 value);
 
 	/// Records the vector3 @a value with the given @a name.
 	void record_vector3(const char* name, const Vector3& value);
 
 	/// Records a memory allocation of @a size with the given @a name.
-	void allocate_memory(const char* name, uint32_t size);
+	void allocate_memory(const char* name, u32 size);
 
 	/// Records a memory deallocation of @a size with the given @a name.
-	void deallocate_memory(const char* name, uint32_t size);
+	void deallocate_memory(const char* name, u32 size);
 } // namespace profiler
 
 namespace profiler_globals

+ 2 - 2
src/core/string_id.cpp

@@ -15,7 +15,7 @@ StringId32::StringId32(const char* str)
 {
 }
 
-StringId32::StringId32(const char* str, uint32_t len)
+StringId32::StringId32(const char* str, u32 len)
 	: _id(murmur32(str, len, 0))
 {
 }
@@ -31,7 +31,7 @@ StringId64::StringId64(const char* str)
 {
 }
 
-StringId64::StringId64(const char* str, uint32_t len)
+StringId64::StringId64(const char* str, u32 len)
 	: _id(murmur64(str, len, 0))
 {
 }

+ 10 - 10
src/core/string_id.h

@@ -11,38 +11,38 @@ namespace crown
 {
 struct StringId32
 {
-	uint32_t _id;
+	u32 _id;
 
 	StringId32() : _id(0) {}
-	explicit StringId32(uint32_t idx) : _id(idx) {}
+	explicit StringId32(u32 idx) : _id(idx) {}
 	explicit StringId32(const char* str);
-	explicit StringId32(const char* str, uint32_t len);
+	explicit StringId32(const char* str, u32 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; }
+	u32 id() const { return _id; }
 	const char* to_string(char* buf);
 
-	static const uint32_t STRING_LENGTH = 32;
+	static const u32 STRING_LENGTH = 32;
 };
 
 struct StringId64
 {
-	uint64_t _id;
+	u64 _id;
 
 	StringId64() : _id(0) {}
-	explicit StringId64(uint64_t idx) : _id(idx) {}
+	explicit StringId64(u64 idx) : _id(idx) {}
 	explicit StringId64(const char* str);
-	explicit StringId64(const char* str, uint32_t len);
+	explicit StringId64(const char* str, u32 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; }
+	u64 id() const { return _id; }
 	const char* to_string(char* buf);
 
-	static const uint32_t STRING_LENGTH = 32;
+	static const u32 STRING_LENGTH = 32;
 };
 
 typedef StringId64 ResourceId;

+ 10 - 10
src/core/strings/dynamic_string.h

@@ -39,10 +39,10 @@ public:
 	bool operator==(const char* s) const;
 
 	/// Reserves space for at least @n characters.
-	void reserve(uint32_t n);
+	void reserve(u32 n);
 
 	// Returns the length of the string.
-	uint32_t length() const;
+	u32 length() const;
 
 	/// Removes the leading string @a s.
 	/// @note
@@ -153,12 +153,12 @@ inline bool DynamicString::operator==(const char* s) const
 	return strcmp(c_str(), s) == 0;
 }
 
-inline void DynamicString::reserve(uint32_t n)
+inline void DynamicString::reserve(u32 n)
 {
 	array::reserve(_data, n);
 }
 
-inline uint32_t DynamicString::length() const
+inline u32 DynamicString::length() const
 {
 	return strlen32(this->c_str());
 }
@@ -168,8 +168,8 @@ inline void DynamicString::strip_leading(const char* s)
 	CE_ASSERT_NOT_NULL(s);
 	CE_ASSERT(starts_with(s), "String does not start with %s", s);
 
-	const uint32_t my_len = strlen32(c_str());
-	const uint32_t s_len = strlen32(s);
+	const u32 my_len = strlen32(c_str());
+	const u32 s_len = strlen32(s);
 
 	memmove(array::begin(_data), array::begin(_data) + s_len, (my_len - s_len));
 	array::resize(_data, my_len - s_len);
@@ -180,8 +180,8 @@ inline void DynamicString::strip_trailing(const char* s)
 	CE_ASSERT_NOT_NULL(s);
 	CE_ASSERT(ends_with(s), "String does not end with %s", s);
 
-	const uint32_t my_len = strlen32(c_str());
-	const uint32_t s_len = strlen32(s);
+	const u32 my_len = strlen32(c_str());
+	const u32 s_len = strlen32(s);
 	array::resize(_data, my_len - s_len);
 }
 
@@ -195,8 +195,8 @@ inline bool DynamicString::ends_with(const char* s) const
 {
 	CE_ASSERT_NOT_NULL(s);
 
-	const uint32_t my_len = strlen32(c_str());
-	const uint32_t s_len = strlen32(s);
+	const u32 my_len = strlen32(c_str());
+	const u32 s_len = strlen32(s);
 
 	if (my_len >= s_len)
 	{

+ 5 - 5
src/core/strings/fixed_string.h

@@ -26,7 +26,7 @@ public:
 	{
 	}
 
-	FixedString(const char* str, uint32_t len)
+	FixedString(const char* str, u32 len)
 		: _length(len)
 		, _data(str)
 	{
@@ -47,7 +47,7 @@ public:
 
 	bool operator==(const char* str) const
 	{
-		const uint32_t len = strlen32(str);
+		const u32 len = strlen32(str);
 		return _length == len && !strncmp(_data, str, len);
 	}
 
@@ -58,11 +58,11 @@ public:
 
 	bool operator<(const FixedString& b) const
 	{
-		const uint32_t len = std::max(_length, b._length);
+		const u32 len = std::max(_length, b._length);
 		return strncmp(_data, b._data, len) < 0;
 	}
 
-	uint32_t length() const
+	u32 length() const
 	{
 		return _length;
 	}
@@ -74,7 +74,7 @@ public:
 
 private:
 
-	uint32_t _length;
+	u32 _length;
 	const char* _data;
 };
 

+ 16 - 16
src/core/strings/string_stream.h

@@ -18,14 +18,14 @@ namespace string_stream
 {
 	/// Appends @a val to the stream @a s using appropriate formatting.
 	StringStream& operator<<(StringStream& s, char ch);
-	StringStream& operator<<(StringStream& s, int16_t val);
-	StringStream& operator<<(StringStream& s, uint16_t val);
-	StringStream& operator<<(StringStream& s, int32_t val);
-	StringStream& operator<<(StringStream& s, uint32_t val);
-	StringStream& operator<<(StringStream& s, int64_t val);
-	StringStream& operator<<(StringStream& s, uint64_t val);
-	StringStream& operator<<(StringStream& s, float val);
-	StringStream& operator<<(StringStream& s, double val);
+	StringStream& operator<<(StringStream& s, s16 val);
+	StringStream& operator<<(StringStream& s, u16 val);
+	StringStream& operator<<(StringStream& s, s32 val);
+	StringStream& operator<<(StringStream& s, u32 val);
+	StringStream& operator<<(StringStream& s, s64 val);
+	StringStream& operator<<(StringStream& s, u64 val);
+	StringStream& operator<<(StringStream& s, f32 val);
+	StringStream& operator<<(StringStream& s, f64 val);
 
 	/// Appends the string @a string to the stream @a s.
 	StringStream& operator<<(StringStream& s, const char* string);
@@ -45,42 +45,42 @@ namespace string_stream
 		return s;
 	}
 
-	inline StringStream& operator<<(StringStream& s, int16_t val)
+	inline StringStream& operator<<(StringStream& s, s16 val)
 	{
 		return stream_printf(s, "%hd", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, uint16_t val)
+	inline StringStream& operator<<(StringStream& s, u16 val)
 	{
 		return stream_printf(s, "%hu", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, int32_t val)
+	inline StringStream& operator<<(StringStream& s, s32 val)
 	{
 		return stream_printf(s, "%d", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, uint32_t val)
+	inline StringStream& operator<<(StringStream& s, u32 val)
 	{
 		return stream_printf(s, "%u", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, int64_t val)
+	inline StringStream& operator<<(StringStream& s, s64 val)
 	{
 		return stream_printf(s, "%lld", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, uint64_t val)
+	inline StringStream& operator<<(StringStream& s, u64 val)
 	{
 		return stream_printf(s, "%llu", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, float val)
+	inline StringStream& operator<<(StringStream& s, f32 val)
 	{
 		return stream_printf(s, "%g", val);
 	}
 
-	inline StringStream& operator<<(StringStream& s, double val)
+	inline StringStream& operator<<(StringStream& s, f64 val)
 	{
 		return stream_printf(s, "%g", val);
 	}

+ 7 - 7
src/core/strings/string_utils.h

@@ -14,28 +14,28 @@
 
 namespace crown
 {
-inline int32_t vsnprintf(char* str, size_t num, const char* format, va_list args)
+inline s32 vsnprintf(char* str, size_t num, const char* format, va_list args)
 {
 #if CROWN_COMPILER_MSVC
-	int32_t len = _vsnprintf_s(str, num, _TRUNCATE, format, args);
+	s32 len = _vsnprintf_s(str, num, _TRUNCATE, format, args);
 	return (len == 1) ? _vscprintf(format, args) : len;
 #else
 	return ::vsnprintf(str, num, format, args);
 #endif // CROWN_COMPILER_MSVC
 }
 
-inline int32_t snprintf(char* str, size_t n, const char* format, ...)
+inline s32 snprintf(char* str, size_t n, const char* format, ...)
 {
 	va_list args;
 	va_start(args, format);
-	int32_t len = vsnprintf(str, n, format, args);
+	s32 len = vsnprintf(str, n, format, args);
 	va_end(args);
 	return len;
 }
 
-inline uint32_t strlen32(const char* str)
+inline u32 strlen32(const char* str)
 {
-	return (uint32_t)strlen(str);
+	return (u32)strlen(str);
 }
 
 inline const char* skip_spaces(const char* str)
@@ -46,7 +46,7 @@ inline const char* skip_spaces(const char* str)
 
 inline const char* skip_block(const char* str, char a, char b)
 {
-	uint32_t num = 0;
+	u32 num = 0;
 
 	for (char ch = *str++; ch != '\0'; ch = *str++)
 	{

+ 1 - 1
src/core/thread/atomic_int.h

@@ -27,7 +27,7 @@ struct AtomicInt
 		__sync_fetch_and_add(&_val, 0);
 		return _val;
 #elif CROWN_PLATFORM_WINDOWS
-		InterlockedExchangeAdd(&_val, (int32_t)0);
+		InterlockedExchangeAdd(&_val, (s32)0);
 		return _val;
 #endif
 	}

+ 3 - 3
src/core/thread/semaphore.h

@@ -51,12 +51,12 @@ struct Semaphore
 #endif
 	}
 
-	void post(uint32_t count = 1)
+	void post(u32 count = 1)
 	{
 #if CROWN_PLATFORM_POSIX
 		ScopedMutex sm(_mutex);
 
-		for (uint32_t i = 0; i < count; ++i)
+		for (u32 i = 0; i < count; ++i)
 		{
 			int err = pthread_cond_signal(&_cond);
 			CE_ASSERT(err == 0, "pthread_cond_signal: errno = %d", err);
@@ -96,7 +96,7 @@ private:
 #if CROWN_PLATFORM_POSIX
 	Mutex _mutex;
 	pthread_cond_t _cond;
-	int32_t _count;
+	s32 _count;
 #elif CROWN_PLATFORM_WINDOWS
 	HANDLE _handle;
 #endif

+ 6 - 6
src/core/thread/thread.h

@@ -19,7 +19,7 @@
 
 namespace crown
 {
-typedef int32_t (*ThreadFunction)(void*);
+typedef s32 (*ThreadFunction)(void*);
 
 struct Thread
 {
@@ -42,7 +42,7 @@ struct Thread
 			stop();
 	}
 
-	void start(ThreadFunction func, void* data = NULL, uint32_t stack_size = 0)
+	void start(ThreadFunction func, void* data = NULL, u32 stack_size = 0)
 	{
 		CE_ASSERT(!_is_running, "Thread is already running");
 		CE_ASSERT(func != NULL, "Function must be != NULL");
@@ -104,7 +104,7 @@ struct Thread
 
 private:
 
-	int32_t run()
+	s32 run()
 	{
 		_sem.post();
 		return _function(_data);
@@ -113,7 +113,7 @@ private:
 #if CROWN_PLATFORM_POSIX
 	static void* thread_proc(void* arg)
 	{
-		static int32_t result = -1;
+		static s32 result = -1;
 		result = ((Thread*)arg)->run();
 		return (void*)&result;
 	}
@@ -121,7 +121,7 @@ private:
 	static DWORD WINAPI thread_proc(void* arg)
 	{
 		Thread* thread = (Thread*) arg;
-		int32_t result = thread->run();
+		s32 result = thread->run();
 		return result;
 	}
 #endif
@@ -137,7 +137,7 @@ private:
 	ThreadFunction _function;
 	void* _data;
 	Semaphore _sem;
-	uint32_t _stack_size;
+	u32 _stack_size;
 	bool _is_running;
 
 private:

+ 11 - 0
src/core/types.h

@@ -7,3 +7,14 @@
 
 #include <stddef.h> // NULL
 #include <stdint.h>
+
+typedef int8_t   s8;
+typedef uint8_t  u8;
+typedef int16_t  s16;
+typedef uint16_t u16;
+typedef int32_t  s32;
+typedef uint32_t u32;
+typedef int64_t  s64;
+typedef uint64_t u64;
+typedef float    f32;
+typedef double   f64;

+ 24 - 24
src/device.cpp

@@ -49,7 +49,7 @@ struct BgfxCallback : public bgfx::CallbackI
 		CE_UNUSED(_str);
 	}
 
-	virtual void traceVargs(const char* /*_filePath*/, uint16_t /*_line*/, const char* _format, va_list _argList)
+	virtual void traceVargs(const char* /*_filePath*/, u16 /*_line*/, const char* _format, va_list _argList)
 	{
 		char buf[2048];
 		strncpy(buf, _format, sizeof(buf));
@@ -57,25 +57,25 @@ struct BgfxCallback : public bgfx::CallbackI
 		CE_LOGDV(buf, _argList);
 	}
 
-	virtual uint32_t cacheReadSize(uint64_t /*_id*/)
+	virtual u32 cacheReadSize(u64 /*_id*/)
 	{
 		return 0;
 	}
 
-	virtual bool cacheRead(uint64_t /*_id*/, void* /*_data*/, uint32_t /*_size*/)
+	virtual bool cacheRead(u64 /*_id*/, void* /*_data*/, u32 /*_size*/)
 	{
 		return false;
 	}
 
-	virtual void cacheWrite(uint64_t /*_id*/, const void* /*_data*/, uint32_t /*_size*/)
+	virtual void cacheWrite(u64 /*_id*/, const void* /*_data*/, u32 /*_size*/)
 	{
 	}
 
-	virtual void screenShot(const char* /*_filePath*/, uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, const void* /*_data*/, uint32_t /*_size*/, bool /*_yflip*/)
+	virtual void screenShot(const char* /*_filePath*/, u32 /*_width*/, u32 /*_height*/, u32 /*_pitch*/, const void* /*_data*/, u32 /*_size*/, bool /*_yflip*/)
 	{
 	}
 
-	virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, bgfx::TextureFormat::Enum /*_format*/, bool /*_yflip*/)
+	virtual void captureBegin(u32 /*_width*/, u32 /*_height*/, u32 /*_pitch*/, bgfx::TextureFormat::Enum /*_format*/, bool /*_yflip*/)
 	{
 	}
 
@@ -83,7 +83,7 @@ struct BgfxCallback : public bgfx::CallbackI
 	{
 	}
 
-	virtual void captureFrame(const void* /*_data*/, uint32_t /*_size*/)
+	virtual void captureFrame(const void* /*_data*/, u32 /*_size*/)
 	{
 	}
 };
@@ -95,10 +95,10 @@ struct BgfxAllocator : public bx::AllocatorI
 	{
 	}
 
-	virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* /*_file*/, uint32_t /*_line*/)
+	virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* /*_file*/, u32 /*_line*/)
 	{
 		if (!_ptr)
-			return _allocator.allocate((uint32_t)_size, (uint32_t)_align == 0 ? 1 : (uint32_t)_align);
+			return _allocator.allocate((u32)_size, (u32)_align == 0 ? 1 : (u32)_align);
 
 		if (_size == 0)
 		{
@@ -107,7 +107,7 @@ struct BgfxAllocator : public bx::AllocatorI
 		}
 
 		// Realloc
-		void* p = _allocator.allocate((uint32_t)_size, (uint32_t)_align == 0 ? 1 : (uint32_t)_align);
+		void* p = _allocator.allocate((u32)_size, (u32)_align == 0 ? 1 : (u32)_align);
 		_allocator.deallocate(_ptr);
 		return p;
 	}
@@ -132,8 +132,8 @@ Device::Device(const DeviceOptions& opts)
 	, _lua_environment(NULL)
 	, _display(NULL)
 	, _window(NULL)
-	, _boot_package_id(uint64_t(0))
-	, _boot_script_id(uint64_t(0))
+	, _boot_package_id(u64(0))
+	, _boot_script_id(u64(0))
 	, _boot_package(NULL)
 	, _worlds(default_allocator())
 	, _width(0)
@@ -267,7 +267,7 @@ void Device::unpause()
 	CE_LOGI("Engine unpaused.");
 }
 
-void Device::resolution(uint16_t& width, uint16_t& height)
+void Device::resolution(u16& width, u16& height)
 {
 	width = _width;
 	height = _height;
@@ -278,17 +278,17 @@ bool Device::is_running() const
 	return _is_running;
 }
 
-uint64_t Device::frame_count() const
+u64 Device::frame_count() const
 {
 	return _frame_count;
 }
 
-float Device::last_delta_time() const
+f32 Device::last_delta_time() const
 {
 	return _last_delta_time;
 }
 
-double Device::time_since_start() const
+f64 Device::time_since_start() const
 {
 	return _time_since_start;
 }
@@ -298,10 +298,10 @@ void Device::update()
 	while (!process_events() && _is_running)
 	{
 		_current_time = os::clocktime();
-		const int64_t time = _current_time - _last_time;
+		const s64 time = _current_time - _last_time;
 		_last_time = _current_time;
-		const double freq = (double) os::clockfrequency();
-		_last_delta_time = float(time * (1.0 / freq));
+		const f64 freq = (f64) os::clockfrequency();
+		_last_delta_time = f32(time * (1.0 / freq));
 		_time_since_start += _last_delta_time;
 
 		profiler_globals::clear();
@@ -320,8 +320,8 @@ void Device::update()
 		_input_manager->update();
 
 		const bgfx::Stats* stats = bgfx::getStats();
-		RECORD_FLOAT("bgfx.gpu_time", double(stats->gpuTimeEnd - stats->gpuTimeBegin)*1000.0/stats->gpuTimerFreq);
-		RECORD_FLOAT("bgfx.cpu_time", double(stats->cpuTimeEnd - stats->cpuTimeBegin)*1000.0/stats->cpuTimerFreq);
+		RECORD_FLOAT("bgfx.gpu_time", f64(stats->gpuTimeEnd - stats->gpuTimeBegin)*1000.0/stats->gpuTimerFreq);
+		RECORD_FLOAT("bgfx.cpu_time", f64(stats->cpuTimeEnd - stats->cpuTimeBegin)*1000.0/stats->cpuTimerFreq);
 
 		bgfx::frame();
 		profiler_globals::flush();
@@ -352,7 +352,7 @@ World* Device::create_world()
 
 void Device::destroy_world(World& w)
 {
-	for (uint32_t i = 0, n = array::size(_worlds); i < n; ++i)
+	for (u32 i = 0, n = array::size(_worlds); i < n; ++i)
 	{
 		if (&w == _worlds[i])
 		{
@@ -462,8 +462,8 @@ bool Device::process_events()
 	bool exit = false;
 	InputManager* im = _input_manager;
 
-	const int16_t dt_x = _mouse_curr_x - _mouse_last_x;
-	const int16_t dt_y = _mouse_curr_y - _mouse_last_y;
+	const s16 dt_x = _mouse_curr_x - _mouse_last_x;
+	const s16 dt_y = _mouse_curr_y - _mouse_last_y;
 	im->mouse()->set_axis(MouseAxis::CURSOR_DELTA, vector3(dt_x, dt_y, 0.0f));
 	_mouse_last_x = _mouse_curr_x;
 	_mouse_last_y = _mouse_curr_y;

+ 15 - 15
src/device.h

@@ -55,22 +55,22 @@ class Device
 
 	Array<World*> _worlds;
 
-	uint16_t _width;
-	uint16_t _height;
-	int16_t _mouse_curr_x;
-	int16_t _mouse_curr_y;
-	int16_t _mouse_last_x;
-	int16_t _mouse_last_y;
+	u16 _width;
+	u16 _height;
+	s16 _mouse_curr_x;
+	s16 _mouse_curr_y;
+	s16 _mouse_last_x;
+	s16 _mouse_last_y;
 
 	bool _is_init;
 	bool _is_running;
 	bool _is_paused;
 
-	uint64_t _frame_count;
-	int64_t _last_time;
-	int64_t _current_time;
-	float _last_delta_time;
-	double _time_since_start;
+	u64 _frame_count;
+	s64 _last_time;
+	s64 _current_time;
+	f32 _last_delta_time;
+	f64 _time_since_start;
 
 	void read_config();
 	bool process_events();
@@ -104,13 +104,13 @@ public:
 	bool is_running() const;
 
 	/// Return the number of frames rendered.
-	uint64_t frame_count() const;
+	u64 frame_count() const;
 
 	/// Returns the time in seconds needed to render the last frame.
-	float last_delta_time() const;
+	f32 last_delta_time() const;
 
 	/// Returns the time in seconds since the the application started.
-	double time_since_start() const;
+	f64 time_since_start() const;
 
 	/// Quits the application.
 	void quit();
@@ -122,7 +122,7 @@ public:
 	void unpause();
 
 	/// Returns the main window resolution.
-	void resolution(uint16_t& width, uint16_t& height);
+	void resolution(u16& width, u16& height);
 
 	/// Updates all the subsystems.
 	void update();

+ 12 - 12
src/device_options.h

@@ -24,12 +24,12 @@ class DeviceOptions
 	bool _wait_console;
 	bool _do_compile;
 	bool _do_continue;
-	uint32_t _parent_window;
-	uint16_t _console_port;
-	uint16_t _window_x;
-	uint16_t _window_y;
-	uint16_t _window_width;
-	uint16_t _window_height;
+	u32 _parent_window;
+	u16 _console_port;
+	u16 _window_x;
+	u16 _window_y;
+	u16 _window_width;
+	u16 _window_height;
 
 #if CROWN_PLATFORM_ANDROID
 	void* _asset_manager;
@@ -52,12 +52,12 @@ public:
 	bool wait_console() const { return _wait_console; }
 	bool do_compile() const { return _do_compile; }
 	bool do_continue() const { return _do_continue; }
-	uint32_t parent_window() const { return _parent_window; }
-	uint16_t console_port() const { return _console_port; }
-	uint16_t window_x() const { return _window_x; }
-	uint16_t window_y() const { return _window_y; }
-	uint16_t window_width() const { return _window_width; }
-	uint16_t window_height() const { return _window_height; }
+	u32 parent_window() const { return _parent_window; }
+	u16 console_port() const { return _console_port; }
+	u16 window_x() const { return _window_x; }
+	u16 window_y() const { return _window_y; }
+	u16 window_width() const { return _window_width; }
+	u16 window_height() const { return _window_height; }
 
 #if CROWN_PLATFORM_ANDROID
 	void set_asset_manager(void* am) { _asset_manager = am; }

+ 23 - 23
src/input/input_device.cpp

@@ -22,23 +22,23 @@ bool InputDevice::connected() const
 	return _connected;
 }
 
-uint8_t InputDevice::num_buttons() const
+u8 InputDevice::num_buttons() const
 {
 	return _num_buttons;
 }
 
-uint8_t InputDevice::num_axes() const
+u8 InputDevice::num_axes() const
 {
 	return _num_axes;
 }
 
-bool InputDevice::pressed(uint8_t id) const
+bool InputDevice::pressed(u8 id) const
 {
 	CE_ASSERT(id < _num_buttons, "Index out of bounds");
 	return (~_last_state[id] & _current_state[id]) != 0;
 }
 
-bool InputDevice::released(uint8_t id) const
+bool InputDevice::released(u8 id) const
 {
 	CE_ASSERT(id < _num_buttons, "Index out of bounds");
 	return (_last_state[id] & ~_current_state[id]) != 0;
@@ -54,27 +54,27 @@ bool InputDevice::any_released() const
 	return released(_last_button);
 }
 
-Vector3 InputDevice::axis(uint8_t id) const
+Vector3 InputDevice::axis(u8 id) const
 {
 	CE_ASSERT(id < _num_axes, "Index out of bounds");
 	return _axis[id];
 }
 
-const char* InputDevice::button_name(uint8_t id)
+const char* InputDevice::button_name(u8 id)
 {
 	CE_ASSERT(id < _num_buttons, "Index out of bounds");
 	return _button_name[id];
 }
 
-const char* InputDevice::axis_name(uint8_t id)
+const char* InputDevice::axis_name(u8 id)
 {
 	CE_ASSERT(id < _num_axes, "Index out of bounds");
 	return _axis_name[id];
 }
 
-uint8_t InputDevice::button_id(StringId32 name)
+u8 InputDevice::button_id(StringId32 name)
 {
-	for (uint32_t i = 0; i < _num_buttons; ++i)
+	for (u32 i = 0; i < _num_buttons; ++i)
 	{
 		if (_button_hash[i] == name)
 			return i;
@@ -84,9 +84,9 @@ uint8_t InputDevice::button_id(StringId32 name)
 	return 0;
 }
 
-uint8_t InputDevice::axis_id(StringId32 name)
+u8 InputDevice::axis_id(StringId32 name)
 {
-	for (uint32_t i = 0; i < _num_axes; ++i)
+	for (u32 i = 0; i < _num_axes; ++i)
 	{
 		if (_axis_hash[i] == name)
 			return i;
@@ -101,14 +101,14 @@ void InputDevice::set_connected(bool connected)
 	_connected = connected;
 }
 
-void InputDevice::set_button_state(uint8_t i, bool state)
+void InputDevice::set_button_state(u8 i, bool state)
 {
 	CE_ASSERT(i < _num_buttons, "Index out of bounds");
 	_last_button = i;
 	_current_state[i] = state;
 }
 
-void InputDevice::set_axis(uint8_t i, const Vector3& value)
+void InputDevice::set_axis(u8 i, const Vector3& value)
 {
 	CE_ASSERT(i < _num_axes, "Index out of bounds");
 	_axis[i] = value;
@@ -116,14 +116,14 @@ void InputDevice::set_axis(uint8_t i, const Vector3& value)
 
 void InputDevice::update()
 {
-	memcpy(_last_state, _current_state, sizeof(uint8_t)*_num_buttons);
+	memcpy(_last_state, _current_state, sizeof(u8)*_num_buttons);
 }
 
-InputDevice* InputDevice::create(Allocator& a, const char* name, uint8_t num_buttons, uint8_t num_axes, const char** button_names, const char** axis_names)
+InputDevice* InputDevice::create(Allocator& a, const char* name, u8 num_buttons, u8 num_axes, const char** button_names, const char** axis_names)
 {
-	const uint32_t size = 0
+	const u32 size = 0
 		+ sizeof(InputDevice)
-		+ sizeof(uint8_t)*num_buttons*2
+		+ sizeof(u8)*num_buttons*2
 		+ sizeof(Vector3)*num_axes
 		+ sizeof(char*)*num_buttons
 		+ sizeof(char*)*num_axes
@@ -139,8 +139,8 @@ InputDevice* InputDevice::create(Allocator& a, const char* name, uint8_t num_but
 	id->_num_axes = num_axes;
 	id->_last_button = 0;
 
-	id->_last_state = (uint8_t*)&id[1];
-	id->_current_state = (uint8_t*)(id->_last_state + num_buttons);
+	id->_last_state = (u8*)&id[1];
+	id->_current_state = (u8*)(id->_last_state + num_buttons);
 	id->_axis = (Vector3*)(id->_current_state + num_buttons);
 	id->_button_name = (const char**)(id->_axis + num_axes);
 	id->_axis_name = (const char**)(id->_button_name + num_buttons);
@@ -148,16 +148,16 @@ InputDevice* InputDevice::create(Allocator& a, const char* name, uint8_t num_but
 	id->_axis_hash = (StringId32*)(id->_button_hash + num_buttons);
 	id->_name = (char*)(id->_axis_hash + num_axes);
 
-	memset(id->_last_state, 0, sizeof(uint8_t)*num_buttons);
-	memset(id->_current_state, 0, sizeof(uint8_t)*num_buttons);
+	memset(id->_last_state, 0, sizeof(u8)*num_buttons);
+	memset(id->_current_state, 0, sizeof(u8)*num_buttons);
 	memset(id->_axis, 0, sizeof(Vector3)*num_axes);
 	memcpy(id->_button_name, button_names, sizeof(const char*)*num_buttons);
 	memcpy(id->_axis_name, axis_names, sizeof(const char*)*num_axes);
 
-	for (uint32_t i = 0; i < num_buttons; ++i)
+	for (u32 i = 0; i < num_buttons; ++i)
 		id->_button_hash[i] = StringId32(button_names[i]);
 
-	for (uint32_t i = 0; i < num_axes; ++i)
+	for (u32 i = 0; i < num_axes; ++i)
 		id->_axis_hash[i] = StringId32(axis_names[i]);
 
 	strcpy(id->_name, name);

+ 17 - 17
src/input/input_device.h

@@ -18,12 +18,12 @@ namespace crown
 class InputDevice
 {
 	bool _connected;
-	uint8_t _num_buttons;
-	uint8_t _num_axes;
-	uint8_t _last_button;
+	u8 _num_buttons;
+	u8 _num_axes;
+	u8 _last_button;
 
-	uint8_t* _last_state;      // num_buttons
-	uint8_t* _current_state;   // num_buttons
+	u8* _last_state;           // num_buttons
+	u8* _current_state;        // num_buttons
 	Vector3* _axis;            // num_axes
 	const char** _button_name; // num_buttons
 	const char** _axis_name;   // num_axes
@@ -40,16 +40,16 @@ public:
 	bool connected() const;
 
 	/// Returns the number of buttons of the input device.
-	uint8_t num_buttons() const;
+	u8 num_buttons() const;
 
 	/// Returns the number of axes of the input devices.
-	uint8_t num_axes() const;
+	u8 num_axes() const;
 
 	/// Returns whether the button @a id is pressed in the current frame.
-	bool pressed(uint8_t id) const;
+	bool pressed(u8 id) const;
 
 	/// Returns whether the button @a id is released in the current frame.
-	bool released(uint8_t id) const;
+	bool released(u8 id) const;
 
 	/// Returns whether any button is pressed in the current frame.
 	bool any_pressed() const;
@@ -58,29 +58,29 @@ public:
 	bool any_released() const;
 
 	/// Returns the value of the axis @a id.
-	Vector3 axis(uint8_t id) const;
+	Vector3 axis(u8 id) const;
 
 	/// Returns the name of the button @a id.
-	const char* button_name(uint8_t id);
+	const char* button_name(u8 id);
 
 	/// Returns the name of the axis @a id.
-	const char* axis_name(uint8_t id);
+	const char* axis_name(u8 id);
 
 	/// Returns the id of the button @a name.
-	uint8_t button_id(StringId32 name);
+	u8 button_id(StringId32 name);
 
 	/// Returns the id of the axis @a name.
-	uint8_t axis_id(StringId32 name);
+	u8 axis_id(StringId32 name);
 
 	void set_connected(bool connected);
 
-	void set_button_state(uint8_t i, bool state);
+	void set_button_state(u8 i, bool state);
 
-	void set_axis(uint8_t i, const Vector3& value);
+	void set_axis(u8 i, const Vector3& value);
 
 	void update();
 
-	static InputDevice* create(Allocator& a, const char* name, uint8_t num_buttons, uint8_t num_axes, const char** button_names, const char** axis_names);
+	static InputDevice* create(Allocator& a, const char* name, u8 num_buttons, u8 num_axes, const char** button_names, const char** axis_names);
 	static void destroy(Allocator& a, InputDevice* id);
 };
 

+ 5 - 5
src/input/input_manager.cpp

@@ -184,7 +184,7 @@ InputManager::InputManager(Allocator& a)
 		, NULL
 		);
 
-	for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+	for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 	{
 		_joypad[i] = InputDevice::create(*_allocator
 			, "Joypad"
@@ -202,7 +202,7 @@ InputManager::InputManager(Allocator& a)
 
 InputManager::~InputManager()
 {
-	for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+	for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		InputDevice::destroy(*_allocator, _joypad[i]);
 
 	InputDevice::destroy(*_allocator, _touch);
@@ -225,12 +225,12 @@ InputDevice* InputManager::touch()
 	return _touch;
 }
 
-uint8_t InputManager::num_joypads()
+u8 InputManager::num_joypads()
 {
 	return CE_COUNTOF(_joypad);
 }
 
-InputDevice* InputManager::joypad(uint8_t i)
+InputDevice* InputManager::joypad(u8 i)
 {
 	CE_ASSERT(i < CROWN_MAX_JOYPADS, "Index out of bounds");
 	return _joypad[i];
@@ -242,7 +242,7 @@ void InputManager::update()
 	_mouse->update();
 	_touch->update();
 
-	for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+	for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		_joypad[i]->update();
 }
 

+ 2 - 2
src/input/input_manager.h

@@ -38,10 +38,10 @@ public:
 	InputDevice* touch();
 
 	/// Returns the number of joypads.
-	uint8_t num_joypads();
+	u8 num_joypads();
 
 	/// Returns the joypad @a i.
-	InputDevice* joypad(uint8_t i);
+	InputDevice* joypad(u8 i);
 
 	/// Updates the input devices
 	void update();

+ 23 - 23
src/lua/lua_api.cpp

@@ -76,7 +76,7 @@ CE_STATIC_ASSERT(CE_COUNTOF(s_raycast) == RaycastMode::COUNT);
 
 static LightType::Enum name_to_light_type(const char* name)
 {
-	for (uint32_t i = 0; i < CE_COUNTOF(s_light); ++i)
+	for (u32 i = 0; i < CE_COUNTOF(s_light); ++i)
 	{
 		if (strcmp(s_light[i].name, name) == 0)
 			return s_light[i].type;
@@ -87,7 +87,7 @@ static LightType::Enum name_to_light_type(const char* name)
 
 static ProjectionType::Enum name_to_projection_type(const char* name)
 {
-	for (uint32_t i = 0; i < CE_COUNTOF(s_projection); ++i)
+	for (u32 i = 0; i < CE_COUNTOF(s_projection); ++i)
 	{
 		if (strcmp(s_projection[i].name, name) == 0)
 			return s_projection[i].type;
@@ -98,7 +98,7 @@ static ProjectionType::Enum name_to_projection_type(const char* name)
 
 static RaycastMode::Enum name_to_raycast_mode(const char* name)
 {
-	for (uint32_t i = 0; i < CE_COUNTOF(s_raycast); ++i)
+	for (u32 i = 0; i < CE_COUNTOF(s_raycast); ++i)
 	{
 		if (strcmp(s_raycast[i].name, name) == 0)
 			return s_raycast[i].mode;
@@ -113,7 +113,7 @@ static int math_ray_plane_intersection(lua_State* L)
 	const Plane p = plane::from_point_and_normal(stack.get_vector3(3)
 		, stack.get_vector3(4)
 		);
-	const float t = ray_plane_intersection(stack.get_vector3(1)
+	const f32 t = ray_plane_intersection(stack.get_vector3(1)
 		, stack.get_vector3(2)
 		, p
 		);
@@ -124,7 +124,7 @@ static int math_ray_plane_intersection(lua_State* L)
 static int math_ray_disc_intersection(lua_State* L)
 {
 	LuaStack stack(L);
-	const float t = ray_disc_intersection(stack.get_vector3(1)
+	const f32 t = ray_disc_intersection(stack.get_vector3(1)
 		, stack.get_vector3(2)
 		, stack.get_vector3(3)
 		, stack.get_float(4)
@@ -140,7 +140,7 @@ static int math_ray_sphere_intersection(lua_State* L)
 	Sphere s;
 	s.c = stack.get_vector3(3);
 	s.r = stack.get_float(4);
-	const float t = ray_sphere_intersection(stack.get_vector3(1)
+	const f32 t = ray_sphere_intersection(stack.get_vector3(1)
 		, stack.get_vector3(2)
 		, s
 		);
@@ -151,7 +151,7 @@ static int math_ray_sphere_intersection(lua_State* L)
 static int math_ray_obb_intersection(lua_State* L)
 {
 	LuaStack stack(L);
-	const float t = ray_obb_intersection(stack.get_vector3(1)
+	const f32 t = ray_obb_intersection(stack.get_vector3(1)
 		, stack.get_vector3(2)
 		, stack.get_matrix4x4(3)
 		, stack.get_vector3(4)
@@ -987,7 +987,7 @@ static int lightuserdata_newindex(lua_State* L)
 	LuaStack stack(L);
 	Vector3& v = stack.get_vector3(1);
 	const char* s = stack.get_string(2);
-	const float value = stack.get_float(3);
+	const f32 value = stack.get_float(3);
 
 	switch (s[0])
 	{
@@ -1240,12 +1240,12 @@ static int world_units(lua_State* L)
 	Array<UnitId> units(alloc);
 	stack.get_world(1)->units(units);
 
-	const uint32_t num = array::size(units);
+	const u32 num = array::size(units);
 
 	stack.push_table(num);
-	for (uint32_t i = 0; i < num; ++i)
+	for (u32 i = 0; i < num; ++i)
 	{
-		stack.push_key_begin((int32_t) i + 1);
+		stack.push_key_begin((s32) i + 1);
 		stack.push_unit(units[i]);
 		stack.push_key_end();
 	}
@@ -1390,13 +1390,13 @@ static int world_update(lua_State* L)
 static int world_play_sound(lua_State* L)
 {
 	LuaStack stack(L);
-	const int32_t nargs = stack.num_args();
+	const s32 nargs = stack.num_args();
 	World* world = stack.get_world(1);
 	const StringId64 name = stack.get_resource_id(2);
 	const bool loop    = nargs > 2 ? stack.get_bool(3)    : false;
-	const float volume = nargs > 3 ? stack.get_float(4)   : 1.0f;
+	const f32 volume = nargs > 3 ? stack.get_float(4)   : 1.0f;
 	const Vector3& pos = nargs > 4 ? stack.get_vector3(5) : VECTOR3_ZERO;
-	const float range  = nargs > 5 ? stack.get_float(6)   : 1000.0f;
+	const f32 range  = nargs > 5 ? stack.get_float(6)   : 1000.0f;
 
 	LUA_ASSERT(device()->resource_manager()->can_get(SOUND_TYPE, name), stack, "Sound not found");
 
@@ -1674,7 +1674,7 @@ static int render_world_mesh_instances(lua_State* L)
 	MeshInstance inst = rw->first_mesh(unit);
 
 	stack.push_table();
-	for (uint32_t i = 0; rw->is_valid(inst); ++i, inst = rw->next_mesh(inst))
+	for (u32 i = 0; rw->is_valid(inst); ++i, inst = rw->next_mesh(inst))
 	{
 		stack.push_key_begin(i+1);
 		stack.push_mesh_instance(inst);
@@ -1730,7 +1730,7 @@ static int render_world_sprite_instances(lua_State* L)
 	SpriteInstance inst = rw->first_sprite(unit);
 
 	stack.push_table();
-	for (uint32_t i = 0; rw->is_valid(inst); ++i, inst = rw->next_sprite(inst))
+	for (u32 i = 0; rw->is_valid(inst); ++i, inst = rw->next_sprite(inst))
 	{
 		stack.push_key_begin(i+1);
 		stack.push_sprite_instance(inst);
@@ -2178,7 +2178,7 @@ static int physics_world_raycast(lua_State* L)
 		);
 
 	stack.push_table();
-	for (uint32_t i = 0; i < array::size(hits); ++i)
+	for (u32 i = 0; i < array::size(hits); ++i)
 	{
 		stack.push_key_begin(i+1);
 		stack.push_actor(hits[i].actor);
@@ -2291,7 +2291,7 @@ static int device_quit(lua_State* /*L*/)
 static int device_resolution(lua_State* L)
 {
 	LuaStack stack(L);
-	uint16_t w, h;
+	u16 w, h;
 	device()->resolution(w, h);
 	stack.push_int(w);
 	stack.push_int(h);
@@ -2415,7 +2415,7 @@ static int debug_line_add_line(lua_State* L)
 static int debug_line_add_axes(lua_State* L)
 {
 	LuaStack stack(L);
-	const float len = stack.num_args() == 3
+	const f32 len = stack.num_args() == 3
 		? stack.get_float(3)
 		: 1.0f
 		;
@@ -2426,7 +2426,7 @@ static int debug_line_add_axes(lua_State* L)
 static int debug_line_add_circle(lua_State* L)
 {
 	LuaStack stack(L);
-	const uint32_t segments = stack.num_args() >= 6
+	const u32 segments = stack.num_args() >= 6
 		? stack.get_int(6)
 		: DebugLine::NUM_SEGMENTS
 		;
@@ -2442,7 +2442,7 @@ static int debug_line_add_circle(lua_State* L)
 static int debug_line_add_cone(lua_State* L)
 {
 	LuaStack stack(L);
-	const uint32_t segments = stack.num_args() >= 6
+	const u32 segments = stack.num_args() >= 6
 		? stack.get_int(6)
 		: DebugLine::NUM_SEGMENTS
 		;
@@ -2458,7 +2458,7 @@ static int debug_line_add_cone(lua_State* L)
 static int debug_line_add_sphere(lua_State* L)
 {
 	LuaStack stack(L);
-	const uint32_t segments = stack.num_args() >= 5
+	const u32 segments = stack.num_args() >= 5
 		? stack.get_int(5)
 		: DebugLine::NUM_SEGMENTS
 		;
@@ -2620,7 +2620,7 @@ static int display_modes(lua_State* L)
 	Array<DisplayMode> modes(ta);
 	device()->display()->modes(modes);
 	stack.push_table(array::size(modes));
-	for (uint32_t i = 0; i < array::size(modes); ++i)
+	for (u32 i = 0; i < array::size(modes); ++i)
 	{
 		stack.push_key_begin(i+1);
 		stack.push_table(3);

+ 3 - 3
src/lua/lua_environment.cpp

@@ -164,7 +164,7 @@ void LuaEnvironment::load_module_constructor(const char* module, const lua_CFunc
 	lua_pop(L, -1);
 }
 
-void LuaEnvironment::call_global(const char* func, uint8_t argc, ...)
+void LuaEnvironment::call_global(const char* func, u8 argc, ...)
 {
 	CE_ASSERT_NOT_NULL(func);
 
@@ -176,14 +176,14 @@ void LuaEnvironment::call_global(const char* func, uint8_t argc, ...)
 	lua_pushcfunction(L, error_handler);
 	lua_getglobal(L, func);
 
-	for (uint8_t i = 0; i < argc; i++)
+	for (u8 i = 0; i < argc; i++)
 	{
 		const int type = va_arg(vl, int);
 		switch (type)
 		{
 			case ARGUMENT_FLOAT:
 			{
-				stack.push_float(va_arg(vl, double));
+				stack.push_float(va_arg(vl, f64));
 				break;
 			}
 			default:

+ 4 - 4
src/lua/lua_environment.h

@@ -25,11 +25,11 @@ class LuaEnvironment
 {
 	lua_State* L;
 
-	uint32_t _vec3_used;
+	u32 _vec3_used;
 	Vector3 _vec3_buffer[CROWN_MAX_LUA_VECTOR3];
-	uint32_t _quat_used;
+	u32 _quat_used;
 	Quaternion _quat_buffer[CROWN_MAX_LUA_QUATERNION];
-	uint32_t _mat4_used;
+	u32 _mat4_used;
 	Matrix4x4 s_mat4_buffer[CROWN_MAX_LUA_MATRIX4X4];
 
 public:
@@ -54,7 +54,7 @@ public:
 	/// Example call:
 	/// call_global("myfunc", 1, ARGUMENT_FLOAT, 3.14f)
 	/// Returns true if success, false otherwise
-	void call_global(const char* func, uint8_t argc, ...);
+	void call_global(const char* func, u8 argc, ...);
 
 	/// Resets temporary types.
 	void reset_temporaries();

+ 6 - 6
src/lua/lua_stack.cpp

@@ -122,37 +122,37 @@ void LuaStack::push_color4(const Color4& c)
 
 void LuaStack::check_type(int i, const DebugLine* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != DebugLine::MARKER)
+	if (!is_pointer(i) || *(u32*)p != DebugLine::MARKER)
 		luaL_typerror(L, i, "DebugLine");
 }
 
 void LuaStack::check_type(int i, const ResourcePackage* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != ResourcePackage::MARKER)
+	if (!is_pointer(i) || *(u32*)p != ResourcePackage::MARKER)
 		luaL_typerror(L, i, "ResourcePackage");
 }
 
 void LuaStack::check_type(int i, const World* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != World::MARKER)
+	if (!is_pointer(i) || *(u32*)p != World::MARKER)
 		luaL_typerror(L, i, "World");
 }
 
 void LuaStack::check_type(int i, const SceneGraph* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != SceneGraph::MARKER)
+	if (!is_pointer(i) || *(u32*)p != SceneGraph::MARKER)
 		luaL_typerror(L, i, "SceneGraph");
 }
 
 void LuaStack::check_type(int i, const RenderWorld* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != RenderWorld::MARKER)
+	if (!is_pointer(i) || *(u32*)p != RenderWorld::MARKER)
 		luaL_typerror(L, i, "RenderWorld");
 }
 
 void LuaStack::check_type(int i, const Level* p)
 {
-	if (!is_pointer(i) || *(uint32_t*)p != Level::MARKER)
+	if (!is_pointer(i) || *(u32*)p != Level::MARKER)
 		luaL_typerror(L, i, "Level");
 }
 

+ 11 - 11
src/lua/lua_stack.h

@@ -115,9 +115,9 @@ public:
 		return (int)lua_tonumber(L, i);
 	}
 
-	float get_float(int i)
+	f32 get_float(int i)
 	{
-		return (float)lua_tonumber(L, i);
+		return (f32)lua_tonumber(L, i);
 	}
 
 	const char* get_string(int i)
@@ -135,9 +135,9 @@ public:
 		return p;
 	}
 
-	uint32_t get_id(int i)
+	u32 get_id(int i)
 	{
-		return (uint32_t)lua_tonumber(L, i);
+		return (u32)lua_tonumber(L, i);
 	}
 
 	StringId32 get_string_id_32(int i)
@@ -200,7 +200,7 @@ public:
 	PhysicsWorld* get_physics_world(int i)
 	{
 		PhysicsWorld* p = (PhysicsWorld*)get_pointer(i);
-//		if (*(uint32_t*)p != PhysicsWorld::MARKER)
+//		if (*(u32*)p != PhysicsWorld::MARKER)
 //			luaL_typerror(L, i, "PhysicsWorld");
 		return p;
 	}
@@ -208,14 +208,14 @@ public:
 	SoundWorld* get_sound_world(int i)
 	{
 		SoundWorld* p = (SoundWorld*)get_pointer(i);
-//		if (*(uint32_t*)p != SoundWorld::MARKER)
+//		if (*(u32*)p != SoundWorld::MARKER)
 //			luaL_typerror(L, i, "SoundWorld");
 		return p;
 	}
 
 	UnitId get_unit(int i)
 	{
-		uint32_t enc = (uint32_t)(uintptr_t)get_pointer(i);
+		u32 enc = (u32)(uintptr_t)get_pointer(i);
 
 		if ((enc & LIGHTDATA_TYPE_MASK) != UNIT_MARKER)
 			luaL_typerror(L, i, "UnitId");
@@ -327,7 +327,7 @@ public:
 		lua_pushnumber(L, value);
 	}
 
-	void push_float(float value)
+	void push_float(f32 value)
 	{
 		lua_pushnumber(L, value);
 	}
@@ -345,7 +345,7 @@ public:
 		va_end(vl);
 	}
 
-	void push_lstring(const char* s, uint32_t len)
+	void push_lstring(const char* s, u32 len)
 	{
 		lua_pushlstring(L, s, len);
 	}
@@ -366,7 +366,7 @@ public:
 		lua_pushcfunction(L, f);
 	}
 
-	void push_id(uint32_t value)
+	void push_id(u32 value)
 	{
 		lua_pushnumber(L, value);
 	}
@@ -450,7 +450,7 @@ public:
 
 	void push_unit(UnitId id)
 	{
-		uint32_t encoded = (id.encode() << 2) | UNIT_MARKER;
+		u32 encoded = (id.encode() << 2) | UNIT_MARKER;
 		push_pointer((void*)(uintptr_t)encoded);
 	}
 

+ 4 - 4
src/main/display.h

@@ -15,9 +15,9 @@ namespace crown
 /// @ingroup Device
 struct DisplayMode
 {
-	uint32_t id;
-	uint32_t width;
-	uint32_t height;
+	u32 id;
+	u32 width;
+	u32 height;
 };
 
 /// Display interface.
@@ -29,7 +29,7 @@ public:
 
 	/// Opens the window.
 	virtual void modes(Array<DisplayMode>& modes) = 0;
-	virtual void set_mode(uint32_t id) = 0;
+	virtual void set_mode(u32 id) = 0;
 
 	static Display* create(Allocator& a);
 	static void destroy(Allocator& a, Display& d);

+ 29 - 29
src/main/main_android.cpp

@@ -33,7 +33,7 @@ struct MainThreadArgs
 	DeviceOptions* opts;
 };
 
-int32_t func(void* data)
+s32 func(void* data)
 {
 	MainThreadArgs* args = (MainThreadArgs*)data;
 	crown::init(*args->opts);
@@ -55,9 +55,9 @@ struct AndroidDevice
 
 		while (app->destroyRequested == 0)
 		{
-			int32_t num;
+			s32 num;
 			android_poll_source* source;
-			/*int32_t id =*/ ALooper_pollAll(-1, NULL, &num, (void**)&source);
+			/*s32 id =*/ ALooper_pollAll(-1, NULL, &num, (void**)&source);
 
 			if (NULL != source)
 			{
@@ -68,7 +68,7 @@ struct AndroidDevice
 		_main_thread.stop();
 	}
 
-	void process_command(struct android_app* app, int32_t cmd)
+	void process_command(struct android_app* app, s32 cmd)
 	{
 		switch (cmd)
 		{
@@ -81,8 +81,8 @@ struct AndroidDevice
 				CE_ASSERT(app->window != NULL, "Android window is NULL");
 				bgfx::androidSetWindow(app->window);
 				// Push metrics here since Android does not trigger APP_CMD_WINDOW_RESIZED
-				const int32_t width = ANativeWindow_getWidth(app->window);
-				const int32_t height = ANativeWindow_getHeight(app->window);
+				const s32 width = ANativeWindow_getWidth(app->window);
+				const s32 height = ANativeWindow_getHeight(app->window);
 				_queue.push_metrics_event(0, 0, width, height);
 				_main_thread.start(func, &_margs);
 				break;
@@ -113,48 +113,48 @@ struct AndroidDevice
 		}
 	}
 
-	int32_t process_input(struct android_app* app, AInputEvent* event)
+	s32 process_input(struct android_app* app, AInputEvent* event)
 	{
 		if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION)
 		{
-			const int32_t action = AMotionEvent_getAction(event);
-			const int32_t pointer_index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
-			const int32_t pointer_count = AMotionEvent_getPointerCount(event);
+			const s32 action = AMotionEvent_getAction(event);
+			const s32 pointer_index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+			const s32 pointer_count = AMotionEvent_getPointerCount(event);
 
-			const int32_t pointer_id = AMotionEvent_getPointerId(event, pointer_index);
-			const float x = AMotionEvent_getX(event, pointer_index);
-			const float y = AMotionEvent_getY(event, pointer_index);
+			const s32 pointer_id = AMotionEvent_getPointerId(event, pointer_index);
+			const f32 x = AMotionEvent_getX(event, pointer_index);
+			const f32 y = AMotionEvent_getY(event, pointer_index);
 
-			const int32_t actionMasked = (action & AMOTION_EVENT_ACTION_MASK);
+			const s32 actionMasked = (action & AMOTION_EVENT_ACTION_MASK);
 
 			switch (actionMasked)
 			{
 				case AMOTION_EVENT_ACTION_DOWN:
 				case AMOTION_EVENT_ACTION_POINTER_DOWN:
 				{
-					_queue.push_touch_event((int16_t)x, (int16_t)y, (uint8_t)pointer_id, true);
+					_queue.push_touch_event((s16)x, (s16)y, (u8)pointer_id, true);
 					break;
 				}
 				case AMOTION_EVENT_ACTION_UP:
 				case AMOTION_EVENT_ACTION_POINTER_UP:
 				{
-					_queue.push_touch_event((int16_t)x, (int16_t)y, (uint8_t)pointer_id, false);
+					_queue.push_touch_event((s16)x, (s16)y, (u8)pointer_id, false);
 					break;
 				}
 				case AMOTION_EVENT_ACTION_OUTSIDE:
 				case AMOTION_EVENT_ACTION_CANCEL:
 				{
-					_queue.push_touch_event((int16_t)x, (int16_t)y, (uint8_t)pointer_id, false);
+					_queue.push_touch_event((s16)x, (s16)y, (u8)pointer_id, false);
 					break;
 				}
 				case AMOTION_EVENT_ACTION_MOVE:
 				{
 					for (int index = 0; index < pointer_count; index++)
 					{
-						const float xx = AMotionEvent_getX(event, index);
-						const float yy = AMotionEvent_getY(event, index);
-						const int32_t id = AMotionEvent_getPointerId(event, index);
-						_queue.push_touch_event((int16_t)xx, (int16_t)yy, (uint8_t)id);
+						const f32 xx = AMotionEvent_getX(event, index);
+						const f32 yy = AMotionEvent_getY(event, index);
+						const s32 id = AMotionEvent_getPointerId(event, index);
+						_queue.push_touch_event((s16)xx, (s16)yy, (u8)id);
 					}
 					break;
 				}
@@ -164,8 +164,8 @@ struct AndroidDevice
 		}
 		else if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY)
 		{
-			const int32_t keycode = AKeyEvent_getKeyCode(event);
-			const int32_t keyaction = AKeyEvent_getAction(event);
+			const s32 keycode = AKeyEvent_getKeyCode(event);
+			const s32 keyaction = AKeyEvent_getAction(event);
 
 			if (keycode == AKEYCODE_BACK)
 			{
@@ -179,12 +179,12 @@ struct AndroidDevice
 		return 0;
 	}
 
-	static int32_t on_input_event(struct android_app* app, AInputEvent* event)
+	static s32 on_input_event(struct android_app* app, AInputEvent* event)
 	{
 		return ((AndroidDevice*) app->userData)->process_input(app, event);
 	}
 
-	static void on_app_cmd(struct android_app* app, int32_t cmd)
+	static void on_app_cmd(struct android_app* app, s32 cmd)
 	{
 		((AndroidDevice*) app->userData)->process_command(app, cmd);
 	}
@@ -204,7 +204,7 @@ public:
 	{
 	}
 
-	void open(uint16_t /*x*/, uint16_t /*y*/, uint16_t /*width*/, uint16_t /*height*/, uint32_t /*parent*/)
+	void open(u16 /*x*/, u16 /*y*/, u16 /*width*/, u16 /*height*/, u32 /*parent*/)
 	{
 	}
 
@@ -224,11 +224,11 @@ public:
 	{
 	}
 
-	void resize(uint16_t /*width*/, uint16_t /*height*/)
+	void resize(u16 /*width*/, u16 /*height*/)
 	{
 	}
 
-	void move(uint16_t /*x*/, uint16_t /*y*/)
+	void move(u16 /*x*/, u16 /*y*/)
 	{
 	}
 
@@ -271,7 +271,7 @@ class DisplayAndroid : public Display
 	{
 	}
 
-	void set_mode(uint32_t /*id*/)
+	void set_mode(u32 /*id*/)
 	{
 	}
 };

+ 25 - 25
src/main/main_linux.cpp

@@ -139,7 +139,7 @@ static KeyboardButton::Enum x11_translate_key(KeySym x11_key)
 #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
 #define XINPUT_GAMEPAD_THRESHOLD            30
 
-static uint8_t s_button[] =
+static u8 s_button[] =
 {
 	JoypadButton::A,
 	JoypadButton::B,
@@ -158,7 +158,7 @@ static uint8_t s_button[] =
 	JoypadButton::RIGHT
 };
 
-static uint16_t s_deadzone[] =
+static u16 s_deadzone[] =
 {
 	XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE,
 	XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE,
@@ -170,10 +170,10 @@ static uint16_t s_deadzone[] =
 
 struct JoypadEvent
 {
-	uint32_t time;  /* event timestamp in milliseconds */
-	int16_t value;  /* value */
-	uint8_t type;   /* event type */
-	uint8_t number; /* axis/button number */
+	u32 time;  /* event timestamp in milliseconds */
+	s16 value; /* value */
+	u8 type;   /* event type */
+	u8 number; /* axis/button number */
 };
 
 struct Joypad
@@ -183,7 +183,7 @@ struct Joypad
 		char jspath[] = "/dev/input/jsX";
 		char* num = strchr(jspath, 'X');
 
-		for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+		for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		{
 			*num = '0' + i;
 			_fd[i] = open(jspath, O_RDONLY | O_NONBLOCK);
@@ -195,7 +195,7 @@ struct Joypad
 
 	void shutdown()
 	{
-		for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+		for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		{
 			if (_fd[i] != -1)
 				close(_fd[i]);
@@ -207,7 +207,7 @@ struct Joypad
 		JoypadEvent ev;
 		memset(&ev, 0, sizeof(ev));
 
-		for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+		for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		{
 			const int fd = _fd[i];
 			const bool connected = fd != -1;
@@ -222,8 +222,8 @@ struct Joypad
 
 			while(read(fd, &ev, sizeof(ev)) != -1)
 			{
-				const uint8_t num = ev.number;
-				const int16_t val = ev.value;
+				const u8 num = ev.number;
+				const s16 val = ev.value;
 
 				switch (ev.type &= ~JS_EVENT_INIT)
 				{
@@ -231,19 +231,19 @@ struct Joypad
 					{
 						AxisData& axis = _axis[i];
 						// Indices into axis.left/right respectively
-						const uint8_t axis_idx[] = { 0, 1, 2, 0, 1, 2 };
-						const int16_t deadzone = s_deadzone[num];
+						const u8 axis_idx[] = { 0, 1, 2, 0, 1, 2 };
+						const s16 deadzone = s_deadzone[num];
 
-						int16_t value = val > deadzone || val < -deadzone ? val : 0;
+						s16 value = val > deadzone || val < -deadzone ? val : 0;
 
 						// Remap triggers to [0, INT16_MAX]
 						if (num == 2 || num == 5)
 							value = (value + INT16_MAX) >> 1;
 
-						float* values = num > 2 ? axis.right : axis.left;
+						f32* values = num > 2 ? axis.right : axis.left;
 
 						values[axis_idx[num]] = value != 0
-							? float(value + (value < 0 ? deadzone : -deadzone)) / float(INT16_MAX - deadzone)
+							? f32(value + (value < 0 ? deadzone : -deadzone)) / f32(INT16_MAX - deadzone)
 							: 0.0f
 							;
 
@@ -276,8 +276,8 @@ struct Joypad
 
 	struct AxisData
 	{
-		float left[3];
-		float right[3];
+		f32 left[3];
+		f32 right[3];
 	};
 
 	AxisData _axis[CROWN_MAX_JOYPADS];
@@ -290,7 +290,7 @@ struct MainThreadArgs
 	DeviceOptions* opts;
 };
 
-int32_t func(void* data)
+s32 func(void* data)
 {
 	MainThreadArgs* args = (MainThreadArgs*)data;
 	crown::init(*args->opts);
@@ -309,7 +309,7 @@ struct LinuxDevice
 	{
 	}
 
-	int32_t run(DeviceOptions* opts)
+	int run(DeviceOptions* opts)
 	{
 		// http://tronche.com/gui/x/xlib/display/XInitThreads.html
 		Status xs = XInitThreads();
@@ -493,7 +493,7 @@ public:
 		_x11_display = s_ldvc._x11_display;
 	}
 
-	void open(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t parent)
+	void open(u16 x, u16 y, u16 width, u16 height, u32 parent)
 	{
 		int screen = DefaultScreen(_x11_display);
 		int depth = DefaultDepth(_x11_display, screen);
@@ -573,12 +573,12 @@ public:
 		XUnmapWindow(_x11_display, _x11_window);
 	}
 
-	void resize(uint16_t width, uint16_t height)
+	void resize(u16 width, u16 height)
 	{
 		XResizeWindow(_x11_display, _x11_window, width, height);
 	}
 
-	void move(uint16_t x, uint16_t y)
+	void move(u16 x, u16 y)
 	{
 		XMoveWindow(_x11_display, _x11_window, x, y);
 	}
@@ -649,14 +649,14 @@ public:
 		for (int i = 0; i < num; ++i)
 		{
 			DisplayMode dm;
-			dm.id     = (uint32_t)i;
+			dm.id     = (u32)i;
 			dm.width  = sizes[i].width;
 			dm.height = sizes[i].height;
 			array::push_back(modes, dm);
 		}
 	}
 
-	void set_mode(uint32_t id)
+	void set_mode(u32 id)
 	{
 		int num = 0;
 		XRRScreenSize* sizes = XRRConfigSizes(_screen_config, &num);

+ 33 - 33
src/main/main_windows.cpp

@@ -23,7 +23,7 @@
 
 namespace crown
 {
-static KeyboardButton::Enum win_translate_key(int32_t winkey)
+static KeyboardButton::Enum win_translate_key(s32 winkey)
 {
 	switch (winkey)
 	{
@@ -154,7 +154,7 @@ struct Joypad
 
 	void update(OsEventQueue& queue)
 	{
-		for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
+		for (u8 i = 0; i < CROWN_MAX_JOYPADS; ++i)
 		{
 			XINPUT_STATE state;
 			memset(&state, 0, sizeof(state));
@@ -176,7 +176,7 @@ struct Joypad
 			const WORD curr = state.Gamepad.wButtons;
 			if (diff != 0)
 			{
-				for (uint8_t bb = 0; bb < CE_COUNTOF(s_xinput_to_joypad); ++bb)
+				for (u8 bb = 0; bb < CE_COUNTOF(s_xinput_to_joypad); ++bb)
 				{
 					WORD bit = s_xinput_to_joypad[bb].bit;
 					if (bit & diff)
@@ -194,7 +194,7 @@ struct Joypad
 					? value : 0;
 
 				_axis[0].lx = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE : -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)) / float(INT16_MAX - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE : -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)) / f32(INT16_MAX - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::LEFT, _axis[0].lx, _axis[0].ly, _axis[0].lz);
@@ -208,7 +208,7 @@ struct Joypad
 					? value : 0;
 
 				_axis[0].ly = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE : -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)) / float(INT16_MAX - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE : -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)) / f32(INT16_MAX - XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::LEFT, _axis[0].lx, _axis[0].ly, _axis[0].lz);
@@ -221,7 +221,7 @@ struct Joypad
 				value = value > XINPUT_GAMEPAD_TRIGGER_THRESHOLD ? value : 0;
 
 				_axis[0].lz = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_TRIGGER_THRESHOLD : -XINPUT_GAMEPAD_TRIGGER_THRESHOLD)) / float(UINT8_MAX - XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_TRIGGER_THRESHOLD : -XINPUT_GAMEPAD_TRIGGER_THRESHOLD)) / f32(UINT8_MAX - XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::LEFT, _axis[0].lx, _axis[0].ly, _axis[0].lz);
@@ -235,7 +235,7 @@ struct Joypad
 					? value : 0;
 
 				_axis[0].rx = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE : -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)) / float(INT16_MAX - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE : -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)) / f32(INT16_MAX - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::RIGHT, _axis[0].rx, _axis[0].ry, _axis[0].rz);
@@ -249,7 +249,7 @@ struct Joypad
 					? value : 0;
 
 				_axis[0].ry = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE : -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)) / float(INT16_MAX - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE : -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)) / f32(INT16_MAX - XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::RIGHT, _axis[0].rx, _axis[0].ry, _axis[0].rz);
@@ -262,7 +262,7 @@ struct Joypad
 				value = value > XINPUT_GAMEPAD_TRIGGER_THRESHOLD ? value : 0;
 
 				_axis[0].rz = value != 0
-					? float(value + (value < 0 ? XINPUT_GAMEPAD_TRIGGER_THRESHOLD : -XINPUT_GAMEPAD_TRIGGER_THRESHOLD)) / float(UINT8_MAX - XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
+					? f32(value + (value < 0 ? XINPUT_GAMEPAD_TRIGGER_THRESHOLD : -XINPUT_GAMEPAD_TRIGGER_THRESHOLD)) / f32(UINT8_MAX - XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
 					: 0.0f
 					;
 				queue.push_joypad_event(i, JoypadAxis::RIGHT, _axis[0].rx, _axis[0].ry, _axis[0].rz);
@@ -274,8 +274,8 @@ struct Joypad
 
 	struct Axis
 	{
-		float lx, ly, lz;
-		float rx, ry, rz;
+		f32 lx, ly, lz;
+		f32 rx, ry, rz;
 	};
 
 	XINPUT_STATE _state[CROWN_MAX_JOYPADS];
@@ -290,7 +290,7 @@ struct MainThreadArgs
 	DeviceOptions* opts;
 };
 
-int32_t func(void* data)
+s32 func(void* data)
 {
 	MainThreadArgs* args = (MainThreadArgs*)data;
 	crown::init(*args->opts);
@@ -377,8 +377,8 @@ struct WindowsDevice
 			}
 			case WM_SIZE:
 			{
-				uint32_t width = GET_X_LPARAM(lparam);
-				uint32_t height = GET_Y_LPARAM(lparam);
+				u32 width = GET_X_LPARAM(lparam);
+				u32 height = GET_Y_LPARAM(lparam);
 				_queue.push_metrics_event(0, 0, width, height);
 				break;
 			}
@@ -400,40 +400,40 @@ struct WindowsDevice
 			}
 			case WM_MOUSEWHEEL:
 			{
-				int32_t mx = GET_X_LPARAM(lparam);
-				int32_t my = GET_Y_LPARAM(lparam);
+				s32 mx = GET_X_LPARAM(lparam);
+				s32 my = GET_Y_LPARAM(lparam);
 				short delta = GET_WHEEL_DELTA_WPARAM(wparam);
-				_queue.push_mouse_event(mx, my, (float)(delta/WHEEL_DELTA));
+				_queue.push_mouse_event(mx, my, (f32)(delta/WHEEL_DELTA));
 				break;
 			}
 			case WM_MOUSEMOVE:
 			{
-				int32_t mx = GET_X_LPARAM(lparam);
-				int32_t my = GET_Y_LPARAM(lparam);
+				s32 mx = GET_X_LPARAM(lparam);
+				s32 my = GET_Y_LPARAM(lparam);
 				_queue.push_mouse_event(mx, my);
 				break;
 			}
 			case WM_LBUTTONDOWN:
 			case WM_LBUTTONUP:
 			{
-				int32_t mx = GET_X_LPARAM(lparam);
-				int32_t my = GET_Y_LPARAM(lparam);
+				s32 mx = GET_X_LPARAM(lparam);
+				s32 my = GET_Y_LPARAM(lparam);
 				_queue.push_mouse_event(mx, my, MouseButton::LEFT, id == WM_LBUTTONDOWN);
 				break;
 			}
 			case WM_RBUTTONUP:
 			case WM_RBUTTONDOWN:
 			{
-				int32_t mx = GET_X_LPARAM(lparam);
-				int32_t my = GET_Y_LPARAM(lparam);
+				s32 mx = GET_X_LPARAM(lparam);
+				s32 my = GET_Y_LPARAM(lparam);
 				_queue.push_mouse_event(mx, my, MouseButton::RIGHT, id == WM_RBUTTONDOWN);
 				break;
 			}
 			case WM_MBUTTONDOWN:
 			case WM_MBUTTONUP:
 			{
-				int32_t mx = GET_X_LPARAM(lparam);
-				int32_t my = GET_Y_LPARAM(lparam);
+				s32 mx = GET_X_LPARAM(lparam);
+				s32 my = GET_Y_LPARAM(lparam);
 				_queue.push_mouse_event(mx, my, MouseButton::MIDDLE, id == WM_MBUTTONDOWN);
 				break;
 			}
@@ -475,10 +475,10 @@ LRESULT CALLBACK WindowsDevice::window_proc(HWND hwnd, UINT id, WPARAM wparam, L
 class WindowWin : public Window
 {
 	HWND _hwnd;
-	uint16_t _x;
-	uint16_t _y;
-	uint16_t _width;
-	uint16_t _height;
+	u16 _x;
+	u16 _y;
+	u16 _width;
+	u16 _height;
 
 public:
 
@@ -492,7 +492,7 @@ public:
 		_hwnd = s_wdvc._hwnd;
 	}
 
-	void open(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t /*parent*/)
+	void open(u16 x, u16 y, u16 width, u16 height, u32 /*parent*/)
 	{
 		_x = x;
 		_y = y;
@@ -520,14 +520,14 @@ public:
 		ShowWindow(_hwnd, SW_HIDE);
 	}
 
-	void resize(uint16_t width, uint16_t height)
+	void resize(u16 width, u16 height)
 	{
 		_width = width;
 		_height = height;
 		MoveWindow(_hwnd, _x, _y, width, height, FALSE);
 	}
 
-	void move(uint16_t x, uint16_t y)
+	void move(u16 x, u16 y)
 	{
 		_x = x;
 		_y = y;
@@ -579,7 +579,7 @@ class DisplayWin : public Display
 	{
 	}
 
-	void set_mode(uint32_t /*id*/)
+	void set_mode(u32 /*id*/)
 	{
 	}
 };

+ 3 - 3
src/main/window.h

@@ -18,7 +18,7 @@ class Window
 public:
 
 	/// Opens the window.
-	virtual void open(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t parent) = 0;
+	virtual void open(u16 x, u16 y, u16 width, u16 height, u32 parent) = 0;
 
 	/// Closes the window.
 	virtual void close() = 0;
@@ -30,10 +30,10 @@ public:
 	virtual void hide() = 0;
 
 	/// Resizes the window to @a width and @a height.
-	virtual void resize(uint16_t width, uint16_t height) = 0;
+	virtual void resize(u16 width, u16 height) = 0;
 
 	/// Moves the window to @a x and @a y.
-	virtual void move(uint16_t x, uint16_t y) = 0;
+	virtual void move(u16 x, u16 y) = 0;
 
 	/// Minimizes the window.
 	virtual void minimize() = 0;

+ 7 - 7
src/resource/bundle_compiler.cpp

@@ -112,8 +112,8 @@ bool BundleCompiler::compile(const char* type, const char* name, const char* pla
 		CompileOptions opts(_source_fs, output, platform, &buf);
 		compile(_type, src_path.c_str(), opts);
 		File* outf = _bundle_fs.open(path.c_str(), FileOpenMode::WRITE);
-		uint32_t size = array::size(output);
-		uint32_t written = outf->write(array::begin(output), size);
+		u32 size = array::size(output);
+		u32 written = outf->write(array::begin(output), size);
 		_bundle_fs.close(*outf);
 		success = size == written;
 	}
@@ -127,7 +127,7 @@ bool BundleCompiler::compile(const char* type, const char* name, const char* pla
 
 bool BundleCompiler::compile_all(const char* platform)
 {
-	for (uint32_t i = 0; i < vector::size(_files); ++i)
+	for (u32 i = 0; i < vector::size(_files); ++i)
 	{
 		if (_files[i].ends_with(".tga")
 			|| _files[i].ends_with(".dds")
@@ -142,7 +142,7 @@ bool BundleCompiler::compile_all(const char* platform)
 		const char* type = path::extension(filename);
 
 		char name[256];
-		const uint32_t size = uint32_t(type - filename - 1);
+		const u32 size = u32(type - filename - 1);
 		strncpy(name, filename, size);
 		name[size] = '\0';
 
@@ -153,7 +153,7 @@ bool BundleCompiler::compile_all(const char* platform)
 	return true;
 }
 
-void BundleCompiler::register_resource_compiler(StringId64 type, uint32_t version, CompileFunction compiler)
+void BundleCompiler::register_resource_compiler(StringId64 type, u32 version, CompileFunction compiler)
 {
 	CE_ASSERT(!sort_map::has(_compilers, type), "Type already registered");
 	CE_ASSERT_NOT_NULL(compiler);
@@ -173,7 +173,7 @@ void BundleCompiler::compile(StringId64 type, const char* path, CompileOptions&
 	sort_map::get(_compilers, type, ResourceTypeData()).compiler(path, opts);
 }
 
-uint32_t BundleCompiler::version(StringId64 type)
+u32 BundleCompiler::version(StringId64 type)
 {
 	CE_ASSERT(sort_map::has(_compilers, type), "Compiler not found");
 
@@ -185,7 +185,7 @@ void BundleCompiler::scan_source_dir(const char* cur_dir)
 	Vector<DynamicString> my_files(default_allocator());
 	_source_fs.list_files(cur_dir, my_files);
 
-	for (uint32_t i = 0; i < vector::size(my_files); ++i)
+	for (u32 i = 0; i < vector::size(my_files); ++i)
 	{
 		TempAllocator512 ta;
 		DynamicString file_i(ta);

+ 3 - 3
src/resource/bundle_compiler.h

@@ -30,11 +30,11 @@ private:
 
 	typedef void (*CompileFunction)(const char* path, CompileOptions& opts);
 
-	void register_resource_compiler(StringId64 type, uint32_t version, CompileFunction compiler);
+	void register_resource_compiler(StringId64 type, u32 version, CompileFunction compiler);
 	void compile(StringId64 type, const char* path, CompileOptions& opts);
 
 	// Returns the version of the compiler for @a type.
-	uint32_t version(StringId64 type);
+	u32 version(StringId64 type);
 
 private:
 
@@ -43,7 +43,7 @@ private:
 
 	struct ResourceTypeData
 	{
-		uint32_t version;
+		u32 version;
 		CompileFunction compiler;
 	};
 

+ 2 - 2
src/resource/compile_options.h

@@ -62,7 +62,7 @@ struct CompileOptions
 		add_dependency(path);
 
 		File* file = _fs.open(path, FileOpenMode::READ);
-		uint32_t size = file->size();
+		u32 size = file->size();
 		Buffer buf(default_allocator());
 		array::resize(buf, size);
 		file->read(array::begin(buf), size);
@@ -80,7 +80,7 @@ struct CompileOptions
 		_fs.delete_file(path);
 	}
 
-	void write(const void* data, uint32_t size)
+	void write(const void* data, u32 size)
 	{
 		array::push(_output, (const char*)data, size);
 	}

+ 1 - 1
src/resource/config_resource.cpp

@@ -18,7 +18,7 @@ namespace config_resource
 
 	void* load(File& file, Allocator& a)
 	{
-		const uint32_t size = file.size();
+		const u32 size = file.size();
 		char* res = (char*)a.allocate(size + 1);
 		file.read(res, size + 1);
 		res[size] = '\0';

+ 10 - 10
src/resource/font_resource.cpp

@@ -42,14 +42,14 @@ namespace font_resource
 		sjson::parse(buf, object);
 		sjson::parse_array(object["glyphs"], glyphs);
 
-		const uint32_t count      = sjson::parse_int(object["count"]);
-		const uint32_t size       = sjson::parse_int(object["size"]);
-		const uint32_t font_size  = sjson::parse_int(object["font_size"]);
-		const uint32_t num_glyphs = array::size(glyphs);
+		const u32 count      = sjson::parse_int(object["count"]);
+		const u32 size       = sjson::parse_int(object["size"]);
+		const u32 font_size  = sjson::parse_int(object["font_size"]);
+		const u32 num_glyphs = array::size(glyphs);
 
 		Array<FontGlyphData> m_glyphs(default_allocator());
 
-		for (uint32_t i = 0; i < num_glyphs; ++i)
+		for (u32 i = 0; i < num_glyphs; ++i)
 		{
 			FontGlyphData data;
 			parse_glyph(glyphs[i], data);
@@ -68,7 +68,7 @@ namespace font_resource
 		opts.write(fr.texture_size);
 		opts.write(fr.font_size);
 
-		for (uint32_t i = 0; i < array::size(m_glyphs); ++i)
+		for (u32 i = 0; i < array::size(m_glyphs); ++i)
 		{
 			opts.write(m_glyphs[i].id);
 			opts.write(m_glyphs[i].x);
@@ -83,10 +83,10 @@ namespace font_resource
 
 	void* load(File& file, Allocator& a)
 	{
-		const uint32_t file_size = file.size();
+		const u32 file_size = file.size();
 		void* res = a.allocate(file_size);
 		file.read(res, file_size);
-		CE_ASSERT(*(uint32_t*)res == FONT_VERSION, "Wrong version");
+		CE_ASSERT(*(u32*)res == FONT_VERSION, "Wrong version");
 		return res;
 	}
 
@@ -95,13 +95,13 @@ namespace font_resource
 		allocator.deallocate(resource);
 	}
 
-	const FontGlyphData* get_glyph(const FontResource* fr, uint32_t i)
+	const FontGlyphData* get_glyph(const FontResource* fr, u32 i)
 	{
 		CE_ASSERT(i < fr->num_glyphs, "Index out of bounds");
 
 		FontGlyphData* begin = (FontGlyphData*)((char*)fr + sizeof(FontResource));
 
-		for (uint32_t i = 0; i < fr->num_glyphs; ++i)
+		for (u32 i = 0; i < fr->num_glyphs; ++i)
 		{
 			if (begin[i].id == i)
 				return &begin[i];

+ 13 - 13
src/resource/font_resource.h

@@ -16,22 +16,22 @@ namespace crown
 {
 struct FontResource
 {
-	uint32_t version;
-	uint32_t num_glyphs;
-	uint32_t texture_size; // Font texture size -- pow of 2
-	uint32_t font_size;
+	u32 version;
+	u32 num_glyphs;
+	u32 texture_size; // Font texture size -- pow of 2
+	u32 font_size;
 };
 
 struct FontGlyphData
 {
-	uint32_t id;
-	float x;
-	float y;
-	float width;
-	float height;
-	float x_offset;
-	float y_offset;
-	float x_advance;
+	u32 id;
+	f32 x;
+	f32 y;
+	f32 width;
+	f32 height;
+	f32 x_offset;
+	f32 y_offset;
+	f32 x_advance;
 };
 
 namespace font_resource
@@ -40,6 +40,6 @@ namespace font_resource
 	void* load(File& file, Allocator& a);
 	void unload(Allocator& allocator, void* resource);
 
-	const FontGlyphData* get_glyph(const FontResource* fr, uint32_t i);
+	const FontGlyphData* get_glyph(const FontResource* fr, u32 i);
 } // namespace font_resource
 } // namespace crown

+ 6 - 6
src/resource/level_resource.cpp

@@ -28,7 +28,7 @@ namespace level_resource
 			JsonArray sounds_json(ta);
 			sjson::parse_array(object["sounds"], sounds_json);
 
-			for (uint32_t i = 0, n = array::size(sounds_json); i < n; ++i)
+			for (u32 i = 0, n = array::size(sounds_json); i < n; ++i)
 			{
 				JsonObject sound(ta);
 				sjson::parse_object(sounds_json[i], sound);
@@ -65,7 +65,7 @@ namespace level_resource
 
 		opts.write(unit_buffer);
 
-		for (uint32_t i = 0; i < array::size(sounds); ++i)
+		for (u32 i = 0; i < array::size(sounds); ++i)
 		{
 			opts.write(sounds[i].name);
 			opts.write(sounds[i].position);
@@ -80,10 +80,10 @@ namespace level_resource
 
 	void* load(File& file, Allocator& a)
 	{
-		const uint32_t file_size = file.size();
+		const u32 file_size = file.size();
 		void* res = a.allocate(file_size);
 		file.read(res, file_size);
-		CE_ASSERT(*(uint32_t*)res == LEVEL_VERSION, "Wrong version");
+		CE_ASSERT(*(u32*)res == LEVEL_VERSION, "Wrong version");
 		return res;
 	}
 
@@ -97,12 +97,12 @@ namespace level_resource
 		return (const UnitResource*)((char*)lr + lr->units_offset);
 	}
 
-	uint32_t num_sounds(const LevelResource* lr)
+	u32 num_sounds(const LevelResource* lr)
 	{
 		return lr->num_sounds;
 	}
 
-	const LevelSound* get_sound(const LevelResource* lr, uint32_t i)
+	const LevelSound* get_sound(const LevelResource* lr, u32 i)
 	{
 		CE_ASSERT(i < num_sounds(lr), "Index out of bounds");
 		const LevelSound* begin = (LevelSound*)((char*)lr + lr->sounds_offset);

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio