Class: Core::GUI::ContextMenu

Inherits:
Element show all
Defined in:
lib/gui/context_menu.rb

Overview

Small menu available by rightclicking on the map

Instance Attribute Summary

Attributes inherited from Element

#h, #w, #x, #xoff, #y, #yoff, #zoff

Instance Method Summary collapse

Methods inherited from Element

#remove?

Constructor Details

#initialize(x, y, obj = nil) ⇒ ContextMenu

Returns a new instance of ContextMenu.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gui/context_menu.rb', line 6

def initialize(x, y, obj=nil)
  super(x, y, 128, items(obj) * 24)
  @zoff = 10000
  if @x + @w > 1024
    @x = 1024 - @w
  end
  @buttons = {}
  setup_defaults(obj)
  @buttons.each_value { |but|
    but.zoff = @zoff
  }
end

Instance Method Details

#drawObject



24
25
26
27
28
# File 'lib/gui/context_menu.rb', line 24

def draw
  @buttons.each_value { |but|
    but.draw
  }
end

#updateObject



18
19
20
21
22
23
# File 'lib/gui/context_menu.rb', line 18

def update
  super
  @buttons.each_value { |but|
    but.update
  }
end