Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InexorRenderHandler.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "include/cef_base.h" // for CefRect, CefRefPtr, IMPLEMEN...
4 #include "include/cef_browser.h"
5 #include "include/cef_render_handler.h" // for CefRenderHandler, CefRenderH...
6 #include "include/wrapper/cef_helpers.h"
7 #include "inexor/io/Logging.hpp"
8 
9 class CefBrowser;
10 
11 namespace inexor {
12 namespace ui {
13 
14 class InexorRenderHandler : public CefRenderHandler {
15  public:
16  InexorRenderHandler(bool transparent, int x, int y, int width, int height);
17  ~InexorRenderHandler() override;
18 
19  // Initialize the OpenGL environment.
20  void Initialize();
21 
22  // Clean up the OpenGL environment.
23  void Cleanup();
24 
25  // Forwarded from CefRenderHandler callbacks.
26  void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) override;
27 
28  void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override;
29 
30  bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) override;
31 
32  bool SetViewRect(int view_x, int view_y, int view_width, int view_height);
33 
34  void OnPaint(CefRefPtr<CefBrowser> browser,
35  CefRenderHandler::PaintElementType type,
36  const CefRenderHandler::RectList& dirtyRects,
37  const void* buffer, int width, int height) override;
38 
39  bool IsTransparent() { return transparent; }
40 
41  int GetViewX() { return view_x; }
42  int GetViewY() { return view_y; }
43  int GetViewWidth() { return view_width; }
44  int GetViewHeight() { return view_height; }
45 
46  const CefRect& PopupRect() const { return popup_rect; }
47  const CefRect& OriginalPopupRect() const { return original_popup_rect; }
48 
49  CefRect GetPopupRectInWebView(const CefRect& original_rect);
50  void ClearPopupRects();
51 
52  bool IsInitialized() { return initialized; };
53  unsigned int GetTextureId() { return texture_id; };
54 
55  private:
56  const bool transparent;
59  unsigned int texture_id;
60  int view_x;
61  int view_y;
65  int _view_x;
66  int _view_y;
69  CefRect popup_rect;
71 
72  // Provides atomic refcounting implementation.
74 
75 };
76 
77 }
78 }
int view_y
Definition: InexorRenderHandler.hpp:61
int _view_width
Definition: InexorRenderHandler.hpp:67
GLuint GLuint buffer
Definition: glexts.hpp:412
bool texture_initialized
Definition: InexorRenderHandler.hpp:58
GLenum GLsizei GLsizei height
Definition: glexts.hpp:291
const CefRect & PopupRect() const
Definition: InexorRenderHandler.hpp:46
int GetViewWidth()
Definition: InexorRenderHandler.hpp:43
GLenum GLsizei width
Definition: glexts.hpp:291
bool _view_change_deferred
Definition: InexorRenderHandler.hpp:64
int GetViewX()
Definition: InexorRenderHandler.hpp:41
Definition: InexorRenderHandler.hpp:14
IMPLEMENT_REFCOUNTING(InexorRenderHandler)
const CefRect & OriginalPopupRect() const
Definition: InexorRenderHandler.hpp:47
const bool transparent
Definition: InexorRenderHandler.hpp:53
unsigned int GetTextureId()
Definition: InexorRenderHandler.hpp:53
bool initialized
Definition: InexorRenderHandler.hpp:57
Logging stuff including the ingame console logging functionality.
int GetViewHeight()
Definition: InexorRenderHandler.hpp:44
void Cleanup()
Definition: InexorRenderHandler.cpp:87
void OnPopupShow(CefRefPtr< CefBrowser > browser, bool show) override
Definition: InexorRenderHandler.cpp:94
void ClearPopupRects()
Definition: InexorRenderHandler.cpp:131
void OnPaint(CefRefPtr< CefBrowser > browser, CefRenderHandler::PaintElementType type, const CefRenderHandler::RectList &dirtyRects, const void *buffer, int width, int height) override
Definition: InexorRenderHandler.cpp:171
int _view_height
Definition: InexorRenderHandler.hpp:68
CefRect GetPopupRectInWebView(const CefRect &original_rect)
Definition: InexorRenderHandler.cpp:110
int view_x
Definition: InexorRenderHandler.hpp:60
bool GetViewRect(CefRefPtr< CefBrowser > browser, CefRect &rect) override
Definition: InexorRenderHandler.cpp:137
bool SetViewRect(int view_x, int view_y, int view_width, int view_height)
Definition: InexorRenderHandler.cpp:144
bool IsTransparent()
Definition: InexorRenderHandler.hpp:39
~InexorRenderHandler() override
Definition: InexorRenderHandler.cpp:49
CefRect popup_rect
Definition: InexorRenderHandler.hpp:69
void OnPopupSize(CefRefPtr< CefBrowser > browser, const CefRect &rect) override
Definition: InexorRenderHandler.cpp:102
unsigned int texture_id
Definition: InexorRenderHandler.hpp:59
int view_width
Definition: InexorRenderHandler.hpp:62
InexorRenderHandler(bool transparent, int x, int y, int width, int height)
Definition: InexorRenderHandler.cpp:32
void Initialize()
Definition: InexorRenderHandler.cpp:54
int _view_x
Definition: InexorRenderHandler.hpp:65
int GetViewY()
Definition: InexorRenderHandler.hpp:42
int _view_y
Definition: InexorRenderHandler.hpp:66
bool IsInitialized()
Definition: InexorRenderHandler.hpp:52
int view_height
Definition: InexorRenderHandler.hpp:63
CefRect original_popup_rect
Definition: InexorRenderHandler.hpp:70