Sha256: 586653dee811dbb1200c1c93205ca0f6a2c26e637873da5563904c2ea18a4f4d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

require_relative '../lib/ut'
require_relative 'helper'
require 'set'


class Window < Gosu::Window
  attr_accessor :viewport

  def initialize width, height
    super width, height, false
  end

  def draw
    viewport.draw
  end
end

$window = Window.new WINDOW_WIDTH, WINDOW_HEIGHT

@renderer = UT::FontRenderer.new :font_name => "fonts/DejaVuSansMono.ttf", :tile_size => TILE_SIZE
@viewport = UT::Viewport.new :renderer => @renderer, :width => VIEWPORT_WIDTH, :height => VIEWPORT_HEIGHT
@viewport.put_string 0, 0, "Hello World !", Gosu::Color::CYAN
@viewport.put_string 0, 1, "Some unicode chars:", Gosu::Color::GREEN, Gosu::Color::GRAY
%W{☠ ☃ ⚙ ☻ ♞ ☭ ✈ ✟ ✂ ✯}.each_with_index do |c,i|
  @viewport.put_tile i, 2, (UT::Tile.new :glyph => c, :foreground => Gosu::Color.from_hsv(c.ord%360, 1, 1))
end
@viewport.put_string 14, 4, "Long strings get automatically wrapped as block"
@viewport.put_string 13, 7, "or as a line if u want", nil, nil, :line
@viewport.put_string 20, 9, "or not at all", nil, nil, :none

$window.viewport = @viewport
$window.show

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unicodetiles-1.0.0 examples/01_minimal.rb