29#ifndef NOMLIB_GUI_ROCKET_SDL2_RENDER_INTERFACE_HPP
30#define NOMLIB_GUI_ROCKET_SDL2_RENDER_INTERFACE_HPP
34#include <Rocket/Core/Core.h>
35#include <Rocket/Core/RenderInterface.h>
37#include "nomlib/config.hpp"
39#if defined(NOM_PLATFORM_WINDOWS)
40 #define NOM_API_EXPORT __stdcall
42 #define NOM_API_EXPORT
49typedef void (NOM_API_EXPORT* glUseProgramObjectARB_func) (
unsigned int);
62class RocketSDL2RenderInterface:
public Rocket::Core::RenderInterface
80 static bool gl_init(
int width,
int height );
84 virtual ~RocketSDL2RenderInterface();
94 int* indices,
int num_indices,
95 Rocket::Core::TextureHandle texture_handle,
96 const Rocket::Core::Vector2f& translation);
109 virtual bool LoadTexture(Rocket::Core::TextureHandle& texture_handle, Rocket::Core::Vector2i& texture_dimensions,
const Rocket::Core::String& source);
111 virtual bool GenerateTexture(Rocket::Core::TextureHandle& texture_handle,
const Rocket::Core::byte* source,
const Rocket::Core::Vector2i& source_dimensions);
127 static priv::glUseProgramObjectARB_func
ctx_;
static bool gl_init(int width, int height)
Initialize OpenGL with the necessary settings for libRocket and SDL2 to be all friendly.
virtual void RenderGeometry(Rocket::Core::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rocket::Core::TextureHandle texture_handle, const Rocket::Core::Vector2f &translation)
Called by Rocket when it wants to render geometry that it does not wish to optimise.
virtual void SetScissorRegion(int x, int y, int width, int height)
Called by Rocket when it wants to change the scissor region.
static priv::glUseProgramObjectARB_func ctx_
Shader context function pointer.
virtual void Release()
Implements Rocket::Core::SystemInterface::Release.
virtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle)
Called by Rocket when a loaded texture is no longer required.
RenderWindow * window_
nomlib interface bridge between SDL2 and libRocket
virtual bool GenerateTexture(Rocket::Core::TextureHandle &texture_handle, const Rocket::Core::byte *source, const Rocket::Core::Vector2i &source_dimensions)
Called by Rocket when a texture is required to be built from an internally-generated sequence of pixe...
virtual bool LoadTexture(Rocket::Core::TextureHandle &texture_handle, Rocket::Core::Vector2i &texture_dimensions, const Rocket::Core::String &source)
Called by Rocket when a texture is required by the library.
virtual void EnableScissorRegion(bool enable)
Called by Rocket when it wants to enable or disable scissoring to clip content.