From 926584873cd9a83458ac482c02902f4eedb1e9d3 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 7 Aug 2018 21:53:55 +0800 Subject: *init --- ui/ui.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ui/ui.h (limited to 'ui/ui.h') diff --git a/ui/ui.h b/ui/ui.h new file mode 100644 index 0000000..a2c0e57 --- /dev/null +++ b/ui/ui.h @@ -0,0 +1,56 @@ +// ui - Basic User Interface library to do experiments -*- C++ -*- +// Copyright (C) 2010, 2012 David Capello +// +// Distributed under the terms of the New BSD License, +// see LICENSE.md for more details. + +#ifndef UI_UI_HEADER_FILE_INCLUDED +#define UI_UI_HEADER_FILE_INCLUDED + +#if WIN32 + #include "ui/win32.h" +#endif + +namespace ui { + + ////////////////////////////////////////////////////////////////////// + // window class + + class window { + public: + window(int width, int height) { + m_impl = new window_impl(width, height); + } + + ~window() { + delete m_impl; + } + + size_t width() { + return m_impl->width(); + } + + size_t height() { + return m_impl->height(); + } + + void waitkey() { + m_impl->waitkey(); + } + + window& operator<<(const std::string& text) { + m_impl->write(text); + return *this; + } + + private: + window_impl* m_impl; + + // Non-copyable + window(const window&); + window& operator=(const window&); + }; + +} // namespace ui + +#endif // UI_UI_HEADER_FILE_INCLUDED -- cgit v1.1-26-g67d0