module RbSDL2::Cursor

Public Class Methods

color_cursor(...) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 6
  def color_cursor(...) = ColorCursor.new(...)

  def current=(cursor)
    ::SDL2.SDL_SetCursor(cursor)
  end

  def current?(cursor)
    ::SDL2.SDL_GetCursor == cursor.to_ptr
  end

  require_relative 'cursor/default_cursor'
  def default_cursor = DefaultCursor.instance

  def hide = ::SDL2.SDL_ShowCursor(::SDL2::SDL_DISABLE)

  def show = ::SDL2.SDL_ShowCursor(::SDL2::SDL_ENABLE)

  def shown? = ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE

  def update
    self.current = nil
    self
  end
end

require 'forwardable'
extend SingleForwardable
require_relative 'cursor/system_cursor'
def_single_delegators :SystemCursor,
                      *%i(arrow_cursor crosshair_cursor hand_cursor i_beam_cursor no_cursor
                      size_all_cursor size_ne_sw_cursor size_ns_cursor size_nw_se_cursor
                      size_we_cursor wait_cursor wait_arrow_cursor)
current=(cursor) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 8
def current=(cursor)
  ::SDL2.SDL_SetCursor(cursor)
end
current?(cursor) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 12
def current?(cursor)
  ::SDL2.SDL_GetCursor == cursor.to_ptr
end
default_cursor(= DefaultCursor.instance) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 17
    def default_cursor = DefaultCursor.instance

    def hide = ::SDL2.SDL_ShowCursor(::SDL2::SDL_DISABLE)

    def show = ::SDL2.SDL_ShowCursor(::SDL2::SDL_ENABLE)

    def shown? = ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE

    def update
      self.current = nil
      self
    end
  end

  require 'forwardable'
  extend SingleForwardable
  require_relative 'cursor/system_cursor'
  def_single_delegators :SystemCursor,
                        *%i(arrow_cursor crosshair_cursor hand_cursor i_beam_cursor no_cursor
                        size_all_cursor size_ne_sw_cursor size_ns_cursor size_nw_se_cursor
                        size_we_cursor wait_cursor wait_arrow_cursor)
end
hide(= ::SDL2.SDL_ShowCursor(::SDL2::SDL_DISABLE)) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 19
      def hide = ::SDL2.SDL_ShowCursor(::SDL2::SDL_DISABLE)

      def show = ::SDL2.SDL_ShowCursor(::SDL2::SDL_ENABLE)

      def shown? = ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE

      def update
        self.current = nil
        self
      end
    end

    require 'forwardable'
    extend SingleForwardable
    require_relative 'cursor/system_cursor'
    def_single_delegators :SystemCursor,
                          *%i(arrow_cursor crosshair_cursor hand_cursor i_beam_cursor no_cursor
                          size_all_cursor size_ne_sw_cursor size_ns_cursor size_nw_se_cursor
                          size_we_cursor wait_cursor wait_arrow_cursor)
  end
end
show(= ::SDL2.SDL_ShowCursor(::SDL2::SDL_ENABLE)) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 21
    def show = ::SDL2.SDL_ShowCursor(::SDL2::SDL_ENABLE)

    def shown? = ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE

    def update
      self.current = nil
      self
    end
  end

  require 'forwardable'
  extend SingleForwardable
  require_relative 'cursor/system_cursor'
  def_single_delegators :SystemCursor,
                        *%i(arrow_cursor crosshair_cursor hand_cursor i_beam_cursor no_cursor
                        size_all_cursor size_ne_sw_cursor size_ns_cursor size_nw_se_cursor
                        size_we_cursor wait_cursor wait_arrow_cursor)
end
shown?(= ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE) click to toggle source
# File lib/rb_sdl2/cursor.rb, line 23
  def shown? = ::SDL2.SDL_ShowCursor(::SDL2::SDL_QUERY) == ::SDL2::SDL_ENABLE

  def update
    self.current = nil
    self
  end
end
update() click to toggle source
# File lib/rb_sdl2/cursor.rb, line 25
def update
  self.current = nil
  self
end