Package com.golden.gamedev.object

Examples of com.golden.gamedev.object.Background


   *
   * @param sprite sprite to check its intersection with mouse pointer
   * @param pixelCheck true, checking the sprite image with pixel precision
   */
  public boolean checkPosMouse(Sprite sprite, boolean pixelCheck) {
    Background bg = sprite.getBackground();
   
    // check whether the mouse is in background clip area
    if (this.getMouseX() < bg.getClip().x
            || this.getMouseY() < bg.getClip().y
            || this.getMouseX() > bg.getClip().x + bg.getClip().width
            || this.getMouseY() > bg.getClip().y + bg.getClip().height) {
      return false;
    }
   
    double mosx = this.getMouseX() + bg.getX() - bg.getClip().x;
    double mosy = this.getMouseY() + bg.getY() - bg.getClip().y;
   
    if (pixelCheck) {
      try {
        return ((sprite.getImage().getRGB((int) (mosx - sprite.getX()),
                (int) (mosy - sprite.getY())) & 0xFF000000) != 0x00);
View Full Code Here


   *
   * @param sprite sprite to check its intersection with mouse pointer
   * @param pixelCheck true, checking the sprite image with pixel precision
   */
  public boolean checkPosMouse(Sprite sprite, boolean pixelCheck) {
    Background bg = sprite.getBackground();
   
    // check whether the mouse is in background clip area
    if (this.getMouseX() < bg.getClip().x
            || this.getMouseY() < bg.getClip().y
            || this.getMouseX() > bg.getClip().x + bg.getClip().width
            || this.getMouseY() > bg.getClip().y + bg.getClip().height) {
      return false;
    }
   
    double mosx = this.getMouseX() + bg.getX() - bg.getClip().x;
    double mosy = this.getMouseY() + bg.getY() - bg.getClip().y;
   
    if (pixelCheck) {
      try {
        return ((sprite.getImage().getRGB((int) (mosx - sprite.getX()),
                (int) (mosy - sprite.getY())) & 0xFF000000) != 0x00);
View Full Code Here

TOP

Related Classes of com.golden.gamedev.object.Background

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.