Module: LiteRGSS::Text::Util Deprecated

Defined in:
scripts/00700 Ajout_PSDK/00300 Text__Util.rb

Overview

Deprecated.

DO NOT FUCKING USE THIS. Use SpriteStack instead.

Utility module to manage text easly in user interfaces.

Constant Summary collapse

DEFAULT_OUTLINE_SIZE =

Default outlinesize, nil gives a 0 and keep shadow processing, 0 or more disable shadow processing

nil
FOY =

Offset induced by the Font

2

Instance Method Summary collapse

Instance Method Details

#add_text(x, y, width, height, str, align = 0, outlinesize = DEFAULT_OUTLINE_SIZE, type: Text) ⇒ Text

Add a text inside the window, the offset x/y will be adjusted

Parameters:

  • x (Integer)

    the x coordinate of the text surface

  • y (Integer)

    the y coordinate of the text surface

  • width (Integer)

    the width of the text surface

  • height (Integer)

    the height of the text surface

  • str (String)

    the text shown by this object

  • align (0, 1, 2) (defaults to: 0)

    the align of the text in its surface (best effort => no resize), 0 = left, 1 = center, 2 = right

  • outlinesize (Integer, nil) (defaults to: DEFAULT_OUTLINE_SIZE)

    the size of the text outline

  • type (Class) (defaults to: Text)

    the type of text

Returns:

  • (Text)

    the text object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 39

def add_text(x, y, width, height, str, align = 0, outlinesize = DEFAULT_OUTLINE_SIZE, type: Text)
  log_error('add_text from Text::Util is deprecated')
  if @window and @window.viewport == @text_viewport
    x += (@ox + @window.x)
    y += (@oy + @window.y)
  end
  # voir pout y - FOY
  text = type.new(@font_id, @text_viewport, x, y - FOY, width, height, str.to_s, align, outlinesize)
  text.z = @window ? @window.z + 1 : @text_z
  text.draw_shadow = outlinesize.nil?
  @texts << text
  return text
end

#init_text(font_id = 0, viewport = nil, z = 1000)

Initialize the texts

Parameters:

  • font_id (Integer) (defaults to: 0)

    the default font id of the texts

  • viewport (Viewport, nil) (defaults to: nil)

    the viewport



22
23
24
25
26
27
28
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 22

def init_text(font_id = 0, viewport = nil, z = 1000)
  log_error('init_text is deprecated')
  @texts = [] unless @texts.class == Array
  @text_viewport = viewport
  @font_id = font_id
  @text_z = z
end

#text_dispose

Dispose the texts



53
54
55
56
57
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 53

def text_dispose
  log_error('text_dispose is deprecated')
  @texts.each { |text| text.dispose unless text.disposed? }
  @texts.clear
end

#text_each

Yield a block on each undisposed text



59
60
61
62
63
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 59

def text_each
  log_error('text_each is deprecated')
  return unless block_given?
  @texts.each { |text| yield(text) unless text.disposed? }
end

#text_viewportViewport

Returns the text viewport

Returns:



12
13
14
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 12

def text_viewport
  return @text_viewport
end

#text_viewport=(v)

Change the text viewport



16
17
18
# File 'scripts/00700 Ajout_PSDK/00300 Text__Util.rb', line 16

def text_viewport=(v)
  @text_viewport = v if v.is_a?(Viewport)
end