Class: SDL2::Event::Window

Inherits:
SDL2::Event show all
Defined in:
event.c,
event.c

Overview

This class represents window event. This type of event occurs when window state is changed.

Instance Attribute Summary collapse

Attributes inherited from SDL2::Event

#timestamp, #type

Instance Method Summary collapse

Methods inherited from SDL2::Event

enable=, enabled?, poll, #window

Instance Attribute Details

#data1Integer

event dependent data

Returns:

  • (Integer)

#data2Integer

event dependent data

Returns:

  • (Integer)

#eventInteger

event type, one of the following:

  • SDL2::Event::Window::NONE - (never used)
  • SDL2::Event::Window::SHOWN - window has been shown
  • SDL2::Event::Window::HIDDEN - window has been hidden
  • SDL2::Event::Window::EXPOSED - window has been exposed and should be redrawn
  • SDL2::Event::Window::MOVED - window has been moved to data1, data2
  • SDL2::Event::Window::RESIZED - window has been resized to data1xdata2; this is event is always preceded by SIZE_CHANGED
  • SDL2::Event::Window::SIZE_CHANGED - window size has changed, either as a result of an API call or through the system or user changing the window size; this event is followed by RESIZED if the size was changed by an external event, i.e. the user or the window manager
  • SDL2::Event::Window::MINIMIZED - window has been minimized
  • SDL2::Event::Window::MAXIMIZED - window has been maximized
  • SDL2::Event::Window::RESTORED - window has been restored to normal size and position
  • SDL2::Event::Window::ENTER - window has gained mouse focus
  • SDL2::Event::Window::LEAVE - window has lost mouse focus
  • SDL2::Event::Window::FOCUS_GAINED - window has gained keyboard focus
  • SDL2::Event::Window::FOCUS_LOST -window has lost keyboard focus
  • SDL2::Event::Window::CLOSE - the window manager requests that the window be closed

Returns:

  • (Integer)

#window_idInteger

the associate window id

Returns:

  • (Integer)

Instance Method Details

#inspectString

Returns inspection string

Returns:

  • (String)

    inspection string



304
305
306
307
308
309
310
311
# File 'event.c', line 304

static VALUE EvWindow_inspect(VALUE self)
{
    SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
    return rb_sprintf("<%s: type=%u timestamp=%u window_id=%u event=%u data1=%d data2=%d>",
                      rb_obj_classname(self), ev->common.type, ev->common.timestamp,
                      ev->window.windowID, ev->window.event,
                      ev->window.data1, ev->window.data2);
}