rubocop で refactoring
add charactor_preset
CustomMenu add require custom_menu
Replace edge to ridge_line
Window BackgroundImage

diff --git a/lib/vortex/window.rb b/lib/vortex/window.rb
index 629f4d3..6010d82 100644
--- a/lib/vortex/window.rb
+++ b/lib/vortex/window.rb
@@ -6,6 +6,10 @@

 require_relative "config"

+Stylet.configure do |config|
+  config.production_keys = [SDL::Key::K0]
+end
+
 module Vortex
   class GuidlinePalette
     include StaticRecord
@@ -23,23 +27,12 @@ class GuidlinePalette
   Stylet::Palette.update(GuidlinePalette.inject({}){|a, e|a.merge(e.key => e.rgb)})

   Stylet::Palette.update(
-    # "yellow" => [255, 255,   0],
-    # "blue"   => [  0,   0, 255],
-    # "orange" => [255, 127,   0],
-    # "green"  => [127, 255,   0],
-    # "purple" => [255,   0, 255],
-    # "cyan"   => [  0, 255, 255],
-    # "red"    => [255,   0,   0],
-
-    :x      => [8*20, 8*20, 8*20], # お邪魔ブロック
-
-    :*      => [160, 127, 127], # 特別な色
-    # フィールドの枠などの色
-    :flash => [255, 255, 255],
-    :frame => [255, 255, 255],
-    :bg    => [  0,   0,   0],
-    :font  => [ 80, 160, 255],
-    :edge  => [8*28, 8*28, 8*28],
+    :x     => [8*20, 8*20, 8*20], # お邪魔ブロック
+    :*     => [160, 127, 127],    # 特別な色
+    :flash => [255, 255, 255],    # 白く光るときの色
+    :frame => [255, 255, 255],    # 枠
+    :font  => [ 80, 160, 255],    # フォント
+    :edge  => [8*28, 8*28, 8*28], # 稜線

     :debug_color => [128, 0, 0],
     :background_line => [48, 48, 48],
@@ -75,16 +68,44 @@ def start(mode)
     end

     class BaseWindow < Stylet::Base
-      attr_reader :tasks
+      concerning :MultiTask do
+        attr_reader :tasks

-      def initialize(*)
-        super
-        @tasks = []
+        def initialize(*)
+          super
+          @tasks = []
+        end
+
+        def next_frame(*args, &block)
+          super
+          tasks.each(&:call)
+        end
       end

-      def next_frame(*args, &block)
-        super
-        tasks.each(&:call)
+      concerning :BackgroundImage do
+        attr_accessor :bg_file
+
+        def initialize(*)
+          super
+          @bg_file = Pathname("~/src/stylet/image_resources/polygonal_low_poly_background_textures/low-poly-texture-01_640x480.png").expand_path.to_s
+        end
+
+        def background_clear
+          super
+          if bg_image
+            screen.put(bg_image, 0, 0)
+          end
+        end
+
+        def bg_image
+          unless @bg_image
+            if @bg_file
+              @bg_image = SDL::Surface.load(@bg_file.to_s).display_format
+              @bg_image.set_alpha(SDL::SRCALPHA, 128)
+            end
+          end
+          @bg_image
+        end
       end

       instance
@@ -107,7 +128,6 @@ def initialize

         @showy = false

-        Stylet.config.production_keys = [SDL::Key::K0]
         Window.__last_update_app_window = self
       end

@@ -118,6 +138,7 @@ def update(*args)

       def render_all(field)
         set_draw_point(field, index: 0, field_count: 1)
+        draw_black(field)
         draw_field(field)
         draw_cell_outline(field)
         draw_field_outline(field)
@@ -287,6 +308,16 @@ def draw_ghost(field, piece)
         end
       end

+      def draw_black(field)
+        bx, by = @field_locate_info[:lt2]
+
+        x_padding = 6
+        y_padding = 6
+        screen.draw_rect(bx - x_padding * cell_w, by - y_padding * cell_h, cell_w * (field.width + x_padding * 2), cell_h * (field.view_height + y_padding * 2), [0, 0, 0], true, 128)
+
+        screen.draw_rect(bx, by, cell_w * field.width, cell_h * field.view_height, [0, 0, 0], true, 128)
+      end
+
       # フィールドの表示
       def draw_field(field)
         item_name_display = (count & 16).zero?
@@ -451,6 +482,7 @@ def render_all(frame)
           end

           set_draw_point(field, index: index, field_count: frame.fields.size, base_x: base_x, base_y: base_y)
+          draw_black(field)
           if players.any?{|pl|pl.controller.ghost_mode}
             draw_field_bg(field)
           end
@@ -723,21 +755,21 @@ def call
     end
   end

-  if $0 == __FILE__
-    # require_relative "backtrack"
-    # backtrack = BackTrack.new("cybrmg", 10, 22, true)
-    # Window::FieldWindow.new(backtrack)
-    # catch (:exit) {
-    #   backtrack.backtrack
-    # }
-    # backtrack.display
-
-    $LOAD_PATH << ".."
-    require "vortex"
-    # require_relative "mode/standard_line40_mode"
-    # Window.start(Mode::StandardLine40Mode)
-
-    require_relative "mode/standard_vs_item_human_mode"
-    Window.start(Mode::StandardVsItemHumanMode)
-  end
+  # if $0 == __FILE__
+  #   # require_relative "backtrack"
+  #   # backtrack = BackTrack.new("cybrmg", 10, 22, true)
+  #   # Window::FieldWindow.new(backtrack)
+  #   # catch (:exit) {
+  #   #   backtrack.backtrack
+  #   # }
+  #   # backtrack.display
+  #
+  #   $LOAD_PATH << ".."
+  #   require "vortex"
+  #   # require_relative "mode/standard_line40_mode"
+  #   # Window.start(Mode::StandardLine40Mode)
+  #
+  #   require_relative "mode/standard_vs_item_human_mode"
+  #   Window.start(Mode::StandardVsItemHumanMode)
+  # end
 end
add backtrack_spec.rb
spec/core/* => spec/*
FieldWindow 廃止
add FieldDecorator