Module: RbSDL2::Window::State
- Included in:
- RbSDL2::Window
- Defined in:
- lib/rb_sdl2/window/state.rb
Class Method Summary collapse
Instance Method Summary collapse
- #allow_high_dpi? ⇒ Boolean
- #always_on_top=(bool) ⇒ Object
- #always_on_top? ⇒ Boolean
- #bordered=(bool) ⇒ Object
- #borderless? ⇒ Boolean
- #current! ⇒ Object
- #flags ⇒ Object
- #flags?(num) ⇒ Boolean
- #foreign? ⇒ Boolean
- #fullscreen ⇒ Object
- #fullscreen? ⇒ Boolean
- #fullscreen_desktop ⇒ Object
- #fullscreen_desktop? ⇒ Boolean
- #grab=(bool) ⇒ Object
- #grabbed? ⇒ Boolean
- #grabbed_keyboard? ⇒ Boolean
- #grabbed_mouse? ⇒ Boolean
- #hidden? ⇒ Boolean
- #hide ⇒ Object
- #input_focused? ⇒ Boolean
- #input_grabbed? ⇒ Boolean
- #keyboard_grab=(bool) ⇒ Object
- #keyboard_grabbed? ⇒ Boolean
- #maximize ⇒ Object
- #maximized? ⇒ Boolean
- #metal? ⇒ Boolean
- #minimize ⇒ Object
- #minimized? ⇒ Boolean
- #mouse_captured? ⇒ Boolean
- #mouse_focused? ⇒ Boolean
- #mouse_grab=(bool) ⇒ Object
- #mouse_grabbed? ⇒ Boolean
- #opengl? ⇒ Boolean
- #popup_menu? ⇒ Boolean
- #resizable=(bool) ⇒ Object
- #resizable? ⇒ Boolean
- #restore ⇒ Object
- #show ⇒ Object
- #shown? ⇒ Boolean
- #skip_taskbar? ⇒ Boolean
- #tooltip? ⇒ Boolean
- #utility? ⇒ Boolean
- #vulkan? ⇒ Boolean
- #windowed ⇒ Object
Class Method Details
.to_flags(allow_high_dpi: false, always_on_top: false, borderless: false, foreign: false, fullscreen: false, fullscreen_desktop: false, hidden: false, input_focus: false, input_grabbed: false, keyboard_grabbed: false, maximized: false, metal: false, minimized: false, mouse_capture: false, mouse_focus: false, mouse_grabbed: false, opengl: false, popup_menu: false, resizable: false, shown: false, skip_taskbar: false, tooltip: false, utility: false, vulkan: false) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rb_sdl2/window/state.rb', line 31 def to_flags(allow_high_dpi: false, always_on_top: false, borderless: false, foreign: false, fullscreen: false, fullscreen_desktop: false, hidden: false, input_focus: false, input_grabbed: false, keyboard_grabbed: false, maximized: false, metal: false, minimized: false, mouse_capture: false, mouse_focus: false, mouse_grabbed: false, opengl: false, popup_menu: false, resizable: false, shown: false, skip_taskbar: false, tooltip: false, utility: false, vulkan: false) 0 | (allow_high_dpi ? SDL_WINDOW_ALLOW_HIGHDPI : 0) | (always_on_top ? SDL_WINDOW_ALWAYS_ON_TOP : 0) | (borderless ? SDL_WINDOW_BORDERLESS : 0) | (foreign ? SDL_WINDOW_FOREIGN : 0) | (fullscreen ? SDL_WINDOW_FULLSCREEN : 0) | (fullscreen_desktop ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) | (hidden ? SDL_WINDOW_HIDDEN : 0) | (input_focus ? SDL_WINDOW_INPUT_FOCUS : 0) | (input_grabbed ? SDL_WINDOW_INPUT_GRABBED : 0) | (keyboard_grabbed ? SDL_WINDOW_KEYBOARD_GRABBED : 0) | (maximized ? SDL_WINDOW_MAXIMIZED : 0) | ( ? SDL_WINDOW_METAL : 0) | (minimized ? SDL_WINDOW_MINIMIZED : 0) | (mouse_capture ? SDL_WINDOW_MOUSE_CAPTURE : 0) | (mouse_focus ? SDL_WINDOW_MOUSE_FOCUS : 0) | (mouse_grabbed ? SDL_WINDOW_MOUSE_GRABBED : 0) | (opengl ? SDL_WINDOW_OPENGL : 0) | ( ? SDL_WINDOW_POPUP_MENU : 0) | (resizable ? SDL_WINDOW_RESIZABLE : 0) | (shown ? SDL_WINDOW_SHOWN : 0) | ( ? SDL_WINDOW_SKIP_TASKBAR : 0) | (tooltip ? SDL_WINDOW_TOOLTIP : 0) | (utility ? SDL_WINDOW_UTILITY : 0) | (vulkan ? SDL_WINDOW_VULKAN : 0) end |
Instance Method Details
#allow_high_dpi? ⇒ Boolean
65 |
# File 'lib/rb_sdl2/window/state.rb', line 65 def allow_high_dpi? = flags?(SDL_WINDOW_ALLOW_HIGHDPI) |
#always_on_top=(bool) ⇒ Object
67 68 69 |
# File 'lib/rb_sdl2/window/state.rb', line 67 def always_on_top=(bool) ::SDL.SetWindowAlwaysOnTop(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#always_on_top? ⇒ Boolean
71 |
# File 'lib/rb_sdl2/window/state.rb', line 71 def always_on_top? = flags?(SDL_WINDOW_ALWAYS_ON_TOP) |
#bordered=(bool) ⇒ Object
73 74 75 |
# File 'lib/rb_sdl2/window/state.rb', line 73 def bordered=(bool) ::SDL.SetWindowBordered(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#borderless? ⇒ Boolean
77 |
# File 'lib/rb_sdl2/window/state.rb', line 77 def borderless? = flags?(SDL_WINDOW_BORDERLESS) |
#current! ⇒ Object
79 |
# File 'lib/rb_sdl2/window/state.rb', line 79 def current! = ::SDL.RaiseWindow(self); |
#flags ⇒ Object
81 |
# File 'lib/rb_sdl2/window/state.rb', line 81 def flags = ::SDL.GetWindowFlags(self) |
#flags?(num) ⇒ Boolean
83 |
# File 'lib/rb_sdl2/window/state.rb', line 83 def flags?(num) = flags & num != 0 |
#foreign? ⇒ Boolean
85 |
# File 'lib/rb_sdl2/window/state.rb', line 85 def foreign? = flags?(SDL_WINDOW_FOREIGN) |
#fullscreen ⇒ Object
87 88 89 90 91 |
# File 'lib/rb_sdl2/window/state.rb', line 87 def fullscreen err = ::SDL.SetWindowFullscreen(self, ::SDL::WINDOW_FULLSCREEN) raise RbSDL2Error if err < 0 self end |
#fullscreen? ⇒ Boolean
93 |
# File 'lib/rb_sdl2/window/state.rb', line 93 def fullscreen? = flags?(SDL_WINDOW_FULLSCREEN) |
#fullscreen_desktop ⇒ Object
95 96 97 98 99 |
# File 'lib/rb_sdl2/window/state.rb', line 95 def fullscreen_desktop err = ::SDL.SetWindowFullscreen(self, ::SDL::WINDOW_FULLSCREEN_DESKTOP) raise RbSDL2Error if err < 0 self end |
#fullscreen_desktop? ⇒ Boolean
101 |
# File 'lib/rb_sdl2/window/state.rb', line 101 def fullscreen_desktop? = flags?(SDL_WINDOW_FULLSCREEN_DESKTOP) |
#grab=(bool) ⇒ Object
103 104 105 |
# File 'lib/rb_sdl2/window/state.rb', line 103 def grab=(bool) ::SDL.SetWindowGrab(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#grabbed? ⇒ Boolean
107 |
# File 'lib/rb_sdl2/window/state.rb', line 107 def grabbed? = ::SDL.GetWindowGrab(self) == ::SDL::TRUE |
#grabbed_keyboard? ⇒ Boolean
109 |
# File 'lib/rb_sdl2/window/state.rb', line 109 def grabbed_keyboard? = ::SDL.GetWindowKeyboardGrab(self) == ::SDL::TRUE |
#grabbed_mouse? ⇒ Boolean
111 |
# File 'lib/rb_sdl2/window/state.rb', line 111 def grabbed_mouse? = ::SDL.GetWindowMouseGrab(self) == ::SDL::TRUE |
#hidden? ⇒ Boolean
115 |
# File 'lib/rb_sdl2/window/state.rb', line 115 def hidden? = flags?(SDL_WINDOW_HIDDEN) |
#hide ⇒ Object
113 |
# File 'lib/rb_sdl2/window/state.rb', line 113 def hide = ::SDL.HideWindow(self); |
#input_focused? ⇒ Boolean
117 |
# File 'lib/rb_sdl2/window/state.rb', line 117 def input_focused? = flags?(SDL_WINDOW_INPUT_FOCUS) |
#input_grabbed? ⇒ Boolean
119 |
# File 'lib/rb_sdl2/window/state.rb', line 119 def input_grabbed? = flags?(SDL_WINDOW_INPUT_GRABBED) |
#keyboard_grab=(bool) ⇒ Object
121 122 123 |
# File 'lib/rb_sdl2/window/state.rb', line 121 def keyboard_grab=(bool) ::SDL.SetWindowKeyboardGrab(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#keyboard_grabbed? ⇒ Boolean
125 |
# File 'lib/rb_sdl2/window/state.rb', line 125 def keyboard_grabbed? = flags?(SDL_WINDOW_KEYBOARD_GRABBED) |
#maximize ⇒ Object
127 |
# File 'lib/rb_sdl2/window/state.rb', line 127 def maximize = ::SDL.MaximizeWindow(self); |
#maximized? ⇒ Boolean
129 |
# File 'lib/rb_sdl2/window/state.rb', line 129 def maximized? = flags?(SDL_WINDOW_MAXIMIZED) |
#minimize ⇒ Object
133 |
# File 'lib/rb_sdl2/window/state.rb', line 133 def minimize = ::SDL.MinimizeWindow(self); |
#minimized? ⇒ Boolean
135 |
# File 'lib/rb_sdl2/window/state.rb', line 135 def minimized? = flags?(SDL_WINDOW_MINIMIZED) |
#mouse_captured? ⇒ Boolean
137 |
# File 'lib/rb_sdl2/window/state.rb', line 137 def mouse_captured? = flags?(SDL_WINDOW_MOUSE_CAPTURE) |
#mouse_focused? ⇒ Boolean
139 |
# File 'lib/rb_sdl2/window/state.rb', line 139 def mouse_focused? = flags?(SDL_WINDOW_MOUSE_FOCUS) |
#mouse_grab=(bool) ⇒ Object
141 142 143 |
# File 'lib/rb_sdl2/window/state.rb', line 141 def mouse_grab=(bool) ::SDL.SetWindowMouseGrab(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#mouse_grabbed? ⇒ Boolean
145 |
# File 'lib/rb_sdl2/window/state.rb', line 145 def mouse_grabbed? = flags?(SDL_WINDOW_MOUSE_GRABBED) |
#opengl? ⇒ Boolean
147 |
# File 'lib/rb_sdl2/window/state.rb', line 147 def opengl? = flags?(SDL_WINDOW_OPENGL) |
#popup_menu? ⇒ Boolean
149 |
# File 'lib/rb_sdl2/window/state.rb', line 149 def = flags?(SDL_WINDOW_POPUP_MENU) |
#resizable=(bool) ⇒ Object
151 152 153 |
# File 'lib/rb_sdl2/window/state.rb', line 151 def resizable=(bool) ::SDL.SetWindowResizable(self, bool ? ::SDL::TRUE : ::SDL::FALSE) end |
#resizable? ⇒ Boolean
155 |
# File 'lib/rb_sdl2/window/state.rb', line 155 def resizable? = flags?(SDL_WINDOW_RESIZABLE) |
#restore ⇒ Object
157 |
# File 'lib/rb_sdl2/window/state.rb', line 157 def restore = ::SDL.RestoreWindow(self); |
#show ⇒ Object
159 |
# File 'lib/rb_sdl2/window/state.rb', line 159 def show = ::SDL.ShowWindow(self); |
#shown? ⇒ Boolean
161 |
# File 'lib/rb_sdl2/window/state.rb', line 161 def shown? = flags?(SDL_WINDOW_SHOWN) |
#skip_taskbar? ⇒ Boolean
163 |
# File 'lib/rb_sdl2/window/state.rb', line 163 def = flags?(SDL_WINDOW_SKIP_TASKBAR) |
#tooltip? ⇒ Boolean
165 |
# File 'lib/rb_sdl2/window/state.rb', line 165 def tooltip? = flags?(SDL_WINDOW_TOOLTIP) |
#utility? ⇒ Boolean
167 |
# File 'lib/rb_sdl2/window/state.rb', line 167 def utility? = flags?(SDL_WINDOW_UTILITY) |
#vulkan? ⇒ Boolean
169 |
# File 'lib/rb_sdl2/window/state.rb', line 169 def vulkan? = flags?(SDL_WINDOW_VULKAN) |
#windowed ⇒ Object
171 172 173 174 175 |
# File 'lib/rb_sdl2/window/state.rb', line 171 def windowed err = ::SDL.SetWindowFullscreen(self, 0) raise RbSDL2Error if err < 0 self end |