Class: GamesAndRpgParadise::GUI::Memory::GameEnded

Inherits:
Object
  • Object
show all
Includes:
GamesAndRpgParadise::GUI::Memory
Defined in:
lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb

Overview

GamesAndRpgParadise::GUI::Memory::GameEnded

Constant Summary

Constants included from GamesAndRpgParadise::GUI::Memory

GOSU_USE_THIS_FONT

Constants included from Memory

Memory::ARRAY_IMAGES_FOR_THE_MEMORY_GAME, Memory::FILE_BLACK_BACKGROUND, Memory::FILE_CAMEL_HEAD, Memory::FILE_CARD_RANDOM, Memory::FILE_DONKEY, Memory::FILE_FROG, Memory::FILE_LION, Memory::FILE_NEW_GAME, Memory::FILE_OCTOPUS, Memory::FILE_SAD_CRAB, Memory::FILE_SHEEP, Memory::FILE_SNAIL, Memory::FILE_SPERM_WHALE, Memory::FILE_UNICORN, Memory::GAME_MESSAGE_YOU_WON, Memory::IMAGES_DIRECTORY, Memory::SCREENHEIGHT, Memory::SCREENWIDTH, Memory::TITLE, Memory::USE_THIS_FONT_FAMILY

Instance Method Summary collapse

Methods included from GamesAndRpgParadise::GUI::Memory

available_images?, current_game=, current_game?, load_images

Constructor Details

#initialize(parent) ⇒ GameEnded

#

initialize

#


27
28
29
30
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 27

def initialize(parent)
  @parent = parent
  reset
end

Instance Method Details

#button_down(id) ⇒ Object

#

button_down

#


85
86
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 85

def button_down(id)
end

#button_up(id) ⇒ Object

#

button_up

#


91
92
93
94
95
96
97
98
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 91

def button_up(id)
  if (@parent.mouse_x > 345 &&
      @parent.mouse_x < 345+128 &&
      @parent.mouse_y > 220 &&
      @parent.mouse_y < 220+28)
    ::GamesAndRpgParadise::GUI::Memory.current_game = PlayGame.new
  end
end

#drawObject

#

draw

#


49
50
51
52
53
54
55
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 49

def draw
  show_the_you_won_message
  # ======================================================================= #
  # Display the play-again button as well.
  # ======================================================================= #
  @button_play_again.draw(345, 220, 1)
end

#resetObject

#

reset

#


35
36
37
38
39
40
41
42
43
44
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 35

def reset
  # ======================================================================= #
  # === @font
  # ======================================================================= #
  @font = GOSU_USE_THIS_FONT
  # ======================================================================= #
  # === @button_play_again
  # ======================================================================= #
  @button_play_again = ::GamesAndRpgParadise::GUI::Memory.available_images?['button_play_again']
end

#show_the_you_won_messageObject

#

show_the_you_won_message

#


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 60

def show_the_you_won_message
  # ======================================================================= #
  # Draw the "you won the game" message next.
  # The parameters to draw_text() are x, y, z and scale.
  # ======================================================================= #
  @font.text(
    GAME_MESSAGE_YOU_WON,
    80,    # x
    110,   # y
      1,   # z
      1.5, # scale-x
      1.5, # scale-y
     :steelblue # colour to use here.
  )
end

#updateObject

#

update

#


79
80
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game_ended.rb', line 79

def update
end