Sha256: 3f4613aa7fcdd1679679776b56c0c3c83424d6c13e43614a7ec1650855442641
Contents?: true
Size: 968 Bytes
Versions: 2
Compression:
Stored size: 968 Bytes
Contents
module CyberarmEngine class Label < Element def initialize(text, options = {}, block = nil) super(options, block) @text = Text.new(text, font: @options[:font], z: @z, color: @options[:color], size: @options[:text_size], shadow: @options[:text_shadow]) return self end def render @text.draw end def clicked_left_mouse_button(sender, x, y) @block.call(self) if @block end def recalculate @style.width = @text.width.round @style.height= @text.height.round @text.x = @style.border_thickness_left + @style.padding_left + @x @text.y = @style.border_thickness_top + @style.padding_top + @y @text.z = @z + 3 update_background end def value @text.text end def value=(value) @text.text = value old_width, old_height = width, height recalculate root.recalculate if old_width != width || old_height != height end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cyberarm_engine-0.8.1 | lib/cyberarm_engine/ui/label.rb |
cyberarm_engine-0.8.0 | lib/cyberarm_engine/ui/label.rb |