Method: Reight::Index#draw

Defined in:
lib/reight/index.rb

#drawObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/reight/index.rb', line 29

def draw()
  no_stroke

  sp   = sprite
  w, h = sp.w, sp.h
  dec  = pressing? && prev?
  inc  = pressing? && next?
  decy = dec ? 1 : 0
  incy = inc ? 1 : 0

  fill 220
  rect 0,     decy, h, h, 2 if dec
  rect w - h, incy, h, h, 2 if inc

  text_align CENTER, CENTER
  fill 220
  text '<',   0,     decy + 1, h, h
  text '>',   w - h, incy + 1, h, h
  text index, 0,     1,        w, h
  fill 50
  text '<',   0,     decy,     h, h
  text '>',   w - h, incy,     h, h
  text index, 0,     0,        w, h
end