Changeset b2d7893 in lost-haven for main/LostHavenRPG.java


Ignore:
Timestamp:
Feb 20, 2021, 6:43:24 PM (4 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
4d8825f
Parents:
a49176d
Message:

Change all file paths to work from inside a JAR and update the makefile to correctly build the project

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/LostHavenRPG.java

    ra49176d rb2d7893  
    122122      this.auxState = AuxState.None;
    123123      loadMapElements();
    124       this.imgMap = ImageIO.read(getClass().getResource("../images/mapLarge.png"));
     124      this.imgMap = ImageIO.read(getClass().getResource("/images/mapLarge.png"));
    125125      map = new Map("map.png", "structInfo2.txt", landMap, structMap, true);
    126126      this.startPoint = new Point(7050, 6150);
     
    165165    Animation anmTitle = new Animation("title", 144, 0, 512, 95, 83, true);
    166166    try {
    167       anmTitle.addFrame(ImageIO.read(getClass().getResource("../images/Frame1.png")));
    168       anmTitle.addFrame(ImageIO.read(getClass().getResource("../images/Frame2.png")));
    169       anmTitle.addFrame(ImageIO.read(getClass().getResource("../images/Frame3.png")));
    170       anmTitle.addFrame(ImageIO.read(getClass().getResource("../images/Frame4.png")));
    171       anmTitle.addFrame(ImageIO.read(getClass().getResource("../images/Frame5.png")));
    172       imgSub = ImageIO.read(getClass().getResource("../images/imgSub.png"));
    173       imgAdd = ImageIO.read(getClass().getResource("../images/imgAdd.png"));
    174       imgSkillSub = ImageIO.read(getClass().getResource("../images/imgSkillSub.png"));
    175       imgSkillAdd = ImageIO.read(getClass().getResource("../images/imgSkillAdd.png"));
     167      anmTitle.addFrame(ImageIO.read(getClass().getResource("/images/Frame1.png")));
     168      anmTitle.addFrame(ImageIO.read(getClass().getResource("/images/Frame2.png")));
     169      anmTitle.addFrame(ImageIO.read(getClass().getResource("/images/Frame3.png")));
     170      anmTitle.addFrame(ImageIO.read(getClass().getResource("/images/Frame4.png")));
     171      anmTitle.addFrame(ImageIO.read(getClass().getResource("/images/Frame5.png")));
     172      imgSub = ImageIO.read(getClass().getResource("/images/imgSub.png"));
     173      imgAdd = ImageIO.read(getClass().getResource("/images/imgAdd.png"));
     174      imgSkillSub = ImageIO.read(getClass().getResource("/images/imgSkillSub.png"));
     175      imgSkillAdd = ImageIO.read(getClass().getResource("/images/imgSkillAdd.png"));
    176176    } catch (IOException ioe) {
    177177      ioe.printStackTrace();
     
    322322      for (int x = 0; x < this.wndTutorials.length; x++) {
    323323        this.wndTutorials[x] = new Window("tut" + x, 0, 0, 800, 600, true);
    324         this.wndTutorials[x].add(new Button("screen", 0, 0, 800, 600, ImageIO.read(getClass().getResource("../images/Tutorial/ss" + (x + 1) + ".png"))));
     324        this.wndTutorials[x].add(new Button("screen", 0, 0, 800, 600, ImageIO.read(getClass().getResource("/images/Tutorial/ss" + (x + 1) + ".png"))));
    325325        this.wndTutorials[x].add(this.wndTutOptions);
    326326        MultiTextbox multiTextbox = new MultiTextbox("text", 305, 5, 490, 100, "", false, font12, metrics);
     
    432432    try {
    433433      imgBow = new BufferedImage[8];
    434       imgBow[0] = ImageIO.read(getClass().getResource("../images/projectiles/bowNN.png"));
    435       imgBow[1] = ImageIO.read(getClass().getResource("../images/projectiles/bowNE.png"));
    436       imgBow[2] = ImageIO.read(getClass().getResource("../images/projectiles/bowEE.png"));
    437       imgBow[3] = ImageIO.read(getClass().getResource("../images/projectiles/bowSE.png"));
    438       imgBow[4] = ImageIO.read(getClass().getResource("../images/projectiles/bowSS.png"));
    439       imgBow[5] = ImageIO.read(getClass().getResource("../images/projectiles/bowSW.png"));
    440       imgBow[6] = ImageIO.read(getClass().getResource("../images/projectiles/bowWW.png"));
    441       imgBow[7] = ImageIO.read(getClass().getResource("../images/projectiles/bowNW.png"));
     434      imgBow[0] = ImageIO.read(getClass().getResource("/images/projectiles/bowNN.png"));
     435      imgBow[1] = ImageIO.read(getClass().getResource("/images/projectiles/bowNE.png"));
     436      imgBow[2] = ImageIO.read(getClass().getResource("/images/projectiles/bowEE.png"));
     437      imgBow[3] = ImageIO.read(getClass().getResource("/images/projectiles/bowSE.png"));
     438      imgBow[4] = ImageIO.read(getClass().getResource("/images/projectiles/bowSS.png"));
     439      imgBow[5] = ImageIO.read(getClass().getResource("/images/projectiles/bowSW.png"));
     440      imgBow[6] = ImageIO.read(getClass().getResource("/images/projectiles/bowWW.png"));
     441      imgBow[7] = ImageIO.read(getClass().getResource("/images/projectiles/bowNW.png"));
    442442      BufferedReader in = new BufferedReader(new FileReader("items.txt"));
    443443      while (in.ready()) {
     
    487487    waterSprites = loadSprites("water");
    488488    try {
    489       passiveAura = ImageIO.read(getClass().getResource("../images/spells/auras/passiveAura.png"));
    490       thornsAura = ImageIO.read(getClass().getResource("../images/spells/auras/thornsAura.png"));
    491       confuseAura = ImageIO.read(getClass().getResource("../images/spells/auras/confuseAura.png"));
    492       sandAura = ImageIO.read(getClass().getResource("../images/spells/auras/sandAura.png"));
     489      passiveAura = ImageIO.read(getClass().getResource("/images/spells/auras/passiveAura.png"));
     490      thornsAura = ImageIO.read(getClass().getResource("/images/spells/auras/thornsAura.png"));
     491      confuseAura = ImageIO.read(getClass().getResource("/images/spells/auras/confuseAura.png"));
     492      sandAura = ImageIO.read(getClass().getResource("/images/spells/auras/sandAura.png"));
    493493    } catch (IOException ioe) {
    494494      ioe.printStackTrace();
     
    499499    BufferedImage[] sprites = new BufferedImage[8];
    500500    try {
    501       sprites[0] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellNN.png"));
    502       sprites[1] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellNE.png"));
    503       sprites[2] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellEE.png"));
    504       sprites[3] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellSE.png"));
    505       sprites[4] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellSS.png"));
    506       sprites[5] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellSW.png"));
    507       sprites[6] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellWW.png"));
    508       sprites[7] = ImageIO.read(getClass().getResource("../images/spells/" + name + "/" + name + "SpellNW.png"));
     501      sprites[0] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellNN.png"));
     502      sprites[1] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellNE.png"));
     503      sprites[2] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellEE.png"));
     504      sprites[3] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellSE.png"));
     505      sprites[4] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellSS.png"));
     506      sprites[5] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellSW.png"));
     507      sprites[6] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellWW.png"));
     508      sprites[7] = ImageIO.read(getClass().getResource("/images/spells/" + name + "/" + name + "SpellNW.png"));
    509509    } catch (IOException ioe) {
    510510      ioe.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.