[XP] Window_Advanced movement and more

Started by Ryex, July 04, 2009, 10:34:26 pm

Previous topic - Next topic

Ryex

July 06, 2009, 12:52:03 am #20 Last Edit: July 06, 2009, 01:31:59 am by Ryexander
well I have Window Adv selectable almost finished. I'm oh so close I just need to get it looping verticly when there is more than one column and improve cursor movement and we're good. right now... it looks... AWESOME!

Window_AdvBase is now 1.04 and it has the shortened class name now so. enjoy.

UPDATE: Window_AdvSelectable v1.0 is out the only glitch I know of is that you can't loop vertically when there is more than one column, I will fix this eventually.
to use this new class make sure you have v 1.04 of the base class installed too

here is a demo class of the slectable window just make a new instance with a bunch of commands and test it out.

Spoiler: ShowHide

class Window_Test < Window_AdvSelectable
 
 def initialize(w, commands)
   @commands = commands
   super(0, 0, w, 160, 160, 32,  32, true, 0, 0, 4, false)
 end
 
 def finalize
   @column_max = 7
   @item_max = @commands.size
   self.contents = Bitmap.new (self.width - 32, self.height - 32)
   self.active = true
   self.index = 0
   refresh
 end
 
 def refresh
   self.contents.clear
   self.contents = Bitmap.new(160 * (@column_max + @offset), row_max * 32)
   for i in 0...@item_max
     draw_item(i)
   end
 end
 
 def draw_item(index)
   row = index / @column_max
   column = index - (row * @column_max)
   x = column * (@column_size + @offset)
   y = row * @row_size
   rect = Rect.new(x, y, @column_size, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index], 1)
 end

 
end



feel free to mess with the column max to see the effect

also I've been using this to test it it use the window in the spoiler above so just call this scene and you will be able to test it

Spoiler: ShowHide

class Scene_Test
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Load database
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   # Make system object
   $game_system = Game_System.new
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.title($data_system.title_name)
   s1 = 'test'
   commands = []
   100.times {|n| commands.push(s1)}
   @test_window = Window_Test.new(384, commands)
   Graphics.transition
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @test_window.dispose
 end
 
 def update
   if @test_window.disposed?
     @test_window = Window_Test.new(0, 0, 200, 200)
   end
   @test_window.update
   update_input
   return
 end
 
 def update_input
   if Input.trigger?(Input::B)
   
   end
   if Input.trigger?(Input::C)
   
   end
   if Input.trigger?(Input::R)
   
   end
   if Input.trigger?(Input::L)
 
   end
   return
 end
 
end
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

UPDATE: fixed a small movement bug when doing resizing with pin off
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo

Quote from: Blizzard on July 05, 2009, 03:11:45 pm
AdvBase would be a lot better. Remember, if somebody would have to read your code like this, he would get confused very quickly.
Laziness has nothing to do with it. It's not like you're going to type it every 20th line. You're gonna probably never type it except when creating a new class that is derivated from it. :P


Minor English lesson: Is "derived." "Derivated" is not a word.

@Script: GJ, but I'm not sure I would call it an "algorithm." Kinda pretentious
is only using word to quote DW: The Shakespeare Code

Seox

Ok, after having used this on a major project and comparing it to the performance alongside that of the standard window, coupled with Ryex's prompt and friendly support, (which few scripters seem to offer >.>) I can honestly say that this script kicks ass. It might not have 9000000 features, but hey, if Ryex updates, it will. For NOW, however, it operates with EASE, and VERY smoothly, if you know how to use it. (Possibly put the test script and scene in your original post, Ryex? That's what helped me the most. Besides the "mode 10" problem, LMAO.)


Point being, this is a very nice scripting tool. It makes a VERY noticeable graphical improvement.
... (<<<<<<<<<<<<<<< TEH DOTS OF DOOM. Hey, kinda catchy. :naughty:)