Просмотр исходного кода

Initial work to separate os windows from gl contexts

Daniele Bartolini 12 лет назад
Родитель
Сommit
ba2d7d8ce9

+ 1 - 0
CMakeLists.txt

@@ -28,6 +28,7 @@ set (INCLUDES
 	${CMAKE_SOURCE_DIR}/src/os
 	${CMAKE_SOURCE_DIR}/src/input
 	${CMAKE_SOURCE_DIR}/src/renderers
+	${CMAKE_SOURCE_DIR}/src/renderers/gl
 	${CMAKE_SOURCE_DIR}/src/network
 
 	${CMAKE_SOURCE_DIR}/game

+ 2 - 2
src/Device.h

@@ -126,8 +126,8 @@ private:
 	int32_t					m_preferred_renderer;
 	int32_t					m_preferred_mode;
 
-	char					m_preferred_root_path[os::MAX_PATH_LENGTH];
-	char					m_preferred_user_path[os::MAX_PATH_LENGTH];
+	char					m_preferred_root_path[MAX_PATH_LENGTH];
+	char					m_preferred_user_path[MAX_PATH_LENGTH];
 
 	bool					m_is_init		: 1;
 	bool					m_is_running	: 1;

+ 10 - 10
src/Filesystem.cpp

@@ -37,7 +37,7 @@ Filesystem::Filesystem(const char* root_path)
 	ce_assert(root_path != NULL, "Root path must be != NULL");
 	ce_assert(os::is_absolute_path(root_path), "Root path must be absolute");
 
-	string::strncpy(m_root_path, root_path, os::MAX_PATH_LENGTH);
+	string::strncpy(m_root_path, root_path, MAX_PATH_LENGTH);
 }
 
 //-----------------------------------------------------------------------------
@@ -54,22 +54,22 @@ const char* Filesystem::root_path() const
 //-----------------------------------------------------------------------------
 const char* Filesystem::build_os_path(const char* base_path, const char* relative_path)
 {
-	static char os_path[os::MAX_PATH_LENGTH];
+	static char os_path[MAX_PATH_LENGTH];
 
-	string::strncpy(os_path, base_path, os::MAX_PATH_LENGTH);
+	string::strncpy(os_path, base_path, MAX_PATH_LENGTH);
 
 	size_t base_path_len = string::strlen(base_path);
 
-	os_path[base_path_len] = os::PATH_SEPARATOR;
+	os_path[base_path_len] = PATH_SEPARATOR;
 
-	string::strncpy(&os_path[base_path_len + 1], relative_path, os::MAX_PATH_LENGTH);
+	string::strncpy(&os_path[base_path_len + 1], relative_path, MAX_PATH_LENGTH);
 
 	// FIXME FIXME FIXME Replace Crown-specific path separator with OS-speficic one
 	for (size_t j = 0; j < string::strlen(os_path); j++)
 	{
 		if (os_path[j] == '/')
 		{
-			os_path[j] = os::PATH_SEPARATOR;
+			os_path[j] = PATH_SEPARATOR;
 		}
 	}
 
@@ -84,8 +84,8 @@ bool Filesystem::get_info(const char* relative_path, FilesystemEntry& info)
 
 	const char* os_path = build_os_path(m_root_path, relative_path);
 	
-	string::strncpy(info.os_path, os_path, os::MAX_PATH_LENGTH);
-	string::strncpy(info.relative_path, relative_path, os::MAX_PATH_LENGTH);
+	string::strncpy(info.os_path, os_path, MAX_PATH_LENGTH);
+	string::strncpy(info.relative_path, relative_path, MAX_PATH_LENGTH);
 
 	if (os::is_reg(os_path))
 	{
@@ -172,13 +172,13 @@ bool Filesystem::delete_dir(const char* relative_path)
 //-----------------------------------------------------------------------------
 const char* Filesystem::os_path(const char* relative_path)
 {
-	static char os_path[os::MAX_PATH_LENGTH];
+	static char os_path[MAX_PATH_LENGTH];
 
 	FilesystemEntry entry;
 
 	get_info(relative_path, entry);
 
-	string::strncpy(os_path, entry.os_path, os::MAX_PATH_LENGTH);
+	string::strncpy(os_path, entry.os_path, MAX_PATH_LENGTH);
 
 	return os_path;
 }

+ 3 - 3
src/Filesystem.h

@@ -45,8 +45,8 @@ struct FilesystemEntry
 	FilesystemEntry() : type(UNKNOWN) {}
 
 	Type			type;								///< Type of the entry
-	char			os_path[os::MAX_PATH_LENGTH];		///< OS-specific path (use only for debug)
-	char			relative_path[os::MAX_PATH_LENGTH];	///< Relative path of the entry
+	char			os_path[MAX_PATH_LENGTH];			///< OS-specific path (use only for debug)
+	char			relative_path[MAX_PATH_LENGTH];		///< Relative path of the entry
 };
 
 class FileStream;
@@ -151,7 +151,7 @@ private:
 	
 private:
 
-	char				m_root_path[os::MAX_PATH_LENGTH];
+	char				m_root_path[MAX_PATH_LENGTH];
 
 	// Disable copying
 						Filesystem(const Filesystem&);

+ 16 - 16
src/input/InputManager.cpp

@@ -98,20 +98,20 @@ EventDispatcher* InputManager::get_event_dispatcher()
 //-----------------------------------------------------------------------------
 void InputManager::event_loop()
 {
-	os::OSEvent event;
+	OsEvent event;
 
 	while (1)
 	{
-		event = os::pop_event();
+		event = pop_event();
 
 		switch (event.type)
 		{
-			case os::OSET_NONE:
+			case OSET_NONE:
 			{
 				return;
 			}
-			case os::OSET_BUTTON_PRESS:
-			case os::OSET_BUTTON_RELEASE:
+			case OSET_BUTTON_PRESS:
+			case OSET_BUTTON_RELEASE:
 			{
 				MouseEvent mouse_event;
 				mouse_event.x = event.data_a.int_value;
@@ -119,7 +119,7 @@ void InputManager::event_loop()
 				mouse_event.button = event.data_c.int_value == 0 ? MB_LEFT : event.data_c.int_value == 1 ? MB_MIDDLE : MB_RIGHT;
 				mouse_event.wheel = 0.0f;
 
-				if (event.type == os::OSET_BUTTON_PRESS)
+				if (event.type == OSET_BUTTON_PRESS)
 				{
 					m_mouse.m_buttons[mouse_event.button] = true;
 					m_event_dispatcher.button_pressed(mouse_event);
@@ -132,8 +132,8 @@ void InputManager::event_loop()
 
 				break;
 			}
-			case os::OSET_KEY_PRESS:
-			case os::OSET_KEY_RELEASE:
+			case OSET_KEY_PRESS:
+			case OSET_KEY_RELEASE:
 			{
 				KeyboardEvent keyboard_event;
 				keyboard_event.key = event.data_a.int_value;
@@ -141,7 +141,7 @@ void InputManager::event_loop()
 
 				m_keyboard.m_modifier = keyboard_event.modifier;
 
-				if (event.type == os::OSET_KEY_PRESS)
+				if (event.type == OSET_KEY_PRESS)
 				{
 					m_keyboard.m_keys[keyboard_event.key] = true;
 					m_event_dispatcher.key_pressed(keyboard_event);
@@ -154,8 +154,8 @@ void InputManager::event_loop()
 
 				break;
 			}
-			case os::OSET_TOUCH_DOWN:
-			case os::OSET_TOUCH_UP:
+			case OSET_TOUCH_DOWN:
+			case OSET_TOUCH_UP:
 			{
 				TouchEvent touch_event;
 				touch_event.pointer_id = event.data_a.int_value;
@@ -169,7 +169,7 @@ void InputManager::event_loop()
 				m_touch.m_pointers[touch_event.pointer_id].relative_x = 0.0f;
 				m_touch.m_pointers[touch_event.pointer_id].relative_y = 0.0f;
 
-				if (event.type == os::OSET_TOUCH_DOWN)
+				if (event.type == OSET_TOUCH_DOWN)
 				{
 					m_touch.m_pointers[touch_event.pointer_id].up = false;
 					m_event_dispatcher.touch_down(touch_event);
@@ -182,7 +182,7 @@ void InputManager::event_loop()
 
 				break;
 			}
-			case os::OSET_TOUCH_MOVE:
+			case OSET_TOUCH_MOVE:
 			{
 				TouchEvent touch_event;
 				touch_event.pointer_id = event.data_a.int_value;
@@ -200,7 +200,7 @@ void InputManager::event_loop()
 
 				break;
 			}
-			case os::OSET_ACCELEROMETER:
+			case OSET_ACCELEROMETER:
 			{
 				AccelerometerEvent sensor_event;
 				sensor_event.x = event.data_a.float_value;
@@ -233,11 +233,11 @@ void InputManager::set_cursor_visible(bool visible)
 {
 	if (visible)
 	{
-		os::hide_cursor();
+		//hide_cursor();
 	}
 	else
 	{
-		os::show_cursor();
+		//show_cursor();
 	}
 
 	m_cursor_visible = visible;

+ 2 - 2
src/input/Mouse.cpp

@@ -54,7 +54,7 @@ Vec2 Mouse::cursor_xy() const
 {
 	int32_t x, y;
 
-	os::get_cursor_xy(x, y);
+	//os::get_cursor_xy(xy.x, xy.y);
 
 	return Vec2(x, y);
 }
@@ -62,7 +62,7 @@ Vec2 Mouse::cursor_xy() const
 //-----------------------------------------------------------------------------
 void Mouse::set_cursor_xy(const Vec2& position)
 {
-	os::set_cursor_xy(position.x, position.y);
+	//os::set_cursor_xy(position.x, position.y);
 }
 
 //-----------------------------------------------------------------------------

+ 31 - 10
src/os/OS.cpp

@@ -1,17 +1,40 @@
+/*
+Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
 #include "OS.h"
 
 namespace crown
 {
 
-namespace os
-{
-
-static OSEvent			event_queue[MAX_EVENTS];
+static const size_t		MAX_EVENTS = 512;
+static OsEvent			event_queue[MAX_EVENTS];
 static uint32_t			event_queue_head = 0;
 static uint32_t			event_queue_tail = 0;
 
 //-----------------------------------------------------------------------------
-void push_event(OSEventType type, OSEventParameter data_a, OSEventParameter data_b, OSEventParameter data_c, OSEventParameter data_d)
+void push_event(OsEventType type, OsEventParameter data_a, OsEventParameter data_b, OsEventParameter data_c, OsEventParameter data_d)
 {
 	if ((event_queue_tail + 1) % MAX_EVENTS == event_queue_head)
 	{
@@ -19,7 +42,7 @@ void push_event(OSEventType type, OSEventParameter data_a, OSEventParameter data
 		return;
 	}
 
-	OSEvent* event = &event_queue[event_queue_tail];
+	OsEvent* event = &event_queue[event_queue_tail];
 	event_queue_tail = (event_queue_tail + 1) % MAX_EVENTS;
 
 	event->type = type;
@@ -30,9 +53,9 @@ void push_event(OSEventType type, OSEventParameter data_a, OSEventParameter data
 }
 
 //-----------------------------------------------------------------------------
-OSEvent& pop_event()
+OsEvent& pop_event()
 {
-	static OSEvent event;
+	static OsEvent event;
 
 	if (event_queue_head == event_queue_tail)
 	{
@@ -46,7 +69,5 @@ OSEvent& pop_event()
 	return event;
 }
 
-} // namespace os
-
 } // namespace crown
 

+ 21 - 31
src/os/OS.h

@@ -33,25 +33,15 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-/// OS-specific functions and parameters.
-namespace os
-{
-
 //-----------------------------------------------------------------------------
 #ifdef LINUX
 const size_t	MAX_PATH_LENGTH = 1024;
 const char		PATH_SEPARATOR = '/';
 
-const size_t	MAX_EVENTS = 512;
-#endif
-
-#ifdef WINDOWS
-const size_t	MAX_PATH_LENGTH = 1024;
-const char		PATH_SEPARATOR = '\\';
-
-const size_t	MAX_EVENTS = 512;
 #endif
 
+namespace os
+{
 //-----------------------------------------------------------------------------
 // Print and log functions
 //-----------------------------------------------------------------------------
@@ -116,10 +106,19 @@ void			show_cursor();
 uint64_t		milliseconds();
 uint64_t		microseconds();
 
+//-----------------------------------------------------------------------------
+// Dynamic libraries
+//-----------------------------------------------------------------------------
+void*			open_library(const char* path);
+void			close_library(void* library);
+void*			lookup_symbol(void* library, const char* name);
+
+} // namespace os
+
 //-----------------------------------------------------------------------------
 // Events
 //-----------------------------------------------------------------------------
-enum OSEventType
+enum OsEventType
 {
 	OSET_NONE				= 0,
 
@@ -135,35 +134,26 @@ enum OSEventType
 	OSET_ACCELEROMETER		= 9
 };
 
-union OSEventParameter
+union OsEventParameter
 {
 	int32_t int_value;
 	float	float_value;
 };
 
-struct OSEvent
+struct OsEvent
 {
-	OSEventType			type;
-	OSEventParameter	data_a;
-	OSEventParameter	data_b;
-	OSEventParameter	data_c;
-	OSEventParameter	data_d;
+	OsEventType			type;
+	OsEventParameter	data_a;
+	OsEventParameter	data_b;
+	OsEventParameter	data_c;
+	OsEventParameter	data_d;
 };
 
 /// Pushes the event @type along with its parameters into the os' event queue.
-void			push_event(OSEventType type, OSEventParameter data_a, OSEventParameter data_b, OSEventParameter data_c, OSEventParameter data_d);
-
+void			push_event(OsEventType type, OsEventParameter data_a, OsEventParameter data_b, OsEventParameter data_c, OsEventParameter data_d);
 
 /// Returns and pops the first event in the os' event queue.
-OSEvent&		pop_event();
+OsEvent&		pop_event();
 
-//-----------------------------------------------------------------------------
-// Dynamic libraries
-//-----------------------------------------------------------------------------
-void*			open_library(const char* path);
-void			close_library(void* library);
-void*			lookup_symbol(void* library, const char* name);
-
-} // namespace os
 } // namespace crown
 

+ 2 - 1
src/os/linux/CMakeLists.txt

@@ -5,7 +5,7 @@ project(crown-linux)
 set (LINUX_SRC
 	GLXRenderWindow.cpp
 	LinuxOS.cpp
-	Input.cpp
+	OsWindow.cpp
 	../posix/TCPSocket.cpp
 	../posix/UDPSocket.cpp	
 	../posix/File.cpp
@@ -15,6 +15,7 @@ set (LINUX_SRC
 )
 
 set (LINUX_HEADERS
+	OsWindow.h
 	TCPSocket.h
 	UDPSocket.h
 	File.h

+ 0 - 245
src/os/linux/GLXRenderWindow.cpp

@@ -1,245 +0,0 @@
-/*
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <GL/glx.h>
-#include "Types.h"
-#include "Log.h"
-#include "OS.h"
-
-namespace crown
-{
-
-namespace os
-{
-
-Display*		display = NULL;
-Window			window = None;
-GLXContext		glx_context = NULL;
-GLXDrawable		glx_window = None;
-uint32_t		window_x = 0;
-uint32_t		window_y = 0;
-uint32_t		window_width = 0;
-uint32_t		window_height = 0;
-
-//-----------------------------------------------------------------------------
-bool create_render_window(uint32_t x, uint32_t y, uint32_t width, uint32_t height, bool fullscreen)
-{
-	(void)fullscreen;
-
-	ce_assert(width != 0 && height != 0, "Width and height must be != 0");
-
-	display = XOpenDisplay(NULL);
-
-	if (display == NULL)
-	{
-		Log::e("Unable to open a display");
-		return false;
-	}
-
-	Window defRoot = DefaultRootWindow(display);
-
-	// Color index buffer not supported - deprecated
-	int32_t fbAttribs[] =
-	{
-		GLX_DOUBLEBUFFER,		static_cast<int32_t>(True),
-		GLX_RED_SIZE,			8,
-		GLX_GREEN_SIZE,			8,
-		GLX_BLUE_SIZE,			8,
-		GLX_ALPHA_SIZE,			8,
-		GLX_DEPTH_SIZE,			24,
-		GLX_STENCIL_SIZE,		0,
-		GLX_ACCUM_RED_SIZE,		0,
-		GLX_ACCUM_GREEN_SIZE,	0,
-		GLX_ACCUM_BLUE_SIZE,	0,
-		GLX_ACCUM_ALPHA_SIZE,	0,
-		GLX_RENDER_TYPE,		static_cast<int32_t>(GLX_RGBA_BIT),
-		GLX_DRAWABLE_TYPE,		static_cast<int32_t>(GLX_WINDOW_BIT),
-		GLX_X_RENDERABLE,		static_cast<int32_t>(True),
-		GLX_CONFIG_CAVEAT,		static_cast<int32_t>(GLX_DONT_CARE),
-		GLX_TRANSPARENT_TYPE,	static_cast<int32_t>(GLX_NONE),
-		static_cast<int32_t>(None)
-	};
-
-	int32_t fbCount;
-	GLXFBConfig* fbConfig = glXChooseFBConfig(display, XDefaultScreen(display), fbAttribs, &fbCount);
-
-	if (!fbConfig)
-	{
-		Log::e("Unable to find a matching FrameBuffer configuration.");
-		return false;
-	}
-
-	XVisualInfo* visualInfo = glXGetVisualFromFBConfig(display, fbConfig[0]);
-
-	if (!visualInfo)
-	{
-		Log::e("Unable to find a matching Visual for the FrameBuffer configuration.");
-		XFree(fbConfig);
-		return false;
-	}
-
-	Colormap cmap;
-	cmap = XCreateColormap(display, defRoot, visualInfo->visual, AllocNone);
-	XSetWindowAttributes winAttribs;
-	winAttribs.colormap = cmap;
-	winAttribs.event_mask = FocusChangeMask | StructureNotifyMask;
-
-	window = XCreateWindow(
-				   display,
-				   defRoot,
-				   x, y,
-				   width, height,
-				   0,
-				   visualInfo->depth,
-				   InputOutput,
-				   visualInfo->visual,
-				   CWColormap | CWEventMask,
-				   &winAttribs
-			   );
-
-	if (!window)
-	{
-		Log::e("Unable to create the X Window.");
-		return false;
-	}
-
-	XMapRaised(display, window);
-	glx_window = glXCreateWindow(display, fbConfig[0], window, 0);
-
-	glx_context = glXCreateNewContext(display, fbConfig[0], GLX_RGBA_TYPE, NULL, True);
-	glXMakeContextCurrent(display, glx_window, glx_window, glx_context);
-
-	XFreeColormap(display, cmap);
-	XFree(visualInfo);
-	XFree(fbConfig);
-	XFlush(display);
-
-	window_x = x;
-	window_y = y;
-	window_width = width;
-	window_height = height;
-
-	return true;
-}
-
-//-----------------------------------------------------------------------------
-bool destroy_render_window()
-{
-	if (display)
-	{
-		if (glx_window)
-		{
-			glXDestroyWindow(display, glx_window);
-		}
-
-		if (glx_context)
-		{
-			glXMakeContextCurrent(display, None, None, NULL);
-			glXDestroyContext(display, glx_context);
-		}
-
-		if (window)
-		{
-			XDestroyWindow(display, window);
-		}
-
-		XCloseDisplay(display);
-	}
-
-	return true;
-}
-
-//-----------------------------------------------------------------------------
-void swap_buffers()
-{
-	glXSwapBuffers(display, glx_window);
-}
-
-//-----------------------------------------------------------------------------
-void get_render_window_metrics(uint32_t& width, uint32_t& height)
-{
-	XWindowAttributes attribs;
-	XGetWindowAttributes(display, window, &attribs);
-
-	XFlush(display);
-
-	window_width = attribs.width;
-	window_height = attribs.height;
-
-	width = window_width;
-	height = window_height;
-}
-
-////-----------------------------------------------------------------------------
-//void GLXRenderWindow::Move(uint32_t x, uint32_t y)
-//{
-//	if (x == mX && y == mY)
-//	{
-//		return;
-//	}
-
-//	XMoveWindow(display, window, x, y);
-//}
-
-////-----------------------------------------------------------------------------
-//void GLXRenderWindow::Resize(uint32_t width, uint32_t height)
-//{
-//	if (!width || !height)
-//	{
-//		return;
-//	}
-
-//	if (width == mWidth && height == mHeight)
-//	{
-//		return;
-//	}
-
-//	XResizeWindow(display, window, width, height);
-//}
-
-////-----------------------------------------------------------------------------
-//void GLXRenderWindow::SetFullscreen(bool full)
-//{
-//	mFull = full;
-//	XEvent xEvent;
-//	Atom wmState = XInternAtom(display, "_NET_WM_STATE", False);
-//	Atom fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
-//	xEvent.type = ClientMessage;
-//	xEvent.xclient.window = window;
-//	xEvent.xclient.message_type = wmState;
-//	xEvent.xclient.format = 32;
-//	xEvent.xclient.data.l[0] = (mFull ? 1 : 0);
-//	xEvent.xclient.data.l[1] = fullscreen;
-//	xEvent.xclient.data.l[2] = 0;
-//	XSendEvent(display, DefaultRootWindow(display), False, SubstructureNotifyMask, &xEvent);
-//}
-
-} // namespace os
-
-} // namespace crown
-

+ 14 - 3
src/os/linux/main.cpp

@@ -24,6 +24,17 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Crown.h"
+#include "List.h"
+#include "GLXContext.h"
+#include <X11/Xlib.h>
+
+namespace crown
+{
+namespace os
+{
+extern Window window;
+}
+}
 
 int main(int argc, char** argv)
 {
@@ -31,7 +42,9 @@ int main(int argc, char** argv)
 
 	crown::os::create_render_window(0, 0, 1000, 625, false);
 
-	crown::os::init_input();
+	crown::Context context;
+	context.set_window(crown::os::window);
+	context.create_context();
 
 	crown::Device* engine = crown::device();
 
@@ -43,8 +56,6 @@ int main(int argc, char** argv)
 	// Main loop
 	while (engine->is_running())
 	{
-		crown::os::event_loop();
-
 		engine->frame();
 
 		crown::os::swap_buffers();

+ 1 - 0
src/renderers/gl/GLRenderer.h

@@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include <GL/glew.h>
 
+#include "GLXContext.h"
 #include "Renderer.h"
 #include "Texture.h"
 #include "VertexBuffer.h"