Module: SDLRuby::Window::Accessor

Included in:
SDLRuby::Window
Defined in:
lib/SDLRuby/window/accessor.rb

Instance Method Summary collapse

Instance Method Details

#boarder_sizeObject

Raises:



4
5
6
7
8
9
10
# File 'lib/SDLRuby/window/accessor.rb', line 4

def boarder_size
  t, l, b, r = SDL.tmp_value("int", "int", "int", "int")
  err = SDL.SDL_GetWindowBordersSize(self, t, l, b, r)
  raise SDLError if err < 0

  [t.value, l.value, b.value, r.value]
end

#hObject



12
13
14
15
16
# File 'lib/SDLRuby/window/accessor.rb', line 12

def h
  v = SDL.tmp_value("int")
  SDL.SDL_GetWindowSize(self, nil, v)
  v.value
end

#h=(n) ⇒ Object



18
19
20
# File 'lib/SDLRuby/window/accessor.rb', line 18

def h=(n)
  SDL.SDL_SetWindowSize(self, w, n)
end

#icon=(surface) ⇒ Object



22
23
24
# File 'lib/SDLRuby/window/accessor.rb', line 22

def icon=(surface)
  SDL.SDL_SetWindowIcon(self, surface)
end

#maximum_sizeObject



26
27
28
29
30
31
# File 'lib/SDLRuby/window/accessor.rb', line 26

def maximum_size
  w, h = SDL.tmp_value("int", "int")
  SDL.SDL_GetWindowMaximumSize(self, w, h)

  [w.value, h.value]
end

#maximum_size=(wh) ⇒ Object



33
34
35
# File 'lib/SDLRuby/window/accessor.rb', line 33

def maximum_size=(wh)
  SDL.SDL_SetWindowMaximumSize(self, *wh)
end

#minimum_sizeObject



37
38
39
40
41
42
# File 'lib/SDLRuby/window/accessor.rb', line 37

def minimum_size
  w, h = SDL.tmp_value("int", "int")
  SDL.SDL_GetWindowMinimumSize(self, w, h)

  [w.value, h.value]
end

#minimum_size=(wh) ⇒ Object



44
45
46
# File 'lib/SDLRuby/window/accessor.rb', line 44

def minimum_size=(wh)
  SDL.SDL_SetWindowMinimumSize(self, *wh)
end

#opacityObject

Raises:



48
49
50
51
52
53
54
# File 'lib/SDLRuby/window/accessor.rb', line 48

def opacity
  f = SDL.tmp_value("float")
  err = SDL.SDL_GetWindowOpacity(self, f)
  raise SDLError if err < 0

  f.value
end

#opacity=(f) ⇒ Object

Raises:



56
57
58
59
# File 'lib/SDLRuby/window/accessor.rb', line 56

def opacity=(f)
  err = SDL.SDL_SetWindowOpacity(self, f)
  raise SDLError if err < 0
end

#posObject



61
62
63
64
65
# File 'lib/SDLRuby/window/accessor.rb', line 61

def pos
  vx, vy = SDL.tmp_value("int", "int")
  SDL.SDL_GetWindowPosition(self, vx, vy)
  [vx.value, vy.value]
end

#pos=(xy) ⇒ Object



67
68
69
# File 'lib/SDLRuby/window/accessor.rb', line 67

def pos=(xy)
  SDL.SDL_SetWindowPosition(self, *xy)
end

#sizeObject



71
72
73
74
75
# File 'lib/SDLRuby/window/accessor.rb', line 71

def size
  vw, vh = SDL.tmp_value("int", "int")
  SDL.SDL_GetWindowSize(self, vw, vh)
  [vw.value, vh.value]
end

#size=(wh) ⇒ Object



77
78
79
# File 'lib/SDLRuby/window/accessor.rb', line 77

def size=(wh)
  SDL.SDL_SetWindowSize(self, *wh)
end

#size_in_pixelsObject



81
82
83
84
85
86
# File 'lib/SDLRuby/window/accessor.rb', line 81

def size_in_pixels
  vw, vh = SDL.tmp_value("int", "int")
  SDL.SDL_GetWindowSizeInPixels(self, vw, vh)

  [vw.value, vh.value]
end

#titleObject



88
# File 'lib/SDLRuby/window/accessor.rb', line 88

def title = SDL.SDL_GetWindowTitle(self).to_s.force_encoding("UTF-8")

#title=(s) ⇒ Object



90
91
92
# File 'lib/SDLRuby/window/accessor.rb', line 90

def title=(s)
  SDL.SDL_SetWindowTitle(self, s.encode("UTF-8"))
end

#wObject



94
95
96
97
98
# File 'lib/SDLRuby/window/accessor.rb', line 94

def w
  v = SDL.tmp_value("int")
  SDL.SDL_GetWindowSize(self, v, nil)
  v.value
end

#w=(n) ⇒ Object



100
101
102
# File 'lib/SDLRuby/window/accessor.rb', line 100

def w=(n)
  SDL.SDL_SetWindowSize(self, n, h)
end

#xObject



104
105
106
107
108
# File 'lib/SDLRuby/window/accessor.rb', line 104

def x
  v = SDL.tmp_value("int")
  SDL.SDL_GetWindowPosition(self, v, nil)
  v.value
end

#x=(n) ⇒ Object



110
111
112
# File 'lib/SDLRuby/window/accessor.rb', line 110

def x=(n)
  SDL.SDL_SetWindowPosition(self, n, y)
end

#yObject



114
115
116
117
118
# File 'lib/SDLRuby/window/accessor.rb', line 114

def y
  v = SDL.tmp_value("int")
  SDL.SDL_GetWindowPosition(self, nil, v)
  v.value
end

#y=(n) ⇒ Object



120
121
122
# File 'lib/SDLRuby/window/accessor.rb', line 120

def y=(n)
  SDL.SDL_SetWindowPosition(self, x, n)
end