Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - bigace

41
This is all I have to say:
Spoiler: ShowHide
42
Luckly I found this in Ryex's Mouse_Window API script:  :P
#==============================================================================
# Frame
#------------------------------------------------------------------------------
# Represents an advanced sprite class. It is lighter than a window and avoids
# usage of window specific additions that cannot be turned off. This class is
# abstract and should not be instanciated as such.
#==============================================================================

class Frame < Sprite
 
 # constants
 BORDER_COLOR = Color.new(255, 255, 255, 160)
 BACK_COLOR = Color.new(0, 0, 0, 160)
 # setting all accessible variables
 attr_accessor :active
 attr_reader   :width
 attr_reader   :height
 #----------------------------------------------------------------------------
 # Initialization.
 #  x             - x coordinate
 #  y             - y coordinate
 #  width         - width of the sprite
 #  height        - height of the sprite
 #----------------------------------------------------------------------------
 def initialize(x, y, width, height)
   # create the actual sprite
   super()
   # set dimensions
   @width = width
   @height = height
   # create background sprite
   create_background_sprite
   # set position
   self.x, self.y, self.z = x, y, 1000
   # store variables
   @active = true
 end
 #----------------------------------------------------------------------------
 # Creates a background sprite.
 #----------------------------------------------------------------------------
 def create_background_sprite
   # create background sprite
   @background = Sprite.new
   create_background_bitmap
 end
 #----------------------------------------------------------------------------
 # Creates the background bitmap.
 #----------------------------------------------------------------------------
 def create_background_bitmap
   @background.bitmap = Bitmap.new(@width, @height)
   @background.bitmap.fill_rect(0, 0, @width, @height, BORDER_COLOR)
   @background.bitmap.fill_rect(1, 1, @width - 2, @height - 2, BACK_COLOR)
 end
 #----------------------------------------------------------------------------
 # Updates the background sprite.
 #----------------------------------------------------------------------------
 def update_background
   @background.x, @background.y, @background.z = self.x, self.y, self.z - 100
 end
 #----------------------------------------------------------------------------
 # Changes the sprite width.
 #  value - new width
 #----------------------------------------------------------------------------
 def width=(value)
   # if width had changed
   if @width != value
     # delete old bitmap
     @background.bitmap.dispose if @background.bitmap != nil
     @width = value
     # create new background bitmap
     create_background_bitmap
   end
 end
 #----------------------------------------------------------------------------
 # Changes the sprite height.
 #  value - new height
 #----------------------------------------------------------------------------
 def height=(value)
   # if width had changed
   if @height != value
     # delete old bitmap
     @background.bitmap.dispose if @background.bitmap != nil
     @height = value
     # create new background bitmap
     create_background_bitmap
   end
 end
 #----------------------------------------------------------------------------
 # Changes sprite x.
 #  value - new x coordinate
 #----------------------------------------------------------------------------
 def x=(value)
   super
   update_background
 end
 #----------------------------------------------------------------------------
 # Changes sprite y.
 #  value - new y coordinate
 #----------------------------------------------------------------------------
 def y=(value)
   super
   update_background
 end
 #----------------------------------------------------------------------------
 # Changes sprite z.
 #  value - new z coordinate
 #----------------------------------------------------------------------------
 def z=(value)
   super
   update_background
 end
 #----------------------------------------------------------------------------
 # Refreshes the display. Abstract method.
 #----------------------------------------------------------------------------
 def refresh
 end
 #----------------------------------------------------------------------------
 # Disposes the additional background sprite.
 #----------------------------------------------------------------------------
 def dispose
   @background.dispose
   super
 end
 
end

#==============================================================================
# Frame
#------------------------------------------------------------------------------
# Represents an advanced sprite class. It is lighter than a window and avoids
# usage of window specific additions that cannot be turned off. This class is
# abstract and should not be instanciated as such.
#==============================================================================



class Frame < Sprite
 
 attr_reader :viewport
 
 # mod to add viewport handeling
 alias viewport_addition_init initialize
 def initialize(x, y, width, height, viewport = nil)
   # create the actual sprite
   if viewport.is_a?(Viewport)
     super(viewport)
     @viewport = viewport
     @width = width
     @height = height
     # create background sprite
     create_background_sprite
     # set position
     self.x, self.y, self.z = x, y, 1000
     # store variables
   else
     viewport_addition_init(x, y, width, height)
   end
 end
 
 alias viewport_addition_cbs create_background_sprite
 def create_background_sprite
   # create background sprite
   if @viewport.is_a?(Viewport)
     @background = Sprite.new(@viewport)
     create_background_bitmap
   else
     viewport_addition_cbs
   end
   
 end
 
 def visable=(value)
   super
   @background.visable = value if @background != nil && !@background.disposed?
 end
 
 
end

This should work for what I'm doing. I guess the only way to consume less CPU power would be to create a dll file, which I don't really know how to do yet.
43
Would it be a good idea to create a Window_Selectable in the sprite class (Sprite_Selectable) instead since I'm not using any windowskins and since I've already turned most windows into sprites anyways?

One problem I run into is that the sprite class doesn't have the self.active method which would actually be a real issue.
44
Nope this happens:


I also tried this:
		if vertical
y_off = 0
text.each_char do |c|
rect = text_size(c)
rect.x = x
rect.y = y + y_off
draw_text(rect, c, align)
y_off += rect.height
end 
end

But this happenes:


Note: I've been trying to turn the word "Level"
45
The first vertical one, I'll take a look at that in a second thank you.
46
Okay so I'm having an issue getting the text to be vertical. Here's the code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Bitmap
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Bitmap
def gradient_fill_rect(*args)
if args[0].is_a?(Rect)
x, y, width, height = args[0].x, args[0].y, args[0].width, args[0].height
color1 = args[1].dup
color2 = args[2]
vertical = args[3]
else
x, y, width, height = args[0..3]
color1 = args[4].dup
color2 = args[5]
vertical = args[6]
end
dr = color2.red   - color1.red
dg = color2.green - color1.green
db = color2.blue  - color1.blue
da = color2.alpha - color1.alpha
start_rgba = [color1.red, color1.green, color1.blue, color1.alpha]
if vertical
dr, dg, db, da = dr / height, dg / height, db / height, da / height
(y...(y + height)).each do |i|
fill_rect(x, i, width, 1, color1)
start_rgba[0] = [start_rgba[0] + dr, 0].max
start_rgba[1] = [start_rgba[1] + dg, 0].max
start_rgba[2] = [start_rgba[2] + db, 0].max
start_rgba[3] = [start_rgba[3] + da, 0].max
color1.set(*start_rgba)
end
else
dr, dg, db, da = dr / width, dg / width, db / width, da / width
(x...(x + width)).each do |i|
fill_rect(i, y, 1, height, color1)
start_rgba[0] = [start_rgba[0] + dr, 0].max
start_rgba[1] = [start_rgba[1] + dg, 0].max
start_rgba[2] = [start_rgba[2] + db, 0].max
start_rgba[3] = [start_rgba[3] + da, 0].max
color1.set(*start_rgba)
end
end
end
def gradient_draw_text(*args)
is_rect = args[0].is_a?(Rect)
x        = is_rect ? args[0].x      : args[0]
y        = is_rect ? args[0].y      : args[1]
w        = is_rect ? args[0].width  : args[2]
h        = is_rect ? args[0].height : args[3]
text     = is_rect ? args[1].to_s   : args[4].to_s
color1   = is_rect ? args[2]        : args[5]
color2   = is_rect ? args[3]        : args[6]
align    = is_rect ? args[4]        : args[7]
vertical = is_rect ? args[5]        : args[8]
align = 0 if !align
vertical = false if !vertical
text_bmp = Bitmap.new(w, h)
text_bmp.font.name = font.name
text_bmp.font.size = font.size
text_bmp.font.bold = font.bold
text_bmp.font.italic = font.italic
text_bmp.font.outline = font.outline
text_bmp.font.shadow = font.shadow
text_bmp.font.out_color = font.out_color
text_bmp.draw_text(0, 0, w, h, text, align)
gradient_bmp = Bitmap.new(w, h)
gradient_bmp.gradient_fill_rect(0, 0, w, h, color1, color2, vertical)
w.times do |x2|
h.times do |y2|
alpha_txt = text_bmp.get_pixel(x2, y2).alpha
if alpha_txt > 0
c = gradient_bmp.get_pixel(x2, y2)
c.alpha = alpha_txt
text_bmp.set_pixel(x2, y2, c)
end
end
end     
draw_text(x, y, w, h, text.to_s, align)
blt(x, y, text_bmp, Rect.new(0, 0, w, h))
end 
end


So I was wondering if you guys could figure out where the issue is coming from.
47
General Discussion / Ruby on Rails?
November 04, 2013, 12:52:58 pm
So a job recruiter called me today and saw that I had some skills in ruby and wanted to know if I would program in Ruby on Rails for their company that is a web-oriented environment.
QuoteOur client is looking for a well-rounded Quality Assurance Automation Engineer that is familiar with the growing technology landscape and desires to contribute in a fast-paced, web-oriented environment. This position requires a strong analytical sense combined with a dynamic, creative approach. You will be responsible for creating and executing plans and procedures used to ensure high levels of quality for complex, consumer-oriented, web-based applications.

The problem is I have no clue how Ruby on Rails looks. So my question is:

  • How similar is "ruby" to "ruby on rails." Reason I asked was because the questions they asked are more web-oriented than normal ruby language oriented.

  • Does anyone have any tutorials on Ruby on Rails, JSP, CSS, JavaScript, Struts, and/or Ajax.


Any help is appreciated.
48

As the image states above from my Adobe Photoshop CS5, going pass this limit won't work on any version older than the Creative Suite series. So you'll have to upgrade or get another software to exceed 30,000 pixels
49
Intelligent Debate / Re: Jesus was never real
October 09, 2013, 07:47:57 pm
Quote from: Heretic86 on October 09, 2013, 06:55:36 pm
Doesnt matter if God is real or not, the very core of Religion is for People to control Other People.  Views expressed by Men do not necessarily reflect the opinion of God, and we all know how much Men like to lie to achieve what they want.

Truth
50
I know I saw that, Terv posted the link already in the OP ;). Doesn't mean there can't be more than one method.
51
I found this console on rmrk by Grim: http://rmrk.net/index.php/topic,48057.0.html
however, the console seems to have issues with the xp+vxace conversion. So I removed lines 119 and 125, because we're running on vxace now using xp and now it works.
52
General Discussion / Re: Whats the difference?
October 06, 2013, 11:30:12 pm
Okay so it's just a upgrade with a new name.
53
General Discussion / Re: Whats the difference?
October 05, 2013, 03:13:58 pm
ops I worded that wrong :facepalm:. I fix the OP.
54
General Discussion / Whats the difference?
October 05, 2013, 11:38:46 am
So I notice a while ago that ruby 1.9.1 has msgbox and I wanted to know what was the difference between:

  • msgbox and print

  • p and msgbox_p



As far as I can see, both functions look and act the same.
55
Sorry it was 1:45 A.M. and I fell asleep :zzz:
Quote from: KK20 on October 04, 2013, 12:30:29 am
Precisely. I'm guessing you thought @data would be an array of Symbols, and, each time you pushed a new Sprite_TitleCommand in (which would call an update method to change its position), you thought the array's size would increase by one, effectively putting each new sprite below the previous.

Basically yes, but anyways thank you for the help; results:



class Scene_Title < Scene_Base  
def create_command_sprites
@commands = []; index = 0
WarriorManager::TITLE_COMMANDS.each do |command|
case command
when :new_game, :continue, :manual, :website, :shutdown
when :new_game_plus then next unless new_game_plus?
else next
end
@commands << Sprite_TitleCommand.new(nil, command, index)
index += 1
end
end
end
class Sprite_TitleCommand < Sprite_CommandBase
 def initialize(viewport, data, index)
   @item_draw_index = index
   ...
   super(viewport, data)
 end
 ...
 def update_position
   @org_pos = [Graphics.width / 2, (26 * @item_draw_index) + 200]
   ...
 end
end



Now I just have to fix the graphics (as that looks ugly), create a moving background image (obviously I'm not using that one), and add mouse function to the buttons. Should take a couple of hours.
56
Oh  :facepalm: it's categorizing each symbol by number of characters instead of the order its in the array. Okay :O.o:

Edit: But why isn't it counting the size of the array, instead of the symbol's characters?

57
I hate asking questions, but here we go. So I'm writing an menu system for my game and I'm using sprites instead of windows. What I'm trying to do is to figure out why this title screen keeps doing this:


It's supposed be:
-New Game
-New Game Plus
-Continue/No Data
-Manual
-Website
-Shut Down
But I get what's in that image instead. I'm guessing it's something to do with the symbols I'm using, but I have a headache trying to figure this out for the past day and a half. So I was wondering if anyone else had a solution to this.
58
Cool, I'll try to keep it up to date as much as possible. Thanks
59
Hey Terv, do you mind if I post this on http://www.gdunlimited.net/forums/
Just asking just encase, you say otherwise.
60
Quote from: KK20 on May 17, 2013, 02:18:25 pm
Not to mention, the method 'max_by' doesn't even exist in Ruby 1.8.1, which I believe is the version RMXP uses.

:facepalm: Wow, this whole time I've been looking at 1.8.7. Okay that explains why this doesn't work.