Mercurial > malikania
view libclient/malikania/backend/sdl/window-backend.h @ 7:45b3c770803c
Misc: switch to lower case (part 2)
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 23 Mar 2016 17:11:39 +0100 |
parents | |
children | cc13926bed59 |
line wrap: on
line source
/* * window-backend.h -- window object (SDL2 implementation) * * Copyright (c) 2013-2016 Malikania Authors * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MALIKANIA_WINDOW_BACKEND_H #define MALIKANIA_WINDOW_BACKEND_H #include <memory> #include <vector> #include <SDL.h> #include <malikania/color.h> #include <malikania/font.h> #include <malikania/line.h> #include <malikania/point.h> #include <malikania/rectangle.h> #include <malikania/size.h> #include <malikania/window.h> namespace malikania { class Window; class Window::Backend { private: using WindowHandle = std::unique_ptr<SDL_Window, void (*)(SDL_Window *)>; using RendererHandle = std::unique_ptr<SDL_Renderer, void (*)(SDL_Renderer *)>; WindowHandle m_window; RendererHandle m_renderer; public: Backend(Window &self, unsigned width, unsigned height); void close(); void processEvents(Window &window); void clear(); void update(); void present(); Size resolution(); // Drawing functions void setDrawingColor(const Color &color); void drawLine(const Line &line); void drawLines(const std::vector<Point> &points); void drawPoint(const Point &point); void drawPoints(const std::vector<Point> &points); void drawRectangle(const Rectangle &rectangle, bool filled, const Color &fillColor); void drawRectangles(const std::vector<Rectangle> &rectangles, bool filled, std::vector<Color> fillColors); void drawText(const std::string &text, Font &font, const Rectangle &rectangle); void drawText(const std::string &text, Font &font, const Point &point); inline SDL_Renderer *renderer() noexcept { return m_renderer.get(); } }; } // !malikania #endif // !MALIKANIA_WINDOW_BACKEND_H