Changeset 12542

Show
Ignore:
Timestamp:
05/27/08 18:57:10 (5 years ago)
Author:
gan2
Message:

キャラの上に番号を表示するデバッグモードの実装

Location:
lang/ruby/RogueLike/rogue_like
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/RogueLike/rogue_like/controller.rb

    r12291 r12542  
    2525      if Input.triggers(:keyboard).include?(:r) 
    2626        update_start(model) 
     27      elsif Input.triggers(:keyboard).include?(:d) 
     28        model.toggle_debug_mode 
    2729#       elsif Input.repeatings(:mouse).include?(:left) 
    2830#         model.activate_charas 
  • lang/ruby/RogueLike/rogue_like/model.rb

    r12539 r12542  
    99module RogueLike 
    1010  class Model 
    11     attr_reader :state, :map, :charas 
     11    attr_reader :state, :debug_mode, :map, :charas 
    1212     
    1313    def initialize 
     
    2020 
    2121    def start_playing 
    22       @state   = :playing 
     22      @state      = :playing 
     23      @debug_mode = nil 
    2324      make_map 
    2425      make_charas 
    2526      @ass_wp = Workpile.new # A* 探索用のワークパイル 
     27    end 
     28 
     29    def toggle_debug_mode 
     30      @debug_mode = (not @debug_mode) 
    2631    end 
    2732 
  • lang/ruby/RogueLike/rogue_like/view.rb

    r12530 r12542  
    4848        model.charas.each_with_index do |chara, idx| 
    4949          window.render_texture(@textures[:chara], chara.x, chara.y) 
    50           render_text(window, idx.to_s, chara.x, chara.y, true) 
     50          render_text(window, idx.to_s, chara.x, chara.y, true) if model.debug_mode 
    5151        end 
    5252