-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from OrangeBetaStar/SystemWide_ImageLoad
System wide image load improvement
- Loading branch information
Showing
47 changed files
with
328 additions
and
262 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package start; | ||
|
||
import java.awt.image.BufferedImage; | ||
|
||
// TODO: Create exception for no description or image | ||
|
||
// This class will be a wrapper class of String (for description) and BufferedImage (image) as having list of BufferedImage would be too messy and inefficient. | ||
|
||
public class ImageDesc { | ||
|
||
private String imageDescription; | ||
private BufferedImage imageItself; | ||
|
||
public ImageDesc(String imageDescription, javaxt.io.Image imageItself) { | ||
this.imageDescription = imageDescription; | ||
this.imageItself = imageItself.getBufferedImage(); | ||
} | ||
|
||
public ImageDesc(String imageDescription, BufferedImage imageItself) { | ||
this.imageDescription = imageDescription; | ||
this.imageItself = imageItself; | ||
} | ||
|
||
public String getImageDescription() { | ||
return imageDescription; | ||
} | ||
|
||
public BufferedImage getImageItself() { | ||
return imageItself; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package start; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.util.ArrayList; | ||
import java.util.LinkedList; | ||
|
||
public class ImageLoader { | ||
|
||
private String RESOURCE_PATH; | ||
private ArrayList<ImageDesc> load_first_images = new ArrayList<ImageDesc>(); | ||
private ArrayList<ImageDesc> vectorImages = new ArrayList<ImageDesc>(); | ||
private ArrayList<ImageDesc> bg_images = new ArrayList<ImageDesc>(); | ||
|
||
public ImageLoader(String RESOURCE_PATH) { | ||
this.RESOURCE_PATH = RESOURCE_PATH; | ||
} | ||
|
||
public ArrayList<ArrayList<ImageDesc>> imgCompiler (LinkedList<String> fileList) { | ||
for(String loadImage : fileList) { | ||
loadImage = loadImage.toLowerCase(); | ||
// This will look inside resource folder and automatically load the images according to file names. | ||
if(loadImage.contains("load_first")) { | ||
if(loadImage.contains("startscreen_elementsheet")) { | ||
ImageSlicer systemButtons = new ImageSlicer(500, 200, RESOURCE_PATH + loadImage, true); | ||
BufferedImage[] systemImages = systemButtons.getSprites(); | ||
for(int a = 0; a < systemImages.length; a++) { | ||
load_first_images.add(new ImageDesc(Integer.toString(a), systemImages[a])); | ||
} | ||
} | ||
// Any images that are used in effects (used with scaleVec like things) | ||
else {//if(loadImage.contains("whitebox")) { | ||
vectorImages.add(new ImageDesc(loadImage, new javaxt.io.Image(RESOURCE_PATH + loadImage))); | ||
} | ||
} | ||
else if(loadImage.contains("bg")) { | ||
//System.out.println("What's the loadImage's name? " + loadImage); | ||
bg_images.add(new ImageDesc(loadImage, new javaxt.io.Image(RESOURCE_PATH + loadImage))); | ||
} | ||
} | ||
|
||
ArrayList<ArrayList<ImageDesc>> imagePackage = new ArrayList<ArrayList<ImageDesc>>(); | ||
imagePackage.add(load_first_images); | ||
imagePackage.add(vectorImages); | ||
imagePackage.add(bg_images); | ||
|
||
return imagePackage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package start; | ||
|
||
public enum ImageSelector { | ||
BUTTONS(0), | ||
VECTOR(1), | ||
BACKGROUND(2), | ||
CHARACTERS(3); // Not implemented yet | ||
|
||
private int value; | ||
|
||
private ImageSelector(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-541 Bytes
(78%)
WaifuBrew/target/classes/start/ConfigPane$Handlerclass.class
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
WaifuBrew/target/classes/start/CustomSlider$Handlerclass.class
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
WaifuBrew/target/classes/start/FindFile$GenericExtFilter.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
WaifuBrew/target/classes/start/StartScreen$Handlerclass.class
Binary file not shown.
Binary file not shown.
Binary file not shown.