Blender  V3.3
GHOST_WindowSDL.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 #pragma once
9 
10 #include "GHOST_SystemSDL.h"
11 #include "GHOST_Window.h"
12 
13 #include <map>
14 
15 extern "C" {
16 #include "SDL.h"
17 }
18 
19 #if !SDL_VERSION_ATLEAST(2, 0, 0)
20 # error "SDL 2.0 or newer is needed to build with Ghost"
21 #endif
22 
23 class GHOST_SystemSDL;
24 
25 class GHOST_WindowSDL : public GHOST_Window {
26  private:
27  GHOST_SystemSDL *m_system;
28  bool m_valid_setup;
29  bool m_invalid_window;
30 
31  SDL_Window *m_sdl_win;
32  SDL_Cursor *m_sdl_custom_cursor;
33 
34  public:
36  const char *title,
37  int32_t left,
38  int32_t top,
43  const bool stereoVisual = false,
44  const bool exclusive = false,
45  const GHOST_IWindow *parentWindow = NULL);
46 
48 
49  /* SDL specific */
50  SDL_Window *getSDLWindow()
51  {
52  return m_sdl_win;
53  }
54 
56 
62  void validate()
63  {
64  m_invalid_window = false;
65  }
66 
67  bool getValid() const;
68 
69  void getWindowBounds(GHOST_Rect &bounds) const;
70  void getClientBounds(GHOST_Rect &bounds) const;
71 
72  protected:
78 
80 
83 
85  uint8_t *mask,
86  int sizex,
87  int sizey,
88  int hotX,
89  int hotY,
90  bool canInvertColor);
91 
93 
94  void setTitle(const char *title);
95 
96  std::string getTitle() const;
97 
99 
101 
103 
104  void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
105 
106  void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
107 
109 
111 
113  {
114  // TODO
115  return GHOST_kSuccess;
116  }
117 
118  // TODO
120  {
121  return GHOST_kFailure;
122  }
123 
125  {
126  return GHOST_kFailure;
127  }
128 
130 };
GHOST_TWindowState
Definition: GHOST_Types.h:129
GHOST_TStandardCursor
Definition: GHOST_Types.h:214
GHOST_TDrawingContextType
Definition: GHOST_Types.h:148
@ GHOST_kDrawingContextTypeNone
Definition: GHOST_Types.h:149
GHOST_TWindowOrder
Definition: GHOST_Types.h:146
GHOST_TSuccess
Definition: GHOST_Types.h:74
@ GHOST_kFailure
Definition: GHOST_Types.h:74
@ GHOST_kSuccess
Definition: GHOST_Types.h:74
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:404
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
void setTitle(const char *title)
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
bool getValid() const
GHOST_TSuccess setWindowCursorVisibility(bool visible)
GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape)
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)
std::string getTitle() const
GHOST_TSuccess invalidate(void)
GHOST_TWindowState getState() const
void getClientBounds(GHOST_Rect &bounds) const
GHOST_TSuccess setClientWidth(uint32_t width)
GHOST_WindowSDL(GHOST_SystemSDL *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type=GHOST_kDrawingContextTypeNone, const bool stereoVisual=false, const bool exclusive=false, const GHOST_IWindow *parentWindow=NULL)
GHOST_TSuccess setState(GHOST_TWindowState state)
SDL_Window * getSDLWindow()
GHOST_TSuccess endFullScreen() const
void getWindowBounds(GHOST_Rect &bounds) const
GHOST_TSuccess setOrder(GHOST_TWindowOrder)
GHOST_TSuccess setClientHeight(uint32_t height)
GHOST_TSuccess beginFullScreen() const
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode)
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height)
const int state
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static int left
unsigned short uint16_t
Definition: stdint.h:79
unsigned int uint32_t
Definition: stdint.h:80
signed int int32_t
Definition: stdint.h:77
unsigned char uint8_t
Definition: stdint.h:78