Blender V5.0
GHOST_WindowSDL.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#pragma once
11
12#include "GHOST_SystemSDL.hh"
13#include "GHOST_Window.hh"
14
15#include <map>
16
17extern "C" {
18#include "SDL.h"
19}
20
21#if !SDL_VERSION_ATLEAST(2, 0, 0)
22# error "SDL 2.0 or newer is needed to build with Ghost"
23#endif
24
25class GHOST_SystemSDL;
26
28 private:
29 GHOST_SystemSDL *system_;
30 bool valid_setup_;
31 bool invalid_window_;
32
33 SDL_Window *sdl_win_;
34 SDL_Cursor *sdl_custom_cursor_;
35
36 public:
38 const char *title,
41 uint32_t width,
42 uint32_t height,
45 const GHOST_ContextParams &context_params,
46 const bool exclusive = false,
47 const GHOST_IWindow *parent_window = nullptr);
48
50
51 /* SDL specific */
52 SDL_Window *getSDLWindow()
53 {
54 return sdl_win_;
55 }
56
57 GHOST_TSuccess invalidate() override;
58
63
64 void validate()
65 {
66 invalid_window_ = false;
67 }
68
69 bool getValid() const override;
70
71 void getWindowBounds(GHOST_Rect &bounds) const override;
72 void getClientBounds(GHOST_Rect &bounds) const override;
73
74 protected:
80
82
85
86 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
87 const uint8_t *mask,
88 const int size[2],
89 const int hot_spot[2],
90 bool can_invert_color) override;
91
92 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
93
94 void setTitle(const char *title) override;
95
96 std::string getTitle() const override;
97
98 GHOST_TSuccess setClientWidth(uint32_t width) override;
99
100 GHOST_TSuccess setClientHeight(uint32_t height) override;
101
102 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
103
104 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
105
106 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
107
109
110 GHOST_TWindowState getState() const override;
111
113 {
114 // TODO
115 return GHOST_kSuccess;
116 }
117
118 uint16_t getDPIHint() override;
119};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:57
@ GHOST_kSuccess
Definition GHOST_Types.h:57
GHOST_TGrabCursorMode
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
std::string getTitle() const override
GHOST_TWindowState getState() const override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess invalidate() override
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, const GHOST_ContextParams &context_params, const bool exclusive=false, const GHOST_IWindow *parent_window=nullptr)
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setOrder(GHOST_TWindowOrder) override
GHOST_TSuccess setClientHeight(uint32_t height) override
SDL_Window * getSDLWindow()
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
void getClientBounds(GHOST_Rect &bounds) const override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
GHOST_TSuccess setClientWidth(uint32_t width) override
GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_spot[2], bool can_invert_color) override
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
void getWindowBounds(GHOST_Rect &bounds) const override
uint16_t getDPIHint() override
bool getValid() const override
void setTitle(const char *title) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
uint top
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
static int left