29#ifndef NOMLIB_SDL2_HELPERS_HPP
30#define NOMLIB_SDL2_HELPERS_HPP
37#include "nomlib/config.hpp"
38#include "nomlib/math/Color4.hpp"
39#include "nomlib/math/Rect.hpp"
40#include "nomlib/math/Size2.hpp"
41#include "nomlib/math/Point2.hpp"
53#if defined( NOM_PLATFORM_WINDOWS )
66#if defined(NOM_USE_SDL_TTF_MAJOR_VERSION) && defined(NOM_USE_SDL_TTF_MINOR_VERSION)
67 #if (NOM_USE_SDL_TTF_MAJOR_VERSION == 2) && (NOM_USE_SDL_TTF_MINOR_VERSION >= 23)
69 typedef struct TTF_Font TTF_Font;
72 typedef struct _TTF_Font TTF_Font;
76 typedef struct TTF_Font TTF_Font;
85 BLEND_MODE_NONE = SDL_BLENDMODE_NONE,
90 BLEND_MODE_BLEND = SDL_BLENDMODE_BLEND,
95 BLEND_MODE_ADD = SDL_BLENDMODE_ADD,
100 BLEND_MODE_MOD = SDL_BLENDMODE_MOD
111 PIXEL_FORMAT_INVALID = SDL_PIXELFORMAT_UNKNOWN,
114 PIXEL_FORMAT_ARGB8888 = SDL_PIXELFORMAT_ARGB8888,
117 PIXEL_FORMAT_YV12 = SDL_PIXELFORMAT_YV12,
120 PIXEL_FORMAT_IYUV = SDL_PIXELFORMAT_IYUV,
123 PIXEL_FORMAT_UYVY = SDL_PIXELFORMAT_UYVY,
132 typedef std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> UniquePtr;
133 typedef SDL_Window* RawPtr;
141 typedef SDL_PixelFormat* RawPtr;
150 typedef std::unique_ptr<SDL_Surface, void(*) (SDL_Surface*)> UniquePtr;
151 typedef std::shared_ptr<SDL_Surface> SharedPtr;
152 typedef SDL_Surface* RawPtr;
161 typedef std::shared_ptr<SDL_Texture> SharedPtr;
162 typedef SDL_Texture* RawPtr;
167NOM_EXPORT BlendMode blend_mode(SDL_BlendMode mode);
171NOM_EXPORT SDL_BlendMode SDL_blend_mode(BlendMode mode);
176NOM_EXPORT SDL_Rect SDL_RECT (
const IntRect& rectangle );
183NOM_EXPORT SDL_Rect SDL_RECT (
const Point2i& pos,
const Size2i& size );
188NOM_EXPORT SDL_Point SDL_POINT (
const Point2i& );
193NOM_EXPORT SDL_Color SDL_COLOR (
const Color4i& color );
198NOM_EXPORT
const Color4i pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
204const Color4i alpha_pixel ( uint32 pixel,
const SDL_PixelFormat* fmt );
206NOM_EXPORT
const Color4i pixel ( uint32 pixel, uint32 fmt );
207NOM_EXPORT
const Color4i alpha_pixel ( uint32 pixel, uint32 fmt );
216uint32 RGB (
const Color4i& color,
const SDL_PixelFormat* fmt );
224NOM_EXPORT uint32 RGB (
const Color4i& color, uint32 fmt );
232NOM_EXPORT uint32 RGBA (
const Color4i& color,
const SDL_PixelFormat* fmt );
240NOM_EXPORT uint32 RGBA (
const Color4i& color, uint32 fmt );
249NOM_EXPORT std::string hint(
const std::string& name);
262NOM_EXPORT
bool set_hint(
const std::string& name,
const std::string& value);
264NOM_EXPORT
const std::string PIXEL_FORMAT_NAME ( uint32 format );
273NOM_EXPORT
bool save_png ( SDL_SURFACE::RawPtr,
const std::string& filename );
281NOM_EXPORT
int available_render_driver(
const std::string& driver);
286NOM_EXPORT
void FreeWindow ( SDL_Window* );
289NOM_EXPORT
void FreeRenderTarget ( SDL_Renderer* );
292NOM_EXPORT
void FreeTexture ( SDL_Texture* );
295NOM_EXPORT
void FreeSurface ( SDL_Surface* );
298NOM_EXPORT
void TTF_FreeFont ( TTF_Font* );
305std::ostream& operator <<( std::ostream& os,
const SDL_Point& pos );
309std::ostream& operator <<( std::ostream& os,
const SDL_Rect& rect );
313std::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.