* Window and Graphics Device Functions. */
| 12 | * Window and Graphics Device Functions. |
| 13 | */ |
| 14 | class Window { |
| 15 | public: |
| 16 | /** |
| 17 | * Build a Window object, but defer the initialization. Ensure you call Init() manually. |
| 18 | * |
| 19 | * @see Init() |
| 20 | */ |
| 21 | Window() = default; |
| 22 | |
| 23 | /** |
| 24 | * Initialize window and OpenGL context. |
| 25 | * |
| 26 | * @param width The width of the window. |
| 27 | * @param height The height of the window. |
| 28 | * @param title The desired title of the window. |
| 29 | * @param flags The ConfigFlags to set prior to initializing the window. See SetConfigFlags for more details. |
| 30 | * @param logLevel The the current threshold (minimum) log level |
| 31 | * |
| 32 | * @see ::SetConfigFlags() |
| 33 | * @see ConfigFlags |
| 34 | * |
| 35 | * @throws raylib::RaylibException Thrown if the window failed to initiate. |
| 36 | */ |
| 37 | Window(int width, int height, const std::string& title = "raylib", unsigned int flags = 0, TraceLogLevel logLevel = LOG_ALL) { |
| 38 | Init(width, height, title, flags, logLevel); |
| 39 | } |
| 40 | |
| 41 | Window(const Window&) = delete; |
| 42 | Window& operator=(const Window&) = delete; |
| 43 | |
| 44 | /** |
| 45 | * Close window and unload OpenGL context |
| 46 | */ |
| 47 | ~Window() { Close(); } |
| 48 | |
| 49 | [[nodiscard]] std::string ToString() const { return TextFormat("Window(%dx%d)", GetWidth(), GetHeight()); } |
| 50 | |
| 51 | operator std::string() const { return ToString(); } |
| 52 | |
| 53 | /** |
| 54 | * Initializes the window. |
| 55 | * |
| 56 | * @param width The width of the window. |
| 57 | * @param height The height of the window. |
| 58 | * @param title The desired title of the window. |
| 59 | * @param flags The ConfigFlags to set prior to initializing the window. See SetConfigFlags for more details. |
| 60 | * |
| 61 | * @see ::SetConfigFlags() |
| 62 | * @see ConfigFlags |
| 63 | * |
| 64 | * @throws raylib::RaylibException Thrown if the window failed to initiate. |
| 65 | */ |
| 66 | static void Init(int width = 800, int height = 450, const std::string& title = "raylib", unsigned int flags = 0, TraceLogLevel logLevel = LOG_ALL) { |
| 67 | if (flags != 0) { |
| 68 | ::SetConfigFlags(flags); |
| 69 | } |
| 70 | ::SetTraceLogLevel(logLevel); |
| 71 | ::InitWindow(width, height, title.c_str()); |
nothing calls this directly
no test coverage detected