Daniele Bartolini 9 роки тому
батько
коміт
f1820427e4

+ 1 - 1
docs/lua_api.rst

@@ -977,7 +977,7 @@ Keyboard Button Names
 	* ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
 	* ``num_lock``, ``numpad_enter``, ``numpad_.``, ``numpad_*``, ``numpad_+``, ``numpad_-``, ``numpad_/``, ``numpad_0``, ``numpad_1``, ``numpad_2``, ``numpad_3``, ``numpad_4``, ``numpad_5``, ``numpad_6``, ``numpad_7``, ``numpad_8``, ``numpad_9``
 	* ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
-	* ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``insert``, ``delete``, ``end``
+	* ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``ins``, ``del``, ``end``
 	* ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
 	* ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
 	* ``a``, ``b``, ``c``, ``d``, ``e``, ``f``, ``g``, ``h``, ``i``, ``j``, ``k``, ``l``, ``m``, ``n``, ``o``, ``p``, ``q``, ``r``, ``s``, ``t``, ``u``, ``v``, ``w``, ``x``, ``y``, ``z``

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

@@ -240,20 +240,20 @@ bool plane_3_intersection(const Plane3& a, const Plane3& b, const Plane3& c, Vec
 
 bool frustum_sphere_intersection(const Frustum& f, const Sphere& s)
 {
-	if (plane3::distance_to_point(f.left, s.c) < -s.r ||
-		plane3::distance_to_point(f.right, s.c) < -s.r)
+	if (plane3::distance_to_point(f.plane_left, s.c) < -s.r ||
+		plane3::distance_to_point(f.plane_right, s.c) < -s.r)
 	{
 		return false;
 	}
 
-	if (plane3::distance_to_point(f.bottom, s.c) < -s.r ||
-		plane3::distance_to_point(f.top, s.c) < -s.r)
+	if (plane3::distance_to_point(f.plane_bottom, s.c) < -s.r ||
+		plane3::distance_to_point(f.plane_top, s.c) < -s.r)
 	{
 		return false;
 	}
 
-	if (plane3::distance_to_point(f.near, s.c) < -s.r ||
-		plane3::distance_to_point(f.far, s.c) < -s.r)
+	if (plane3::distance_to_point(f.plane_near, s.c) < -s.r ||
+		plane3::distance_to_point(f.plane_far, s.c) < -s.r)
 	{
 		return false;
 	}
@@ -273,69 +273,69 @@ bool frustum_box_intersection(const Frustum& f, const AABB& b)
 	const Vector3 v7 = aabb::vertex(b, 7);
 
 	u8 out = 0;
-	out += (plane3::distance_to_point(f.left, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.left, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_left, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	out = 0;
-	out += (plane3::distance_to_point(f.right, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.right, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_right, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	out = 0;
-	out += (plane3::distance_to_point(f.bottom, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.bottom, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_bottom, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	out = 0;
-	out += (plane3::distance_to_point(f.top, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.top, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_top, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	out = 0;
-	out += (plane3::distance_to_point(f.near, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.near, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_near, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	out = 0;
-	out += (plane3::distance_to_point(f.far, v0) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v1) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v2) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v3) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v4) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v5) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v6) < 0.0f) ? 1 : 0;
-	out += (plane3::distance_to_point(f.far, v7) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v0) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v1) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v2) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v3) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v4) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v5) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v6) < 0.0f) ? 1 : 0;
+	out += (plane3::distance_to_point(f.plane_far, v7) < 0.0f) ? 1 : 0;
 	if (out == 8) return false;
 
 	// If we are here, it is because either the box intersects or it is contained in the frustum

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

@@ -70,12 +70,12 @@ struct Plane3
 
 struct Frustum
 {
-	Plane3 left;
-	Plane3 right;
-	Plane3 bottom;
-	Plane3 top;
-	Plane3 near;
-	Plane3 far;
+	Plane3 plane_left;
+	Plane3 plane_right;
+	Plane3 plane_bottom;
+	Plane3 plane_top;
+	Plane3 plane_near;
+	Plane3 plane_far;
 };
 
 struct Sphere

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

@@ -292,12 +292,12 @@ inline Matrix4x4 operator*(Matrix4x4 a, const Matrix4x4& b)
 }
 
 /// Sets the matrix @a m to perspective.
-inline void perspective(Matrix4x4& m, f32 fovy, f32 aspect, f32 near, f32 far)
+inline void perspective(Matrix4x4& m, f32 fovy, f32 aspect, f32 nnear, f32 ffar)
 {
 	const f32 height = 1.0f / tanf(fovy * 0.5f);
 	const f32 width = height * 1.0f / aspect;
-	const f32 aa = far / (far - near);
-	const f32 bb = -near * aa;
+	const f32 aa = ffar / (ffar - nnear);
+	const f32 bb = -nnear * aa;
 
 	m.x.x = width;
 	m.x.y = 0.0f;
@@ -321,7 +321,7 @@ inline void perspective(Matrix4x4& m, f32 fovy, f32 aspect, f32 near, f32 far)
 }
 
 /// Sets the matrix @a m to orthographic.
-inline void orthographic(Matrix4x4& m, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far)
+inline void orthographic(Matrix4x4& m, f32 left, f32 right, f32 bottom, f32 top, f32 nnear, f32 ffar)
 {
 	m.x.x = 2.0f / (right - left);
 	m.x.y = 0.0f;
@@ -335,12 +335,12 @@ inline void orthographic(Matrix4x4& m, f32 left, f32 right, f32 bottom, f32 top,
 
 	m.z.x = 0.0f;
 	m.z.y = 0.0f;
-	m.z.z = 1.0f / (far - near);
+	m.z.z = 1.0f / (ffar - nnear);
 	m.z.w = 0.0f;
 
 	m.t.x = (left + right) / (left - right);
 	m.t.y = (top + bottom) / (bottom - top);
-	m.t.z = near / (near - far);
+	m.t.z = nnear / (nnear - ffar);
 	m.t.w = 1.0f;
 }
 

+ 10 - 11
src/core/network/socket.h

@@ -18,7 +18,6 @@
 	#include <unistd.h>     // close
 #elif CROWN_PLATFORM_WINDOWS
 	#include <winsock2.h>
-	#include "win_headers.h"
 	#pragma comment(lib, "Ws2_32.lib")
 #endif
 
@@ -28,7 +27,7 @@ struct ConnectResult
 {
 	enum
 	{
-		NO_ERROR,
+		SUCCESS,
 		BAD_SOCKET,
 		REFUSED,
 		TIMEOUT,
@@ -40,7 +39,7 @@ struct BindResult
 {
 	enum
 	{
-		NO_ERROR,
+		SUCCESS,
 		BAD_SOCKET,
 		ADDRESS_IN_USE,
 		UNKNOWN
@@ -51,7 +50,7 @@ struct AcceptResult
 {
 	enum
 	{
-		NO_ERROR,
+		SUCCESS,
 		BAD_SOCKET,
 		NO_CONNECTION,
 		UNKNOWN
@@ -62,7 +61,7 @@ struct ReadResult
 {
 	enum
 	{
-		NO_ERROR,
+		SUCCESS,
 		BAD_SOCKET,
 		REMOTE_CLOSED,
 		TIMEOUT,
@@ -75,7 +74,7 @@ struct WriteResult
 {
 	enum
 	{
-		NO_ERROR,
+		SUCCESS,
 		BAD_SOCKET,
 		REMOTE_CLOSED,
 		TIMEOUT,
@@ -145,7 +144,7 @@ struct TCPSocket
 		int err = ::connect(_socket, (const sockaddr*)&addr_in, sizeof(sockaddr_in));
 
 		ConnectResult cr;
-		cr.error = ConnectResult::NO_ERROR;
+		cr.error = ConnectResult::SUCCESS;
 
 		if (err == 0)
 			return cr;
@@ -183,7 +182,7 @@ struct TCPSocket
 		int err = ::bind(_socket, (const sockaddr*)&address, sizeof(sockaddr_in));
 
 		BindResult br;
-		br.error = BindResult::NO_ERROR;
+		br.error = BindResult::SUCCESS;
 
 		if (err == 0)
 			return br;
@@ -221,7 +220,7 @@ struct TCPSocket
 		int err = ::accept(_socket, NULL, NULL);
 
 		AcceptResult ar;
-		ar.error = AcceptResult::NO_ERROR;
+		ar.error = AcceptResult::SUCCESS;
 
 #if CROWN_PLATFORM_POSIX
 		if (err >= 0)
@@ -265,7 +264,7 @@ struct TCPSocket
 	ReadResult read_internal(void* data, u32 size)
 	{
 		ReadResult rr;
-		rr.error = ReadResult::NO_ERROR;
+		rr.error = ReadResult::SUCCESS;
 		rr.bytes_read = 0;
 
 		char* buf = (char*)data;
@@ -331,7 +330,7 @@ struct TCPSocket
 	WriteResult write_internal(const void* data, u32 size)
 	{
 		WriteResult wr;
-		wr.error = WriteResult::NO_ERROR;
+		wr.error = WriteResult::SUCCESS;
 		wr.bytes_wrote = 0;
 
 		const char* buf = (const char*)data;

+ 1 - 1
src/core/os.h

@@ -23,7 +23,7 @@
 #elif CROWN_PLATFORM_WINDOWS
 	#include <io.h>
 	#include <stdio.h>
-	#include <win_headers.h>
+	#include <windows.h>
 #endif
 #if CROWN_PLATFORM_ANDROID
 	#include <android/log.h>

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

@@ -9,7 +9,7 @@
 
 #if CROWN_PLATFORM_WINDOWS
 	#include "types.h"
-	#include "win_headers.h"
+	#include <windows.h>
 #endif
 
 namespace crown

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

@@ -12,7 +12,7 @@
 #if CROWN_PLATFORM_POSIX
 	#include <pthread.h>
 #elif CROWN_PLATFORM_WINDOWS
-	#include "win_headers.h"
+	#include <windows.h>
 #endif
 
 namespace crown

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

@@ -12,7 +12,7 @@
 #if CROWN_PLATFORM_POSIX
 	#include <pthread.h>
 #elif CROWN_PLATFORM_WINDOWS
-	#include "win_headers.h"
+	#include <windows.h>
 	#include <limits.h>
 #endif
 

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

@@ -13,7 +13,7 @@
 #if CROWN_PLATFORM_POSIX
 	#include <pthread.h>
 #elif CROWN_PLATFORM_WINDOWS
-	#include "win_headers.h"
+	#include <windows.h>
 	#include <process.h>
 #endif
 

+ 6 - 6
src/device/console_server.cpp

@@ -32,7 +32,7 @@ void ConsoleServer::listen(u16 port, bool wait)
 		{
 			ar = _server.accept(client);
 		}
-		while (ar.error != AcceptResult::NO_ERROR);
+		while (ar.error != AcceptResult::SUCCESS);
 
 		add_client(client);
 	}
@@ -79,7 +79,7 @@ void ConsoleServer::update()
 {
 	TCPSocket client;
 	AcceptResult result = _server.accept_nonblock(client);
-	if (result.error == AcceptResult::NO_ERROR)
+	if (result.error == AcceptResult::SUCCESS)
 		add_client(client);
 
 	TempAllocator256 alloc;
@@ -89,7 +89,7 @@ void ConsoleServer::update()
 	for (u32 i = 0; i < vector::size(_clients); ++i)
 	{
 		ReadResult rr = update_client(_clients[i]);
-		if (rr.error != ReadResult::NO_ERROR)
+		if (rr.error != ReadResult::SUCCESS)
 			array::push_back(to_remove, i);
 	}
 
@@ -116,9 +116,9 @@ ReadResult ConsoleServer::update_client(TCPSocket client)
 	ReadResult rr = client.read_nonblock(&msg_len, 4);
 
 	// If no data received, return
-	if (rr.error == ReadResult::NO_ERROR && rr.bytes_read == 0) return rr;
+	if (rr.error == ReadResult::SUCCESS && rr.bytes_read == 0) return rr;
 	if (rr.error == ReadResult::REMOTE_CLOSED) return rr;
-	if (rr.error != ReadResult::NO_ERROR) return rr;
+	if (rr.error != ReadResult::SUCCESS) return rr;
 
 	// Else read the message
 	TempAllocator4096 ta;
@@ -128,7 +128,7 @@ ReadResult ConsoleServer::update_client(TCPSocket client)
 	array::push_back(msg_buf, '\0');
 
 	if (msg_result.error == ReadResult::REMOTE_CLOSED) return msg_result;
-	if (msg_result.error != ReadResult::NO_ERROR) return msg_result;
+	if (msg_result.error != ReadResult::SUCCESS) return msg_result;
 
 	process(client, array::begin(msg_buf));
 	return msg_result;

+ 2 - 2
src/device/device.cpp

@@ -217,8 +217,8 @@ bool Device::process_events(s16& mouse_x, s16& mouse_y, s16& mouse_last_x, s16&
 					im->mouse()->set_axis(ev.axis_num, vector3(ev.axis_x, ev.axis_y, ev.axis_z));
 					if (ev.axis_num == MouseAxis::CURSOR)
 					{
-						mouse_x = ev.axis_x;
-						mouse_y = ev.axis_y;
+						mouse_x = (s16)ev.axis_x;
+						mouse_y = (s16)ev.axis_y;
 					}
 					break;
 

+ 2 - 2
src/device/input_manager.cpp

@@ -52,8 +52,8 @@ static const char* s_keyboard_button_names[] =
 	"down",         // KeyboardButton::DOWN
 	"page_up",      // KeyboardButton::PAGE_UP
 	"page_down",    // KeyboardButton::PAGE_DOWN
-	"insert",       // KeyboardButton::INSERT
-	"delete",       // KeyboardButton::DELETE
+	"ins",          // KeyboardButton::INS
+	"del",          // KeyboardButton::DEL
 	"end",          // KeyboardButton::END
 	"left_ctrl",    // KeyboardButton::LEFT_CTRL
 	"right_ctrl",   // KeyboardButton::RIGHT_CTRL

+ 2 - 2
src/device/input_types.h

@@ -80,8 +80,8 @@ struct KeyboardButton
 		DOWN,
 		PAGE_UP,
 		PAGE_DOWN,
-		INSERT,
-		DELETE,
+		INS,
+		DEL,
 		END,
 
 		/* Modifier keys */

+ 12 - 12
src/device/log.h

@@ -16,10 +16,10 @@ struct LogSeverity
 {
 	enum Enum
 	{
-		INFO,
-		WARN,
-		ERROR,
-		DEBUG,
+		LOG_INFO,
+		LOG_WARN,
+		LOG_ERROR,
+		LOG_DEBUG,
 
 		COUNT
 	};
@@ -32,11 +32,11 @@ namespace log_internal
 } // namespace log_internal
 } // namespace crown
 
-#define logiv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::INFO, msg, va_list)
-#define logdv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::DEBUG, msg, va_list)
-#define logev(msg, va_list) crown::log_internal::logx(crown::LogSeverity::ERROR, msg, va_list)
-#define logwv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::WARN, msg, va_list)
-#define logi(msg, ...) crown::log_internal::logx(crown::LogSeverity::INFO, msg, ##__VA_ARGS__)
-#define logd(msg, ...) crown::log_internal::logx(crown::LogSeverity::DEBUG, msg, ##__VA_ARGS__)
-#define loge(msg, ...) crown::log_internal::logx(crown::LogSeverity::ERROR, msg, ##__VA_ARGS__)
-#define logw(msg, ...) crown::log_internal::logx(crown::LogSeverity::WARN, msg, ##__VA_ARGS__)
+#define logiv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::LOG_INFO, msg, va_list)
+#define logdv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::LOG_DEBUG, msg, va_list)
+#define logev(msg, va_list) crown::log_internal::logx(crown::LogSeverity::LOG_ERROR, msg, va_list)
+#define logwv(msg, va_list) crown::log_internal::logx(crown::LogSeverity::LOG_WARN, msg, va_list)
+#define logi(msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_INFO, msg, ##__VA_ARGS__)
+#define logd(msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_DEBUG, msg, ##__VA_ARGS__)
+#define loge(msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_ERROR, msg, ##__VA_ARGS__)
+#define logw(msg, ...) crown::log_internal::logx(crown::LogSeverity::LOG_WARN, msg, ##__VA_ARGS__)

+ 3 - 3
src/device/main_linux.cpp

@@ -14,7 +14,7 @@
 #include "display.h"
 #include "os.h"
 #include "thread.h"
-#include "unit_tests.cpp"
+#include "unit_tests.h"
 #include "window.h"
 #include <bgfx/bgfxplatform.h>
 #include <stdlib.h>
@@ -55,8 +55,8 @@ static KeyboardButton::Enum x11_translate_key(KeySym x11_key)
 	case XK_Down:         return KeyboardButton::DOWN;
 	case XK_Page_Up:      return KeyboardButton::PAGE_UP;
 	case XK_Page_Down:    return KeyboardButton::PAGE_DOWN;
-	case XK_Insert:       return KeyboardButton::INSERT;
-	case XK_Delete:       return KeyboardButton::DELETE;
+	case XK_Insert:       return KeyboardButton::INS;
+	case XK_Delete:       return KeyboardButton::DEL;
 	case XK_End:          return KeyboardButton::END;
 	case XK_Shift_L:      return KeyboardButton::LEFT_SHIFT;
 	case XK_Shift_R:      return KeyboardButton::RIGHT_SHIFT;

+ 6 - 6
src/device/main_windows.cpp

@@ -11,11 +11,11 @@
 #include "device.h"
 #include "device_event_queue.h"
 #include "thread.h"
-#include "unit_tests.cpp"
+#include "unit_tests.h"
 #include <bgfx/bgfxplatform.h>
 #include <winsock2.h>
 #ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
+	#define WIN32_LEAN_AND_MEAN
 #endif
 #include <windowsx.h>
 #include <xinput.h>
@@ -50,8 +50,8 @@ static KeyboardButton::Enum win_translate_key(s32 winkey)
 	case VK_DOWN:     return KeyboardButton::DOWN;
 	case VK_PRIOR:    return KeyboardButton::PAGE_UP;
 	case VK_NEXT:     return KeyboardButton::PAGE_DOWN;
-	case VK_INSERT:   return KeyboardButton::INSERT;
-	case VK_DELETE:   return KeyboardButton::DELETE;
+	case VK_INSERT:   return KeyboardButton::INS;
+	case VK_DELETE:   return KeyboardButton::DEL;
 	case VK_END:      return KeyboardButton::END;
 	case VK_LSHIFT:   return KeyboardButton::LEFT_SHIFT;
 	case VK_RSHIFT:   return KeyboardButton::RIGHT_SHIFT;
@@ -459,8 +459,8 @@ struct WindowsDevice
 				_queue.push_axis_event(InputDeviceType::MOUSE
 					, 0
 					, MouseAxis::CURSOR
-					, mx
-					, my
+					, (f32)mx
+					, (f32)my
 					, 0.0f
 					);
 			}

+ 0 - 23
src/device/win_headers.h

@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#ifndef WIN32_LEAN_AND_MEAN
-	#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#undef NEAR
-#undef FAR
-#undef near
-#undef far
-#undef NO_ERROR
-#undef ERROR
-#undef min
-#undef max
-#undef rad1
-#undef DELETE