Class: Fidgit::DialogState Abstract
- Defined in:
- lib/fidgit/states/dialog_state.rb
Overview
This class is abstract.
A modal dialog.
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_BACKGROUND_COLOR =
Gosu::Color.rgb(75, 75, 75)
- DEFAULT_BORDER_COLOR =
Gosu::Color.rgb(255, 255, 255)
- DEFAULT_SHADOW_COLOR =
Gosu::Color.rgba(0, 0, 0, 100)
- DEFAULT_SHADOW_OFFSET =
8
Constants inherited from GuiState
Instance Attribute Summary
Attributes inherited from GuiState
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(options = {}) ⇒ DialogState
constructor
A new instance of DialogState.
Methods inherited from GuiState
clear, #clear, #cursor, #distance, #draw_frame, #draw_rect, #file_dialog, #finalize, #flush, #hide, #hide_menu, #menu, #message, #setup, #show, #show_menu, #t, #tool_tip_delay, #unset_mouse_over, #update
Constructor Details
#initialize(options = {}) ⇒ DialogState
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fidgit/states/dialog_state.rb', line 11 def initialize( = {}) # @option options [Gosu::Color] :shadow_color (transparent black) Color of the shadow. # @option options [Gosu::Color] :shadow_offset (8) Distance shadow is offset to bottom and left. # @option options [Gosu::Color] :shadow_full (false) Shadow fills whole screen. Ignores :shadow_offset option if true. = { shadow_color: DEFAULT_SHADOW_COLOR, shadow_offset: DEFAULT_SHADOW_OFFSET, shadow_full: false, }.merge! @shadow_color = [:shadow_color].dup @shadow_offset = [:shadow_offset] @shadow_full = [:shadow_full] super() end |
Instance Method Details
#draw ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fidgit/states/dialog_state.rb', line 28 def draw $window.game_state_manager.previous_game_state.draw # Keep the underlying state being shown. $window.flush if @shadow_full draw_rect 0, 0, $window.width, $window.height, -Float::INFINITY, @shadow_color elsif @shadow_offset > 0 dialog = container[0] draw_rect dialog.x + @shadow_offset, dialog.y + @shadow_offset, dialog.width, dialog.height, -Float::INFINITY, @shadow_color end super end |