Conectarse

Recuperar mi contraseña

Buscar
 
 

Resultados por:
 


Rechercher Búsqueda avanzada

Últimos temas
» Engine Día, Atardecer, Noche y Clima
por Carlosjavierr Vie Sep 10, 2010 11:08 am

» Engine Armas y Hechizos
por Carlosjavierr Vie Sep 10, 2010 11:08 am

» Engine Busca Tesoros ( Detector de Metales )
por Carlosjavierr Vie Sep 10, 2010 11:07 am

» Engine sentarse VX ( y recuperas vida )
por Carlosjavierr Vie Sep 10, 2010 11:07 am

» Engine Sentarse ( y recuperas vida ) Nueva version
por Carlosjavierr Vie Sep 10, 2010 11:07 am

» Nueva version de mi engine pet!!! 1.01
por Carlosjavierr Vie Sep 10, 2010 11:06 am

» Engine Compra de Habilidades
por Carlosjavierr Vie Sep 10, 2010 11:06 am

Mejores posteadores
Carlosjavierr (71)
 
555Goku5551 (46)
 
wachuflame2 (4)
 
Kailcor (3)
 

¿Quién está en línea?
En total hay 1 usuario en línea: 0 Registrados, 0 Ocultos y 1 Invitado

Ninguno

[ Ver toda la lista ]


La mayor cantidad de usuarios en línea fue 10 el Dom Jul 05, 2015 4:15 am.
Afiliados
Maker Palace
True Role Dreams
Visitas


[RPGVX] Notebook ( para escribir o anotar lo que quieras )

Ver el tema anterior Ver el tema siguiente Ir abajo

[RPGVX] Notebook ( para escribir o anotar lo que quieras )

Mensaje  Carlosjavierr el Vie Feb 05, 2010 7:55 pm

Bueno este script sirve para para lo siguiente : escribir o colorear lo que quieras miren la imagen

Spoiler:


bueno para que demo? no es necesaria... aca el script :

Spoiler:
Código:
#????????????????????????????????????????????????????????????????#
# Script:  Notebook VX                                          #
#  by Deity [translated to English by modern algebra (rmrk.net)] #
# Mouse module by Near Fantastica                                #
#????????????????????????????????????????????????????????????????#
# Description:                                                    #
#  This script permits the game player to have a notebook to jot #
# down reminders of a quest or draw special symbols or any      #
# number of cool things. It allows complete user input on a      #
# canvas, in addition to shoosing a larger size for the pencil  #
# or a different colour. Can make for a great tool for the      #
# player to take notes to remind him/herself of their objectives #
# or as simply a way to pass the time!                          #
#  It also supports mouse input in addition to key input        #
#????????????????????????????????????????????????????????????????#
# Instructions:                                                  #
# Choose the settings for the appearance that you want below the #
#  Settings headed. Once that is done, all you need to do is use #
#  the following code in a call script:                          #
#                                                                #
#    $scene = Scene_Notebook.new()                              #
#????????????????????????? Settings ?????????????????????????????#
#                  true = yes / false = no                      #
module Notebook
  USE_MOUSE = false # Use the mouse to draw with?
  KEY_TO_DRAW = Input::Z # Unused buttons: X(A),Y(S),Z(D),L(Q),
                        # R(Q). If you use Z, it is the D key
  BGM = [
  "Town2", # Filename of BGM to play
  100,    # Volume
  100,    # Pitch
  ] # <= Do not delete!
  # Select the drawing colours for the note book. These are of
  # the (Red, Green, Blue, Alpha) form. All numbers must be
  # between 0 and 255.
  COLORS = [
  Color.new(0,0,0,255),      # Black
  Color.new(255,255,255,255), # White
  Color.new(255,0,0,255),    # Red
  Color.new(0,255,0,255),    # Green
  Color.new(0,0,255,255),    # Blue
  Color.new(255,255,0,255),  # Yellow
  ] # <= Do not delete!
  # Select the names for the commands of the selection window
  COMMANDS = [
  "Draw",      # Draw
  "Color",    # The color to draw in
  "Size",      # Size of Pencil
  "Erase", # Erase All
  ] # <= Do not delete!
  # Comment for the lower help window
  HELP_TEXT = "[D: Draw] [B: Back] [Shift: Accelerate]"
  # Colour of background
  BACKGROUND_START_COLOR = Color.new(255,255,255,255)
  # Starting settings for the cursor
  CURSOR_START_VALUES = [
  80, # X-coordinate of cursor start position
  80, # Y-coordinate of cursor start position
  Color.new(0,0,0,255), # Color of cursor on startup
  4, # Size of cursor on startup
  ] # <= Do not delete!
end
#  You should edit nothing beyond this point unless you are a  #
# scripter and know what you're doing                          #
#???????????????????????????????????????????????????????????????#
include Notebook
# Author of the Mouse module
# Near Fantastica (special thanks)
module Mouse
  GetAsyncKeyState=Win32API.new("user32","GetAsyncKeyState",'i','i')
  GetKeyState=Win32API.new("user32","GetKeyState",'i','i')
  SetCursorPos=Win32API.new('user32','SetCursorPos','nn','n')
  GetCursorPo=Win32API.new('user32','GetCursorPos','p','i')
  ScreenToClient=Win32API.new('user32','ScreenToClient','lp','i')
  GetPrivateProfileStringA=Win32API.new('kernel32','GetPrivateProfileStringA','pppplp','l')
  FindWindowA=Win32API.new('user32','FindWindowA','pp','l')
  GetClientRect=Win32API.new('user32','GetClientRect','lp','i')
  GetWindowRect=Win32API.new('user32','GetWindowRect','lp','i')
  game_name="\0"*256
  GetPrivateProfileStringA.call('Game','Title','',game_name,255,".\\Game.ini")
  game_name.delete!("\0")
  @handle=FindWindowA.call('RGSS Player',game_name)
  module_function
  def click?(button)
    return true if @keys.include?(button)
    return false
  end 
  def press?(button)
    return true if @press.include?(button)
    return false
  end
  def set_pos(x_pos=0,y_pos=0)
    width,height=client_size
    if (x_pos.between?(0,width)&&y_pos.between?(0,height))
      SetCursorPos.call(client_pos[0]+x_pos,client_pos[1]+y_pos)
    end
  end
  def update
    @pos=Mouse.pos
    @keys,@press=[],[]
    @keys.push(1)if GetAsyncKeyState.call(1)&0x01==1
    @keys.push(2)if GetAsyncKeyState.call(2)&0x01==1
    @keys.push(3)if GetAsyncKeyState.call(4)&0x01==1
    @press.push(1)if pressed?(1)
    @press.push(2)if pressed?(2)
    @press.push(3)if pressed?(4)
  end 
  def pressed?(key)
    return true unless GetKeyState.call(key).between?(0,1)
    return false
  end
  def global_pos
    pos=[0,0].pack('ll')
    GetCursorPo.call(pos)!=0 ? (return pos.unpack('ll')):(return nil)
  end
  def pos
    x,y=screen_to_client(*global_pos)
    width,height=client_size
    begin
      x=0 if x<=0;y=0 if y<=0
      x=width if x>=width;y=height if y>=height
      return x,y
    end
  end
  def screen_to_client(x,y)
    return nil unless x&&y
    pos=[x,y].pack('ll')
    ScreenToClient.call(@handle,pos)!=0?(return pos.unpack('ll')):(return nil)
  end
  def client_size
    rect=[0,0,0,0].pack('l4')
    GetClientRect.call(@handle,rect)
    right,bottom=rect.unpack('l4')[2..3]
    return right,bottom
  end
  def client_pos
    rect=[0,0,0,0].pack('l4')
    GetWindowRect.call(@handle,rect)
    left,upper=rect.unpack('l4')[0..1]
    return left+4,upper+30
  end 
  def grid
    return nil if @pos.nil?
    return [(@pos[0]+$game_map.display_x/8)/32,(@pos[1]+$game_map.display_y/8)/32]
  end
end
class Window_ChooseColor < Window_Selectable
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
    if row_max == 0
      row_max = (commands.size + column_max - 1) / column_max
    end
    super(0, 0, width, row_max * WLH + 32, spacing)
    @commands = commands
    @item_max = commands.size
    @column_max = column_max
    refresh
    self.index = 0
    self.visible = false
    self.active = false
  end
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = WLH + 8
    rect.x = index % @column_max * (rect.width + @spacing) + 13
    rect.width = 32
    rect.y = (index / @column_max * WLH)  - 4
    return rect
  end
  def item_rect2(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
  def draw_item(i, enabled = true)
    rect = item_rect2(i)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = COLORS[i]
    self.contents.draw_text(rect.x+13,rect.y,24,24,@commands[i].to_s)
    self.contents.fill_rect(rect.x+13,rect.y,24,24,COLORS[i])
  end
end
class Scene_Notebook < Scene_Base
  def start
    @color = Window_ChooseColor.new(544,["","","","","",""],6)
    @commands = Window_Command.new(544,COMMANDS,4)
    create_background
    create_cursor
    @size = Window_NumberInput.new
    @size.visible = false
    @size.opacity = 255
    @size.digits_max = 2
    @size.number = @cursor.width
    @help = Window_Help.new
    @help.y = 416 - @help.height
    Audio.bgm_play("Audio/BGM/"+BGM[0],BGM[1],BGM[2])
    @mouse = USE_MOUSE
  end
  def create_background
    @background = Sprite.new
    if $game_system.notebookbitmap.empty?
      @background.bitmap = Bitmap.new(544,416)   
      @background.bitmap.fill_rect(0,0,544,416,BACKGROUND_START_COLOR)
    else
      @background.bitmap = $game_system.gimme_bitmap
    end
  end
  def create_cursor
    @cursor = Sprite.new
    @cursor.x = CURSOR_START_VALUES[0]
    @cursor.y = CURSOR_START_VALUES[1]
    @cursor.bitmap = Bitmap.new(CURSOR_START_VALUES[3],CURSOR_START_VALUES[3])
    @cursor.bitmap.fill_rect(0,0,CURSOR_START_VALUES[0],CURSOR_START_VALUES[1],CURSOR_START_VALUES[2])
  end
  def active_window
    return true if @color.active == false && @commands.active == false && @size.active == false
    return false
  end
  def set_cursor_color(color)
    Sound.play_decision
    @cursor.bitmap.fill_rect(0,0,@cursor.width,@cursor.height,color)
  end
  def set_cursor_size(w)
    if w != 0
      Sound.play_decision
      @cursor.bitmap.dispose
      @cursor.bitmap = Bitmap.new(w,w)
      @cursor.bitmap.fill_rect(0,0,w,w,COLORS[@color.index])
    else
      Sound.play_buzzer
    end
  end
  def close_all
    @color.dispose
    @commands.dispose
    @cursor.dispose
    @background.dispose
    @size.dispose
    @help.dispose
  end
  def update
    Mouse.update
    if @mouse     
      @cursor.x,@cursor.y =Mouse.pos
    end
    if active_window && @mouse == false
      if Input.press?(Input::A)
        speed = 2
      else
        speed = 1
      end
      case Input.dir8
        when 1;  @cursor.y += speed
                      @cursor.x -= speed
        when 2;  @cursor.y += speed
        when 3;  @cursor.y += speed
                      @cursor.x += speed
        when 4;  @cursor.x -= speed
        when 7;  @cursor.y -= speed
                      @cursor.x -= speed
        when 6;  @cursor.x += speed
        when 9;  @cursor.y -= speed
                      @cursor.x += speed
        when 8;  @cursor.y -= speed
      end
      if @cursor.y < 0
        @cursor.y = 0
      end
      if @cursor.y + @cursor.height > 416
        @cursor.y = 416 - @cursor.height
      end
      if @cursor.x < 0
        @cursor.x = 0
      end
      if @cursor.x + @cursor.width > 544
        @cursor.x = 544 - @cursor.width
      end
    end
    if active_window
      @help.visible = false
    else
      @help.visible = true
      @help.set_text(HELP_TEXT,1)
    end
    if Input.press?(KEY_TO_DRAW) && active_window && @mouse == false
      @background.bitmap.fill_rect(@cursor.x,@cursor.y,@cursor.bitmap.width,@cursor.bitmap.height,@cursor.bitmap.get_pixel(0,0))
    end
    if @mouse && Mouse.press?(1) && active_window
      @background.bitmap.fill_rect(@cursor.x,@cursor.y,@cursor.bitmap.width,@cursor.bitmap.height,@cursor.bitmap.get_pixel(0,0))
    end
    @color.update if @color.active == true
    @commands.update if @commands.active == true
    @size.update if @size.active == true
    if Input.trigger?(Input::C)
      if @commands.active == true
        Sound.play_decision
        case @commands.index
        when 0
          @commands.active = false
          @commands.visible = false
        when 1
          @commands.active = false
          @commands.visible = false
          @color.active = true
          @color.visible = true
        when 2
          @commands.active = false
          @commands.visible = false
          @size.active = true
          @size.visible = true
        when 3
          @background.bitmap.fill_rect(0,0,544,416,Notebook::BACKGROUND_START_COLOR)
        end
      elsif @color.active == true
        set_cursor_color(COLORS[@color.index])
      elsif @size.active == true
        set_cursor_size(@size.number)
      end
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if @commands.active == true
        $game_system.dump_bitmap(@background.bitmap)
        close_all
        Audio.bgm_stop
        $game_map.autoplay
        return_scene
      elsif @color.active == true
        @commands.active = true
        @commands.visible = true
        @color.active = false
        @color.visible = false
      elsif @size.active == true
        @commands.active = true
        @commands.visible = true
        @size.active = false
        @size.visible = false
      elsif active_window
        @commands.active = true
        @commands.visible = true
      end
    end
  end
  def return_scene
    $scene = Scene_Map.new
  end
end
class Game_System
  attr_reader  :notebookbitmap
  alias initialize_notebook initialize
  def initialize
    initialize_notebook
    @notebookbitmap = []
  end
  # Convert Bitmap in Array (Colors)
  def dump_bitmap(bitmap)
    @notebookbitmap.clear
    for i in 0...bitmap.height
      n = []
      for o in 0...bitmap.width
        n.push(bitmap.get_pixel(o,i))
      end
      @notebookbitmap.push(n)
    end
  end
  # Convert Array (Colors) in Bitmap
  def gimme_bitmap
    bit = Bitmap.new(@notebookbitmap[0].size,@notebookbitmap.size)
      for i in 0...@notebookbitmap.size
        for o in 0...@notebookbitmap[i].size
          bit.set_pixel(o,i,@notebookbitmap[i][o])
        end
      end
    return bit
  end
end

Creditos : Deity
avatar
Carlosjavierr
Administrador
Administrador

Mensajes : 71
Gracias : 20
Fecha de inscripción : 04/02/2010
Edad : 25

Ver perfil de usuario http://makercomunity.fororama.com

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.