N3() Administrateur
Sexe:  Inscrit le: 24 Sep 2006 Messages: 164
Points: 3652
|
Posté le: Sam Nov 03, 2007 7:45 pm Sujet du message: Effet dans les textes |
|
|
Merci à Samo pour ce script.
Fonction : Permet de mettre des effets dans les messages
Screen:
Remarque : Le script est fonctionnel.
Installation :
Ouvrez l'éditeur de scripts (F11) et créez un nouveau script au dessus de "Main" et nommez le "Advanced Text Effects Script" et collez le code ci-dessous.
| Code: |
=begin
Advanced Text Effects(ATE) V1.0 by Samo, the thief.
This script will evitate you doing your methods of special drawing text manually.
You will be able to do an outline, a shadow, and something else, by only putting
when you draw the text:
(x,y,width,height,str,align,method)
Name Description Type
x x coordinate Integer
y y coordinate Integer
width width Integer
height height Integer
str string Integer
align alignment: Integer
Like in Micro Word
0 Left, 1 Medium,
2 Right.
method The Method That String
will indicate
what we want.
Look Down for a List.
In a Normal window, a draw_text with outline should be like this:
self.contents.draw_text(60,45,120,32,"Thanks Outline Script! Now i look Better!", 1, 'outline')
List of Methods:
'outline'
'Shadow Wide'
'Shadow Small'
'Selected Item'
'Light Bisel'
'Small Bisel'
'Medium Bisel'
This also comes with a message system(if you don't like it, just erase the part
of Window_Mesagge)
The message System Works in this Way. There are especial Characters that will
define the type of effect to apply. Just put them, they will appear invisible:
~ No method is used in the message. It makes special characters appear.
@ Outline
# Small Shadow
$ Big Shadow
% Selected Item
^ Light Bisel
& Small Bisel
* Medium Bisel
` Text is Drawn Normally, text effects can appear in the message.
=end
class Bitmap
#-----------------------------------------------------------------------
alias samo_outline_bitmap_draw_text draw_text #Alias of original Draw_text
#------------------------------------------------------------------------
def draw_text(x, y, width, height, str, align = 0, method = 'normal')
if method == 'outline'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color= Color.new(0,0,0) #Color Black
draw_text(x - 1, y, width, height, str, align)
draw_text(x + 1, y, width, height, str, align)
draw_text(x , y+1, width, height, str, align)
draw_text(x , y-1, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Shadow Wide'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color = Color.new(0,0,0,75)
draw_text(x +12, y + 4, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Shadow Small'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color = Color.new(0,0,0,175)
draw_text(x +3, y + 3, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Selected Item'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color= Color.new(120,255,120,225)
draw_text(x - 1, y, width, height, str, align)
draw_text(x + 1, y, width, height, str, align)
draw_text(x , y+1, width, height, str, align)
draw_text(x , y-1, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Light Bisel'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color= Color.new(0,0,0,255)
draw_text(x + 1, y, width, height, str, align)
draw_text(x , y+1, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Small Bisel'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color= Color.new(0,0,0,255)
draw_text(x + 1, y, width, height, str, align)
draw_text(x , y+1, width, height, str, align)
font.color= Color.new(125,125,125,255)
draw_text(x - 1, y, width, height, str, align)
draw_text(x , y-1, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'Medium Bisel'
r = font.color.red #Takes the original color of the window by numbers
g = font.color.green
b = font.color.blue
a = font.color.alpha
font.color= Color.new(0,0,0,255)
draw_text(x + 2, y, width, height, str, align)
draw_text(x , y+2, width, height, str, align)
draw_text(x + 2, y+2, width, height, str, align)
font.color= Color.new(125,125,125,255)
draw_text(x - 2, y, width, height, str, align)
draw_text(x , y-2, width, height, str, align)
draw_text(x - 2, y-2, width, height, str, align)
font.color = Color.new(r,g,b,a) #Returns teh color no to normal
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
if method == 'normal'
samo_outline_bitmap_draw_text(x, y, width, height, str, align) #draw the text without outline
end
end
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
end
class Sprite_Timer < Sprite
#--------------------------------------------------------------------------
def update
super
self.visible = $game_system.timer_working
if $game_system.timer / Graphics.frame_rate != @total_sec
self.bitmap.clear
@total_sec = $game_system.timer / Graphics.frame_rate
min = @total_sec / 60
sec = @total_sec % 60
text = sprintf("%02d:%02d", min, sec)
self.bitmap.font.color.set(255, 255, 255)
self.bitmap.draw_text(0,0,88,48, text, 1, true)
end
end
end
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect.x,rect.y,rect.width,rect.height, @commands[index])
end
end
#==============================================================================
# ■ Window_PartyCommand
#------------------------------------------------------------------------------
class Window_PartyCommand < Window_Selectable
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect.x,rect.y,rect.width,rect.height, @commands[index], 1)
end
end
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
# This message window is used to display text.
#==============================================================================
class Window_Message <Window_Selectable>= 0 and color <7>= 128 ? 32 : 384
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
# go to next text
next
end
# If new line text
if c == "\n"
# Update cursor width if choice
if y >= $game_temp.choice_start
@cursor_width = [@cursor_width, x].max
end
# Add 1 to y
y += 1
x = 0
# Indent if choice
if y >= $game_temp.choice_start
x = 8
end
# go to next text
next
end
# Draw text
unless not_effects == true
if c == "@"
@method = 'outline'
next
elsif c == "#"
@method = 'Shadow Small'
next
elsif c == "$"
@method = 'Shadow Wide'
next
elsif c == "%"
@method = 'Selected Item'
next
elsif c == "^"
@method = 'Light Bisel'
next
elsif c == "&"
@method = 'Small Bisel'
next
elsif c == "`"
@method = 'normal'
next
elsif c == "*"
@method = 'Medium Bisel'
next
end
end
if c == "~"
next
end
self.contents.draw_text(4 + x, 32 * y, 40, 32, c,0,@method)
# Add x to drawn text width
x += self.contents.text_size(c).width
end
end
# If choice
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active = true
self.index = 0
end
# If number input
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
end
end
|
Maintenant pour l'utilisation: (voir les résultats sur le screen)
1) @Oui
2) #Oui
3) $Oui
4) %Oui
Voilà, ++ _________________
 |
|