Class: GamesAndRpgParadise::HelloWorld

Inherits:
Gosu::Window show all
Includes:
Colours
Defined in:
lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb

Overview

GamesAndRpgParadise::HelloWorld

Constant Summary collapse

WIDTH =
#

WIDTH

#
800
HEIGHT =
#

HEIGHT

#
600
TITLE =
#

TITLE

#
'Hello World!'

Constants included from Colours

Colours::WHITE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Colours

#brown, #cfile, #convert_colour, convert_colour, #fancy, #normal, #pink, #red, #yel

Methods inherited from Gosu::Window

#gosu_button_down?, #image, #image10?, #image1?, #image2?, #image3?, #image4?, #image5?, #image6?, #image7?, #image8?, #image9?, #on_left_arrow_pressed?, #on_right_arrow_pressed?, #q_means_quit, #set_font, #set_title, #sqrt, #tab_key?, #write_this_text

Constructor Details

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

#

initialize

#


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 43

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  super(WIDTH, HEIGHT)
  set_title(TITLE)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

GamesAndRpgParadise::HelloWorld[]

#


111
112
113
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 111

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

Instance Method Details

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


77
78
79
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 77

def commandline_arguments?
  @commandline_arguments
end

#drawObject

#

draw

#


91
92
93
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 91

def draw
  @font.red('Hello world!', 50, 10, 0, 1, 1)
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


84
85
86
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 84

def first_argument?
  @commandline_arguments.first
end

#resetObject

#

reset (reset tag)

#


59
60
61
62
63
64
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 59

def reset
  # ======================================================================= #
  # === @font
  # ======================================================================= #
  @font = set_font(:hack_25)
end

#runObject

#

run (run tag)

#


105
106
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 105

def run
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


69
70
71
72
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 69

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end

#updateObject

#

update

#


98
99
100
# File 'lib/games_and_rpg_paradise/games/hello_world/gosu/hello_world.rb', line 98

def update
  exit_on_q
end