Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Wavy Picture or Screendump

Wavy Pictures / Screen - Version: 1.0
By: Brewmeister

Introduction

Uses Picture #19 to display a picture with a wave effect, and picture #20 to capture the current screen & display it with a wave effect.
This was requested twice, so I thought I'd post it.
To create a static image, set the wave_speed to 0

Screenshots

wavy_picture2.png


Script

Code:
#==============================================================================

# ** Sprite_Picture

# Modified to show wavy picture with picture 19, 

# and a wavy screen with picture 20

# For wavy screen with picture 20:

# Place a blank picture in the Pictures folder & select it

# Set the "Position" to "Upper-Left" & 0,0

# 01APR11 - Brewmeister

#==============================================================================

 

class Sprite_Picture

  alias wavy_init initialize

  def initialize(viewport, picture)

    wavy_init(viewport, picture)

    if @picture.number == 19 # wavy picture

      self.wave_amp = 2

      self.wave_length = 208

      self.wave_speed = 720

    end

    if @picture.number == 20 # wavy screen

      self.wave_amp = 2

      self.wave_length = 208

      self.wave_speed = 720

    end

  end

  alias wavy_update update

  def update

    if @picture_name != @picture.name and

      @picture.number == 20

      cap_screen = true

    end

    wavy_update

    if cap_screen

      self.bitmap = Graphics.snap_to_bitmap

    end

  end

end

Instructions

Paste above Main.
Create a screen size (544x416) blank, transparent image in the picture folder, and use it with picture #20 to display the screen.
Now just use the "Show Picture" command and set the picture # to 19 or 20.

Compatibility

Should be compatible with just about everything. reduces the number of 'normal' pictures to 18.

Terms and Conditions

Use it however you like.
 
Hmmmm,,, I don't know. Try it out.

show picture 20
wait (so it waves for a second)
freeze graphics (Prepare for transition)
transfer (no fading)
show picture 20 again (will capture the new map???)
transition
fade out picture 20
erase picture 20

something like that. Might need additional wait commands to control the timing.
I'm just not sure if the 2nd 'show picture' will capture the new underlying map or the frozen image??
 
This is cool! The more eyecandy scripts the better.
Its a shame that rmxp does not have a lot of these built in postprocessing options.
In the words of Gubid:"great addition".
 
If you want I've done one :
Code:
module Graphics

  FindWindow = Win32API.new('user32', 'FindWindow', 'pp', 'i')

  GetDC = Win32API.new('user32', 'GetDC', 'i', 'i')

  ReleaseDC = Win32API.new('user32', 'ReleaseDC', 'ii', 'i')

  RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')

  BitBlt = Win32API.new('gdi32', 'BitBlt', 'iiiiiiiii', 'i')

  CreateCompatibleBitmap = Win32API.new('gdi32', 'CreateCompatibleBitmap', 'iii', 'i')

  CreateCompatibleDC = Win32API.new('gdi32', 'CreateCompatibleDC', 'i', 'i')

  DeleteObject = Win32API.new('gdi32', 'DeleteObject', 'i', 'i')

  GetDIBits = Win32API.new('gdi32', 'GetDIBits', 'iiiiipi', 'i')

  SelectObject = Win32API.new('gdi32', 'SelectObject', 'ii', 'i')

  def self.snap_to_bitmap

    bmp = Bitmap.new(w=640, h=480)

    bmp_info = [40,w,h,1,32,0,0,0,0,0,0].pack('LllSSLLllLL')

    RtlMoveMemory_pi.call(bmp_address="\0"*4, bmp.__id__*2+16, 4)

    RtlMoveMemory_pi.call(bmp_address, bmp_address.unpack('L')[0]+8, 4)

    RtlMoveMemory_pi.call(bmp_address, bmp_address.unpack('L')[0]+16, 4)

    bmp_address = bmp_address.unpack('L')[0]

    hWndDC = GetDC.call(hWnd=FindWindow.call('RGSS Player', 0))

    hMemDC = CreateCompatibleDC.call(hWndDC)

    hMemBM = CreateCompatibleBitmap.call(hWndDC, w, h)

    SelectObject.call(hMemDC, hMemBM)

    BitBlt.call(hMemDC, 0, 0, w, h, hWndDC, 0, 0, 0xCC0020)

    GetDIBits.call(hMemDC, hMemBM, 0, h, bmp_address, bmp_info, 0)

    DeleteObject.call(hMemBM)

    DeleteObject.call(hMemDC)

    ReleaseDC.call(hWnd, hWndDC)

    bmp

  end

end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top