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

+ 0 - 101
src/core/os_window_android.cpp

@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#include "config.h"
-
-#if CROWN_PLATFORM_ANDROID
-
-#include "os_window_android.h"
-#include "error.h"
-#include "log.h"
-
-namespace crown
-{
-
-OsWindow::OsWindow()
-	: m_x(0)
-	, m_y(0)
-	, m_width(0)
-	, m_height(0)
-{
-}
-
-OsWindow::~OsWindow()
-{
-}
-
-void OsWindow::show()
-{
-}
-
-void OsWindow::hide()
-{
-}
-
-void OsWindow::get_size(uint32_t& width, uint32_t& height)
-{
-	width = m_width;
-	height = m_height;
-}
-
-void OsWindow::get_position(uint32_t& x, uint32_t& y)
-{
-	x = m_x;
-	y = m_y;
-}
-
-void OsWindow::resize(uint32_t /*width*/, uint32_t /*height*/)
-{
-}
-
-void OsWindow::move(uint32_t /*x*/, uint32_t /*y*/)
-{
-}
-
-void OsWindow::minimize()
-{
-}
-
-void OsWindow::restore()
-{
-}
-
-bool OsWindow::is_resizable() const
-{
-	return false;
-}
-
-void OsWindow::set_resizable(bool /*resizeable*/)
-{
-}
-
-void OsWindow::show_cursor(bool /*show*/)
-{
-}
-
-void OsWindow::get_cursor_xy(int32_t& /*x*/, int32_t& /*y*/)
-{
-}
-
-void OsWindow::set_cursor_xy(int32_t /*x*/, int32_t /*y*/)
-{
-}
-
-char* OsWindow::title()
-{
-	return NULL;
-}
-
-void OsWindow::set_title(const char* /*title*/)
-{
-}
-
-void OsWindow::frame()
-{
-}
-
-} // namespace crown
-
-#endif // CROWN_PLATFORM_ANDROID

+ 0 - 79
src/core/os_window_android.h

@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include <sys/types.h>
-#include <android/native_window.h>
-#include <android/native_window_jni.h>
-
-namespace crown
-{
-
-class OsWindow
-{
-public:
-
-	/// Stub method, does nothing under Android.
-	OsWindow();
-	~OsWindow();
-
-	/// Stub method, does nothing under Android.
-	void show();
-
-	/// Stub method, does nothing under Android.
-	void hide();
-
-	/// Returns the size in pixel of the window.
-	void get_size(uint32_t& width, uint32_t& height);
-
-	/// Returns always (0, 0) under Android.
-	void get_position(uint32_t& x, uint32_t& y);
-
-	/// Stub method, does nothing under Android.
-	void resize(uint32_t width, uint32_t height);
-
-	/// Stub method, does nothing under Android.
-	void move(uint32_t x, uint32_t y);
-
-	/// Stub method, does nothing under Android.
-	void minimize();
-
-	/// Stub method, does nothing under Android.
-	void restore();
-
-	/// Returns always false.
-	bool is_resizable() const;
-
-	/// Stub method, does nothing under Android.
-	void set_resizable(bool resizeable);
-
-	/// Stub method, does nothing under Android.
-	void show_cursor(bool show);
-
-	/// Stub method, does nothing under Android.
-	void get_cursor_xy(int32_t& x, int32_t& y);
-
-	/// Stub method, does nothing under Android.
-	void set_cursor_xy(int32_t x, int32_t y);
-
-	/// Returns always NULL under Android.
-	char* title();
-
-	/// Stub method, does nothing under Android.
-	void set_title(const char* title);
-
-	/// Stub method, does nothing under Android.
-	void frame();
-
-public:
-
-	uint32_t m_x;
-	uint32_t m_y;
-	uint32_t m_width;
-	uint32_t m_height;
-};
-
-} // namespace crown

+ 0 - 120
src/core/os_window_linux.cpp

@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-#include "config.h"
-
-#if CROWN_PLATFORM_LINUX
-
-#include "os_window_linux.h"
-#include "error.h"
-#include "string_utils.h"
-#include "log.h"
-
-namespace crown
-{
-
-Display* m_x11_display = NULL;
-Window m_x11_window = None;
-
-void oswindow_set_window(Display* dpy, Window win)
-{
-	m_x11_display = dpy;
-	m_x11_window = win;
-}
-
-OsWindow::OsWindow()
-	: m_x(0)
-	, m_y(0)
-	, m_width(0)
-	, m_height(0)
-	, m_resizable(true)
-{
-}
-
-OsWindow::~OsWindow()
-{
-}
-
-void OsWindow::show()
-{
-	XMapRaised(m_x11_display, m_x11_window);
-}
-
-void OsWindow::hide()
-{
-	XUnmapWindow(m_x11_display, m_x11_window);
-}
-
-void OsWindow::get_size(uint32_t& width, uint32_t& height)
-{
-	width = m_width;
-	height = m_height;
-}
-
-void OsWindow::get_position(uint32_t& x, uint32_t& y)
-{
-	x = m_x;
-	y = m_y;
-}
-
-void OsWindow::resize(uint32_t width, uint32_t height)
-{
-	XResizeWindow(m_x11_display, m_x11_window, width, height);
-}
-
-void OsWindow::move(uint32_t x, uint32_t y)
-{
-	XMoveWindow(m_x11_display, m_x11_window, x, y);
-}
-
-void OsWindow::minimize()
-{
-	XIconifyWindow(m_x11_display, m_x11_window, DefaultScreen(m_x11_display));
-}
-
-void OsWindow::restore()
-{
-	XMapRaised(m_x11_display, m_x11_window);
-}
-
-bool OsWindow::is_resizable() const
-{
-	return m_resizable;
-}
-
-void OsWindow::set_resizable(bool resizable)
-{
-	XSizeHints hints;
-	hints.flags = PMinSize | PMaxSize;
-	hints.min_width = resizable ? 1 : m_width;
-	hints.min_height = resizable ? 1 : m_height;
-	hints.max_width = resizable ? 65535 : m_width;
-	hints.max_height = resizable ? 65535 : m_height;
-
-	XSetWMNormalHints(m_x11_display, m_x11_window, &hints);
-
-	m_resizable = resizable;
-}
-
-char* OsWindow::title()
-{
-	static char title[1024];
-
-	char* tmp_title;
-	XFetchName(m_x11_display, m_x11_window, &tmp_title);
-
-	strncpy(title, tmp_title, 1024);
-	XFree(tmp_title);
-
-	return title;
-}
-
-void OsWindow::set_title(const char* title)
-{
-	XStoreName(m_x11_display, m_x11_window, title);
-}
-
-} // namespace crown
-
-#endif // CROWN_PLATFORM_LINUX

+ 0 - 56
src/core/os_window_linux.h

@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "types.h"
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/XKBlib.h>
-
-namespace crown
-{
-
-void oswindow_set_window(Display* dpy, Window win);
-
-struct OsWindow
-{
-	OsWindow();
-	~OsWindow();
-
-	void show();
-	void hide();
-
-	void get_size(uint32_t& width, uint32_t& height);
-	void get_position(uint32_t& x, uint32_t& y);
-
-	void resize(uint32_t width, uint32_t height);
-	void move(uint32_t x, uint32_t y);
-
-	void minimize();
-	void restore();
-
-	bool is_resizable() const;
-	void set_resizable(bool resizable);
-
-	void show_cursor(bool show);
-
-	void get_cursor_xy(int32_t& x, int32_t& y);
-	void set_cursor_xy(int32_t x, int32_t y);
-
-	char* title();
-	void set_title(const char* title);
-
-public:
-
-	uint32_t m_x;
-	uint32_t m_y;
-	uint32_t m_width;
-	uint32_t m_height;
-	bool m_resizable;
-};
-
-} // namespace crown

+ 0 - 85
src/core/os_window_windows.cpp

@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-#include "config.h"
-
-#if CROWN_PLATFORM_WINDOWS
-
-#include "os_window_windows.h"
-#include "string_utils.h"
-
-namespace crown
-{
-
-HWND m_windows_window = 0;
-
-void oswindow_set_window(HWND handle_win)
-{
-	m_windows_window = handle_win;
-}
-
-OsWindow::OsWindow()
-	: m_resizable(true)
-{
-	set_title("");
-}
-
-OsWindow::~OsWindow()
-{
-}
-
-void OsWindow::show()
-{
-	ShowWindow(m_windows_window, SW_SHOW);
-}
-
-void OsWindow::hide()
-{
-	ShowWindow(m_windows_window, SW_HIDE);
-}
-
-void OsWindow::resize(uint32_t width, uint32_t height)
-{
-	SetWindowPos(m_windows_window, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
-}
-
-void OsWindow::move(uint32_t x, uint32_t y)
-{
-	SetWindowPos(m_windows_window, NULL, x, y, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
-}
-
-void OsWindow::minimize()
-{
-	ShowWindow(m_windows_window, SW_MINIMIZE);
-}
-
-void OsWindow::restore()
-{
-	ShowWindow(m_windows_window, SW_RESTORE);
-}
-
-bool OsWindow::is_resizable() const
-{
-	return m_resizable;
-}
-
-void OsWindow::set_resizable(bool resizable)
-{
-	m_resizable = resizable;
-}
-
-char* OsWindow::title()
-{
-	return m_title;
-}
-
-void OsWindow::set_title(const char* title)
-{
-	strncpy(m_title, title, 32);
-	SetWindowText(m_windows_window, m_title);
-}
-
-} // namespace crown
-
-#endif // CROWN_PLATFORM_WINDOWS

+ 0 - 45
src/core/os_window_windows.h

@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "win_headers.h"
-#include "types.h"
-#include "macros.h"
-
-namespace crown
-{
-
-void oswindow_set_window(HWND handle_win);
-
-struct OsWindow
-{
-public:
-
-	OsWindow();
-	~OsWindow();
-
-	void show();
-	void hide();
-
-	void resize(uint32_t width, uint32_t height);
-	void move(uint32_t x, uint32_t y);
-
-	void minimize();
-	void restore();
-
-	bool is_resizable() const;
-	void set_resizable(bool resizable);
-
-	char* title();
-	void set_title(const char* title);
-
-public:
-
-	char m_title[32];
-	bool m_resizable;
-};
-
-} // namespace crown

+ 0 - 8
src/lua/lua_window.cpp

@@ -5,14 +5,6 @@
 
 #include "config.h"
 
-#if CROWN_PLATFORM_LINUX
-	#include "os_window_linux.h"
-#elif CROWN_PLATFORM_WINDOWS
-	#include "os_window_windows.h"
-#elif CROWN_PLATFORM_ANDROID
-	#include "os_window_android.h"
-#endif
-
 #include "device.h"
 #include "lua_stack.h"
 #include "lua_environment.h"