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.

Help cloning a Window's Cursor Rect graphic [RESOLVED!]

This topic is already resolved.

Good day everybody!

I need a little help, because I'm confusing myself now @_@

Okay, what I'm trying to do is create a easy method to temporarily clone a Window's Cursor Rect graphic. First of all, I made the base method and did it based off a bitmap.fill_rect(), and this method on its own works fine.

Code:
  #-----------------------------------------------------------------------------
  # * Clone Cursor
  #-----------------------------------------------------------------------------
  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, self.width-32, 96)
    bitmap = Bitmap.new(self.width-32, 96)
    color = Color.new(160, 160, 160, 160)
    bitmap.fill_rect(2, 2, self.width-36, 96, color)
    contents.blt(0, y, bitmap, src_rect, 192)
  end

But now, what I want to do is 'blt' the Windowskin's cursor graphic, then stretch it to the size of the real cursor, and blt it onto self.contents, but I can't even get the graphic to show up. (Note: cursor_width and cursor_height are newly defined methods for this script)

Code:
  #-----------------------------------------------------------------------------
  # * Clone Cursor
  #-----------------------------------------------------------------------------
  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, cursor_width, cursor_height)
    bitmap = Bitmap.new(128, 96)
    bitmap.blt(128, 64, self.windowskin, Rect.new(128, 64, 32, 32))
    contents.blt(0, y, bitmap, src_rect, 192)
  end

All I really need to know is, how do I go about cloning and singling out the self.windowskin's cursor graphic, and stretch it onto the Window?
 

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