diamante 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbff073d4a58c5f80f4f582ff5c711eccdd4bd9be2d5a5e1a6da62738a7e5bcd
4
- data.tar.gz: f798353d5148a8fd176d98d719a3a02e8bf83631946131d5c3e587135c7b72fc
3
+ metadata.gz: f6b43ae1ec66a8f51786fd345c7d621608a4e3620aa5d218d86258fa5290f039
4
+ data.tar.gz: 3418eae92c72e9d50eb69f1c0143c3f071467260f17bb2dde51800e64f2e786a
5
5
  SHA512:
6
- metadata.gz: 5d045ac07553f46c51b4fec2ec7717fff5cccf1c0f973b3396c4664a187232b752336d4825f3c45e5a3146ae91a75d00fdffe86eb7b9399804d8fa22a43d536f
7
- data.tar.gz: ffc74d2c593a10e9581fdb04ea89131ecbc3f57a52a07fb43204512fcb9548015d4accf2c1fb52d0c470c4d1dee51507497a062f77f4a3a82526afd0539e26b8
6
+ metadata.gz: e36fcfd32c5e8a69dd0defabbc48c358a90161253b74428e6ca00476f476ce26874ff0f10accbb193a53ad916620a2195d80127ade727779b5f4b59aedc178b1
7
+ data.tar.gz: 2357d1df863b9828e935bc975409729ab0bf7f207e4aef2b8e144c67e2ae4d7e8ddcf9a4f0a868f650102da42b19c956498ea80dee45a36018ba9fc46d2ca376
data/lib/diamante/game.rb CHANGED
@@ -31,12 +31,12 @@ module Diamante
31
31
 
32
32
  def init
33
33
  ANSI.set_raw_mode
34
- scene1 = Scene::Matrix.new(@config)
35
- scene2 = Scene::Slides.new(@config)
36
- scene3 = Scene::UI.new(@config[:header], scene2)
34
+ scene1 = Scene::Matrix.new(@config[:bg])
35
+ scene2 = Scene::Slides.new(@config[:fg])
36
+ scene3 = Scene::UI.new(@config[:ui], scene2)
37
37
  @scenes = {
38
38
  bg: scene1,
39
- slides: scene2,
39
+ fg: scene2,
40
40
  ui: scene3
41
41
  }
42
42
  end
@@ -47,8 +47,8 @@ module Diamante
47
47
  case key
48
48
  when :up then puts "↑ Arriba"
49
49
  when :down then puts "↓ Abajo"
50
- when :left then @scenes[:slides].prev
51
- when :right then @scenes[:slides].next
50
+ when :left then @scenes[:fg].prev
51
+ when :right then @scenes[:fg].next
52
52
  when :quit then deinit
53
53
  end
54
54
  end
@@ -61,9 +61,8 @@ module Diamante
61
61
  def deinit
62
62
  ANSI.clear_screen
63
63
  ANSI.set_cooked_mode
64
- puts @config[:bye]
64
+ puts @config[:game][:bye]
65
65
  exit 0
66
66
  end
67
67
  end
68
68
  end
69
-
@@ -10,7 +10,8 @@ module Diamante
10
10
  def initialize(config)
11
11
  @config = config # todo: elegible_chars
12
12
  @pastel = Pastel.new
13
- @eligible_chars = "ª\|@·#$~%&/\¿¸^*¨;•:·_-+'.,".chars + ['.', ' ']
13
+ # @eligible_chars = "ª\|@·#$~%&/\¿¸^*¨;•:·_-+'.,".chars + ['.', ' ']
14
+ @matrix_chars = @config[:chars].chars
14
15
  @term = ANSI.new
15
16
  @height = @term.height
16
17
  @width = @term.width
@@ -31,9 +32,9 @@ module Diamante
31
32
 
32
33
  def print_random_char_at(row, col)
33
34
  if rand > 0.3
34
- text = @pastel.green("#{@eligible_chars.sample} ")
35
+ text = @pastel.green("#{@matrix_chars.sample} ")
35
36
  else
36
- text = @pastel.green.bold("#{@eligible_chars.sample} ")
37
+ text = @pastel.green.bold("#{@matrix_chars.sample} ")
37
38
  end
38
39
  ANSI.print_text_at(row + 1, col, text)
39
40
  end
@@ -7,10 +7,10 @@ require_relative "slides"
7
7
  module Diamante
8
8
  module Scene
9
9
  class UI
10
- def initialize(header, slides)
10
+ def initialize(config, slides)
11
11
  @pastel = Pastel.new
12
12
 
13
- @header = header
13
+ @header = config[:header]
14
14
  @slides = slides
15
15
  @term = ANSI.new
16
16
  @height = @term.height
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diamante
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diamante
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz