29#ifndef NOMLIB_SDL2_HELPERS_HPP
30#define NOMLIB_SDL2_HELPERS_HPP
36#include "nomlib/config.hpp"
37#include "nomlib/math/Color4.hpp"
38#include "nomlib/math/Rect.hpp"
39#include "nomlib/math/Size2.hpp"
40#include "nomlib/math/Point2.hpp"
52#if defined( NOM_PLATFORM_WINDOWS )
65 BLEND_MODE_NONE = SDL_BLENDMODE_NONE,
70 BLEND_MODE_BLEND = SDL_BLENDMODE_BLEND,
75 BLEND_MODE_ADD = SDL_BLENDMODE_ADD,
80 BLEND_MODE_MOD = SDL_BLENDMODE_MOD
91 PIXEL_FORMAT_INVALID = SDL_PIXELFORMAT_UNKNOWN,
94 PIXEL_FORMAT_ARGB8888 = SDL_PIXELFORMAT_ARGB8888,
97 PIXEL_FORMAT_YV12 = SDL_PIXELFORMAT_YV12,
100 PIXEL_FORMAT_IYUV = SDL_PIXELFORMAT_IYUV,
103 PIXEL_FORMAT_UYVY = SDL_PIXELFORMAT_UYVY,
112 typedef std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> UniquePtr;
113 typedef SDL_Window* RawPtr;
121 typedef SDL_PixelFormat* RawPtr;
130 typedef std::unique_ptr<SDL_Surface, void(*) (SDL_Surface*)> UniquePtr;
131 typedef std::shared_ptr<SDL_Surface> SharedPtr;
132 typedef SDL_Surface* RawPtr;
141 typedef std::shared_ptr<SDL_Texture> SharedPtr;
142 typedef SDL_Texture* RawPtr;
147BlendMode blend_mode(SDL_BlendMode mode);
151SDL_BlendMode SDL_blend_mode(BlendMode mode);
156SDL_Rect SDL_RECT (
const IntRect& rectangle );
163SDL_Rect SDL_RECT (
const Point2i& pos,
const Size2i& size );
168SDL_Point SDL_POINT (
const Point2i& );
173SDL_Color SDL_COLOR (
const Color4i& color );
178const Color4i pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
183const Color4i alpha_pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
185const Color4i pixel ( uint32 pixel, uint32 fmt );
186const Color4i alpha_pixel ( uint32 pixel, uint32 fmt );
194uint32 RGB (
const Color4i& color,
const SDL_PixelFormat* fmt );
202uint32 RGB (
const Color4i& color, uint32 fmt );
210uint32 RGBA (
const Color4i& color,
const SDL_PixelFormat* fmt );
218uint32 RGBA (
const Color4i& color, uint32 fmt );
227std::string hint(
const std::string& name);
240bool set_hint(
const std::string& name,
const std::string& value);
242const std::string PIXEL_FORMAT_NAME ( uint32 format );
251bool save_png ( SDL_SURFACE::RawPtr,
const std::string& filename );
259int available_render_driver(
const std::string& driver);
264void FreeWindow ( SDL_Window* );
267void FreeRenderTarget ( SDL_Renderer* );
270void FreeTexture ( SDL_Texture* );
273void FreeSurface ( SDL_Surface* );
282std::ostream& operator <<( std::ostream& os,
const SDL_Point& pos );
285std::ostream& operator <<( std::ostream& os,
const SDL_Rect& rect );
288std::ostream& operator <<( std::ostream& os,
const SDL_Color& color );
Convenience definitions for pointer types.
Convenience definitions for pointer types.
Convenience definitions for pointer types.
Convenience definitions for pointer types.