collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Window_Selectable als Topbar?  (Gelesen 1364 mal)

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Window_Selectable als Topbar?
« am: August 26, 2010, 16:42:39 »
hey,
ich wollte fragen wie ich diesen skript
Spoiler for Hiden:
#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
#  This window contains cursor movement and scroll functions.
#==============================================================================

class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :item_max                 # item count
  attr_reader   :column_max               # digit count
  attr_reader   :index                    # cursor position
  attr_reader   :help_window              # help window
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x       : window X coordinate
  #     y       : window Y coordinate
  #     width   : window width
  #     height  : window height
  #     spacing : width of empty space when items are arranged horizontally
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, spacing = 32)
    @item_max = 1
    @column_max = 1
    @index = -1
    @spacing = spacing
    super(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # * Create Window Contents
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
  end
  #--------------------------------------------------------------------------
  # * Set Cursor Position
  #     index : new cursor position
  #--------------------------------------------------------------------------
  def index=(index)
    @index = index
    update_cursor
    call_update_help
  end
  #--------------------------------------------------------------------------
  # * Get Row Count
  #--------------------------------------------------------------------------
  def row_max
    return (@item_max + @column_max - 1) / @column_max
  end
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / WLH
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  #     row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    row = 0 if row < 0
    row = row_max - 1 if row > row_max - 1
    self.oy = row * WLH
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / WLH
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_item_max
    return page_row_max * @column_max
  end
  #--------------------------------------------------------------------------
  # * Get bottom row
  #--------------------------------------------------------------------------
  def bottom_row
    return top_row + page_row_max - 1
  end
  #--------------------------------------------------------------------------
  # * Set bottom row
  #     row : Row displayed at the bottom
  #--------------------------------------------------------------------------
  def bottom_row=(row)
    self.top_row = row - (page_row_max - 1)
  end
  #--------------------------------------------------------------------------
  # * Get rectangle for displaying items
  #     index : item number
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = WLH
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * WLH
    return rect
  end
  #--------------------------------------------------------------------------
  # * Set Help Window
  #     help_window : new help window
  #--------------------------------------------------------------------------
  def help_window=(help_window)
    @help_window = help_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # * Determine if cursor is moveable
  #--------------------------------------------------------------------------
  def cursor_movable?
    return false if (not visible or not active)
    return false if (index < 0 or index > @item_max or @item_max == 0)
    return false if (@opening or @closing)
    return true
  end
  #--------------------------------------------------------------------------
  # * Move cursor down
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
    if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
      @index = (@index + @column_max) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor up
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
    if (@index >= @column_max) or (wrap and @column_max == 1)
      @index = (@index - @column_max + @item_max) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor right
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_right(wrap = false)
    if (@column_max >= 2) and
       (@index < @item_max - 1 or (wrap and page_row_max == 1))
      @index = (@index + 1) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor left
  #     wrap : Wraparound allowed
  #--------------------------------------------------------------------------
  def cursor_left(wrap = false)
    if (@column_max >= 2) and
       (@index > 0 or (wrap and page_row_max == 1))
      @index = (@index - 1 + @item_max) % @item_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor one page down
  #--------------------------------------------------------------------------
  def cursor_pagedown
    if top_row + page_row_max < row_max
      @index = [@index + page_item_max, @item_max - 1].min
      self.top_row += page_row_max
    end
  end
  #--------------------------------------------------------------------------
  # * Move cursor one page up
  #--------------------------------------------------------------------------
  def cursor_pageup
    if top_row > 0
      @index = [@index - page_item_max, 0].max
      self.top_row -= page_row_max
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if cursor_movable?
      last_index = @index
      if Input.repeat?(Input::DOWN)
        cursor_down(Input.trigger?(Input::DOWN))
      end
      if Input.repeat?(Input::UP)
        cursor_up(Input.trigger?(Input::UP))
      end
      if Input.repeat?(Input::RIGHT)
        cursor_right(Input.trigger?(Input::RIGHT))
      end
      if Input.repeat?(Input::LEFT)
        cursor_left(Input.trigger?(Input::LEFT))
      end
      if Input.repeat?(Input::R)
        cursor_pagedown
      end
      if Input.repeat?(Input::L)
        cursor_pageup
      end
      if @index != last_index
        Sound.play_cursor
      end
    end
    update_cursor
    call_update_help
  end
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0                   # If the cursor position is less than 0
      self.cursor_rect.empty        # Empty cursor
    else                            # If the cursor position is 0 or more
      row = @index / @column_max    # Get current row
      if row < top_row              # If before the currently displayed
        self.top_row = row          # Scroll up
      end
      if row > bottom_row           # If after the currently displayed
        self.bottom_row = row       # Scroll down
      end
      rect = item_rect(@index)      # Get rectangle of selected item
      rect.y -= self.oy             # Match rectangle to scroll position
      self.cursor_rect = rect       # Refresh cursor rectangle
    end
  end
  #--------------------------------------------------------------------------
  # * Call help window update method
  #--------------------------------------------------------------------------
  def call_update_help
    if self.active and @help_window != nil
       update_help
    end
  end
  #--------------------------------------------------------------------------
  # * Update help window (contents are defined by the subclasses)
  #--------------------------------------------------------------------------
  def update_help
  end
end


so verändere das das Menü nicht so angezeigt wird:
________
|[Test1]|
|[Test2]|
|[Test3]|
|[Test4]|
|[Test5]|
|[Test6]|
---------
sondern so:
_________________________________________
|[Test1] [Test2] [Test3] [Test4] [Test5] [Test6]|
----------------------------------------------------------

Edit:
Die -> und <- Pfeiltasten sollen benutzt werden nich hoch runter und wenn die Topbar für den text zu klein ist soll das ganze so ausehen:
___________________
|< [Test3] [Test4] >|
---------------------------

wäre echt nett wenn mir dass jemand erklären könnte

lg
juli_1404
« Letzte Änderung: August 26, 2010, 16:48:57 von juli_1404 »

Re: Window_Selectable als Topbar?

Offline PDM

  • Bibliothekar
  • Global Mod
  • VX-Kenner
  • ****
  • Beiträge: 468
    • Mein Blog
Re: Window_Selectable als Topbar?
« Antwort #1 am: August 26, 2010, 17:23:38 »
Ich glaube du musst in Window_Command Zeile 20 das hier ändern:
column_max = 1
  zu
column_max = 6
PDM's Gameplays
Skype-Name: lordpdm

Re: Window_Selectable als Topbar?

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Window_Selectable als Topbar?
« Antwort #2 am: August 26, 2010, 17:27:04 »
Theoretisch musst du nicht auf Window_Selectable gehen, sondern beim erzeugen des Command Windows (Window_Command) einfach bei der übergabe der Parameter drauf achten.
@command_window = Window_Command.new(width,[commands],column_max,row_max,spacing)
column_max ist der Parameter, der die Spaltenanzahl im Command Window bestimmt.
Also würde @command_window = Window_Command.new(width,[commands],6)
reichen um ein Command Window zu erzeugen, welches 6 Reihen hat und sich horizontal bewegen würde.

@PDM
Das sollte man lieber nicht machen, weil ansonsten die Standart Command Windows, welche in ursprügnlichen Scripts erzeugt werden, immer 6 Reihen hätten.

MfG
Deity
« Letzte Änderung: August 26, 2010, 17:28:15 von Ðeity »



Re: Window_Selectable als Topbar?

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Re: Window_Selectable als Topbar?
« Antwort #3 am: August 26, 2010, 17:50:31 »
Danke soweit funktioniert es, aber das scrollen funktioniert nicht! Die felder werden einfach zerdrückt und Zeichen ausgeblendet...
screen:


lg
juli_1404

Re: Window_Selectable als Topbar?

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Window_Selectable als Topbar?
« Antwort #4 am: August 26, 2010, 17:54:06 »
Du hast eine Weite von 544 angegeben und must nun die maximale Anzahl der Reihen auf die Zahl setzen, die du sehen möchtest. Wären es also 2 müsstest du column_max auf 2 setzen.

MfG
Deity



Re: Window_Selectable als Topbar?

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Re: Window_Selectable als Topbar?
« Antwort #5 am: August 26, 2010, 17:57:53 »
jetzt sind es aber 2 zeilen :( will nur eine
« Letzte Änderung: August 26, 2010, 18:18:21 von juli_1404 »

Re: Window_Selectable als Topbar?

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Window_Selectable als Topbar?
« Antwort #6 am: August 26, 2010, 22:00:06 »
Die einfachste Lösung wäre, 2 als maximale columnanzahl anzugeben und danach die Höhe des Fensters auf WLH+32 zu stellen.
Es wäre aber nur ein Kompromiss, ansonsten gibt es tatsächlich nur die Möglichkeit, Window_Command oder Window_Selectable umzuschreiben. Dafür müsstest du aber contents und draw_item umschreiben, was zäh wird.

MfG
Deity



Re: Window_Selectable als Topbar?

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Re: Window_Selectable als Topbar?
« Antwort #7 am: August 26, 2010, 22:43:33 »
Würde es nicht gehen wenn ich denn code ein 2 mal (verändert und vllt auch umbenannt) in meinen skript nehme

Re: Window_Selectable als Topbar?

Offline FlipelyFlip

  • Will sein Alter nicht verraten xD
  • Administrator
  • VX-Großmeister
  • ****
  • Beiträge: 884
  • Heyho (=
    • Flips Musik Kariere auf Facebook xD
Re: Window_Selectable als Topbar?
« Antwort #8 am: August 26, 2010, 22:55:22 »
umbenennen und verändern dann ja, sonst is das kopiern und verändern sinlos, da es immer die Version nimmt, die am nähesten bei Main is /=

Re: Window_Selectable als Topbar?

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Re: Window_Selectable als Topbar?
« Antwort #9 am: August 27, 2010, 14:00:17 »
und was müsste ich dann verändern, dass es zu den seiten zu scrollen ist

lg
juli_1404

EDIT:
wäre nett wenn jemand mal antworten würde...
« Letzte Änderung: August 28, 2010, 16:04:10 von juli_1404 »

Re: Window_Selectable als Topbar?

Offline Soraphis

  • RTP-Mapper
  • *
  • Beiträge: 37
Re: Window_Selectable als Topbar?
« Antwort #10 am: August 28, 2010, 21:03:50 »
4 spalten (statt den 6)
3 stück für menüpunkte und einen zum umblättern

beim umblättern wird ne variable verändert je nach variable werden die menüpunkte umbenannt und führen andere scenes aus ....

ich kenn mich zwar nicht bombastisch mit dem rgss aus ... aber müsste doch machbar sein ....
» #Es gibt 10 Arten von Menschen. Diejenigen, die das Binärsystem verstehen und diejenigen, die es nicht tun# «

Re: Window_Selectable als Topbar?

Offline juli_1404

  • juli steht für Julian!
  • RTP-Mapper
  • *
  • Beiträge: 46
    • Noch im bau...
Re: Window_Selectable als Topbar?
« Antwort #11 am: August 29, 2010, 10:54:10 »
Gibt es keine einfachere Lösung???
@Soraphis:
Danke. Ne Idee ist es schon mal...

lg
juli_1404

 


 Bild des Monats

rooftop party

Views: 3615
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal