Class: GamesAndRpgParadise::GUI::UniversalWidgets::Gamebook

Inherits:
Base
  • Object
show all
Includes:
UniversalWidgets::BaseModule
Defined in:
lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb

Overview

GamesAndRpgParadise::GUI::UniversalWidgets::Gamebook

Constant Summary collapse

TITLE =
#

TITLE

#
'Gamebook'
WIDTH =
#

WIDTH

#
'42% or minimum 480px'
HEIGHT =
#

HEIGHT

#
'30% or minimum 300px'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:hack_20
LARGER_FONT =
#

LARGER_FONT

#
:hack_24
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_16

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ Gamebook

#

initialize

#


60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 60

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  super(:vertical) if use_gtk3?
  determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset().
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

GamesAndRpgParadise::GUI::UniversalWidgets::Gamebook[]

#


186
187
188
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 186

def self.[](i = ARGV)
  new(i)
end

.run(i = ARGV) ⇒ Object

#

GamesAndRpgParadise::GUI::Gtk::Gamebook.run

#


171
172
173
174
175
176
177
178
179
180
181
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 171

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::GamesAndRpgParadise::GUI::Gtk::Gamebook.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size
  r.automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


119
120
121
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 119

def border_size?
  2
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 135

def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox
  outer_vbox.minimal(
    return_textview_holding_the_corresponding_content_of_the_gamebook_subpage
  )

  window = create_window_or_runner(nil, width?, height?, title?)
  window << outer_vbox

  properly_prepare_this_window(window,
    {
      title:       title?,
      font:        font?,
      width:       width?,
      height:      height?,
      padding:     padding?,
      border_size: border_size?
    }
  )
  window.show_all
  window.top_left
  run_main
end

#create_the_skeletonObject Also known as: create_skeleton

#

create_skeleton (create tag, skeleton tag)

#


106
107
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 106

def create_the_skeleton
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


112
113
114
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 112

def padding?
  0
end

#resetObject

#

reset (reset tag)

#


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 77

def reset
  super() if respond_to?(:super)
  reset_the_base_module
  reset_the_internal_variables
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
  if use_gtk3?
    use_gtk_paradise_project_css_file
  end  
  infer_the_size_automatically
end

#return_textview_holding_the_corresponding_content_of_the_gamebook_subpageObject

#

return_textview_holding_the_corresponding_content_of_the_gamebook_subpage

#


126
127
128
129
130
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 126

def return_textview_holding_the_corresponding_content_of_the_gamebook_subpage
  _ = create_textview
  _.pad8px
  return _
end

#runObject

#

run (run tag)

#


164
165
166
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 164

def run
  run_super
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


99
100
101
# File 'lib/games_and_rpg_paradise/gui/universal_widgets/gamebook/gamebook.rb', line 99

def smaller_font?
  SMALLER_FONT
end