コード例 #1
0
ファイル: ScrollBar.java プロジェクト: ccazuc/RPG
 private void mouseDragEvent() {
   if (Mideas.mouseX() >= this.x + 4 && Mideas.mouseX() <= this.x + 24) {
     if (Mideas.mouseY() >= this.y + this.y_ascensor
         && Mideas.mouseY() <= this.y + this.y_ascensor + 16) {
       if (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) {
         if (Mouse.getEventButtonState()) {
           this.down = true;
           this.y_ascensor_onclick = Mideas.mouseY();
         }
       }
     }
   }
   if (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) {
     if (!Mouse.getEventButtonState()) {
       this.down = false;
       this.y_ascensor_lastclick = this.y_ascensor;
     }
   }
   if (this.down) {
     if (Mideas.mouseY() >= this.y + this.Y_ASCENSOR_UP_SHIFT + 11
         && Mideas.mouseY()
             <= this.y
                 + this.y_size
                 + 7
                 + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
       this.y_ascensor = Mideas.mouseY() - this.y_ascensor_onclick + this.y_ascensor_lastclick;
     } else if (Mideas.mouseY() <= this.y + this.Y_ASCENSOR_UP_SHIFT + 11) {
       this.y_ascensor = this.Y_ASCENSOR_UP_SHIFT;
     } else if (Mideas.mouseY()
         >= this.y + this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
       this.y_ascensor = this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor();
     }
   }
 }
コード例 #2
0
ファイル: ShopManager.java プロジェクト: ccazuc/RPG
 public static void isSlotHover(int x, int y, int i, int j, int k) {
   if (Mideas.mouseX() >= Display.getWidth() / 2 + x
       && Mideas.mouseX() <= Display.getWidth() / 2 + x + 42
       && Mideas.mouseY() >= Display.getHeight() / 2 + y + i
       && Mideas.mouseY() <= Display.getHeight() / 2 + y + j) {
     slot_hover[k] = true;
   }
 }
コード例 #3
0
ファイル: ScrollBar.java プロジェクト: ccazuc/RPG
 private void mouseScroll() {
   if (Mideas.mouseX() >= this.x - this.x_frame_size + 25
       && Mideas.mouseX() <= this.x + 25
       && Mideas.mouseY() >= this.y - 25
       && Mideas.mouseY() <= this.y + this.y_frame_size + 25) {
     if (this.mouseWheel != 0) {
       System.out.println(this.mouseWheel);
       if (this.mouseWheel > 0 && this.y_ascensor - this.scroll_tick_size > 23) {
         this.y_ascensor -= this.scroll_tick_size;
       } else if (this.mouseWheel > 0 && this.y_ascensor - this.scroll_tick_size <= 23) {
         this.y_ascensor = this.Y_ASCENSOR_UP_SHIFT;
       } else if (this.mouseWheel < 0
           && this.y_ascensor + this.scroll_tick_size + 18 < this.y_size - 5) {
         this.y_ascensor += this.scroll_tick_size;
       } else if (this.mouseWheel < 0
           && this.y_ascensor + this.scroll_tick_size + 18 >= this.y_size - 5) {
         this.y_ascensor = this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor();
       }
       this.y_ascensor_lastclick = this.y_ascensor;
       this.mouseWheel = 0;
     }
   }
 }
コード例 #4
0
ファイル: GuerrierTalent.java プロジェクト: ccazuc/RPG
 public static boolean mouseEvent() {
   hoverLeft1 = false;
   hoverLeft2 = false;
   hoverLeft3 = false;
   hoverLeft4 = false;
   hoverLeft5 = false;
   hoverLeft6 = false;
   hoverLeft7 = false;
   hoverLeft8 = false;
   hoverLeft9 = false;
   hoverLeft10 = false;
   if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 48) {
     hoverLeft1 = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24 + 66
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47 + 66
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 48) {
     hoverLeft2 = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24 + 132
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47 + 132
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 48) {
     hoverLeft3 = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12 + 65
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12 + 65
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 65 + 48) {
     hoverLeft4 = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24 + 66
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47 + 66
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12 + 65
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 65 + 48) {
     hoverLeft5 = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + Talent.getX() + 24 + 132
       && Mideas.mouseX() <= Display.getWidth() / 2 + Talent.getX() + 24 + 47 + 132
       && Mideas.mouseY() >= Display.getHeight() / 2 + Talent.getY() + 12 + 65
       && Mideas.mouseY() <= Display.getHeight() / 2 + Talent.getY() + 12 + 65 + 48) {
     hoverLeft6 = true;
   }
   if (Mouse.getEventButtonState()) {
     if (Mouse.getEventButton() == 0) {
       if (numberTalent < Mideas.joueur1().getLevel() + 1) {
         if (hoverLeft1 && heroicStrikeTalent < 3) {
           heroicStrikeTalent++;
           numberArmsTalent++;
           numberFirstArms++;
           numberTalent++;
           // ((SpellShortcut)Mideas.joueur1().getSpells(0)).getSpell().setDamage(((SpellShortcut)Mideas.joueur1().getSpells(0)).getSpell().getDefaultDamage()*0.05f);
           Talent.setTalent();
         } else if (hoverLeft2 && deflectionTalent < 5) {
           deflectionTalent++;
           numberArmsTalent++;
           numberFirstArms++;
           numberTalent++;
           Mideas.joueur1().setStuffArmor(5);
           Talent.setTalent();
         } else if (hoverLeft3 && improvedRend < 3) {
           improvedRend++;
           numberArmsTalent++;
           numberFirstArms++;
           numberTalent++;
           Talent.setTalent();
         } else if (hoverLeft4 && improvedCharge < 2 && numberFirstArms >= 5) {
           improvedCharge++;
           numberArmsTalent++;
           numberTalent++;
           Talent.setTalent();
         } else if (hoverLeft5 && ironWill < 5 && numberFirstArms >= 5) {
           ironWill++;
           numberArmsTalent++;
           numberTalent++;
           Talent.setTalent();
         } else if (hoverLeft6 && improvedThunderClap < 3 && numberFirstArms >= 5) {
           improvedThunderClap++;
           numberArmsTalent++;
           numberTalent++;
           Talent.setTalent();
         }
       }
     }
     if (Mouse.getEventButton() == 1) {
       if (hoverLeft1
           && heroicStrikeTalent > 0
           && checkLine(numberFirstArms, improvedCharge, ironWill, improvedThunderClap)) {
         heroicStrikeTalent--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         // ((SpellShortcut)Mideas.joueur1().getSpells(0)).getSpell().setDamage(-((SpellShortcut)Mideas.joueur1().getSpells(0)).getSpell().getDefaultDamage()*0.05f);
         Talent.setTalent();
       } else if (hoverLeft2
           && deflectionTalent > 0
           && checkLine(numberFirstArms, improvedCharge, ironWill, improvedThunderClap)) {
         deflectionTalent--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         Mideas.joueur1().setStuffArmor(-5);
         Talent.setTalent();
       } else if (hoverLeft3
           && improvedRend > 0
           && checkLine(numberFirstArms, improvedCharge, ironWill, improvedThunderClap)) {
         improvedRend--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         Talent.setTalent();
       } else if (hoverLeft4 && improvedCharge > 0) {
         improvedCharge--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         Talent.setTalent();
       } else if (hoverLeft5 && ironWill > 0) {
         ironWill--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         Talent.setTalent();
       } else if (hoverLeft6 && improvedThunderClap > 0) {
         improvedThunderClap--;
         numberArmsTalent--;
         numberFirstArms--;
         numberTalent--;
         Talent.setTalent();
       }
     }
   }
   return false;
 }
コード例 #5
0
ファイル: ShopManager.java プロジェクト: ccazuc/RPG
 public static boolean mouseEvent() throws FileNotFoundException, SQLException {
   Arrays.fill(slot_hover, false);
   right_arrow = false;
   left_arrow = false;
   hover_button = false;
   int xLeft = -279;
   int xRight = -114;
   int y = -275;
   if (Mideas.mouseX() >= Display.getWidth() / 2 + xRight + 126
       && Mideas.mouseX() <= Display.getWidth() / 2 + xRight + 151
       && Mideas.mouseY() >= Display.getHeight() / 2 + y + 266
       && Mideas.mouseY() <= Display.getHeight() / 2 + y + 292) {
     right_arrow = true;
   } else if (Mideas.mouseX() >= Display.getWidth() / 2 + xRight - 161
       && Mideas.mouseX() <= Display.getWidth() / 2 + xRight - 136
       && Mideas.mouseY() >= Display.getHeight() / 2 + y + 266
       && Mideas.mouseY() <= Display.getHeight() / 2 + y + 292) {
     left_arrow = true;
   }
   if (Mideas.mouseX() >= Display.getWidth() / 2 + 27
       && Mideas.mouseX() <= Display.getWidth() / 2 + 46
       && Mideas.mouseY() >= Display.getHeight() / 2 - 337
       && Mideas.mouseY() <= Display.getHeight() / 2 - 319) {
     hover_button = true;
   }
   if (Mouse.getEventButtonState()) {
     if (Mideas.mouseX() >= Display.getWidth() / 2 + 27
         && Mideas.mouseX() <= Display.getWidth() / 2 + 46
         && Mideas.mouseY() >= Display.getHeight() / 2 - 337
         && Mideas.mouseY() <= Display.getHeight() / 2 - 319) {
       Interface.closeShopFrame();
       return true;
     } else if (page == 0 && right_arrow) {
       page++;
       Interface.setIsShopLoaded(false);
     } else if (page == 1 && right_arrow) {
       page++;
       Interface.setIsShopLoaded(false);
     } else if (page == 1 && left_arrow) {
       page--;
       Interface.setIsShopLoaded(false);
     } else if (page == 2 && left_arrow) {
       page--;
       Interface.setIsShopLoaded(false);
     }
   }
   isSlotHover(xLeft, y, 0, 41, 0);
   isSlotHover(xLeft, y, 52, 93, 1);
   isSlotHover(xLeft, y, 104, 145, 2);
   isSlotHover(xLeft, y, 156, 197, 3);
   isSlotHover(xLeft, y, 208, 249, 4);
   isSlotHover(xRight, y, 0, 41, 5);
   isSlotHover(xRight, y, 52, 93, 6);
   isSlotHover(xRight, y, 104, 145, 7);
   isSlotHover(xRight, y, 156, 197, 8);
   isSlotHover(xRight, y, 208, 249, 9);
   int i = 0;
   while (i < 10 && i + 10 * page < shopList.size()) {
     buyItems(slot_hover[i], shopList.get(i + 10 * page));
     i++;
   }
   return false;
 }