gdx-studio
git clone https://git.pyrossh.dev/gdx-studio
An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop
src/gdxstudio/Icon.java
| a9b2a64 | 1 | package gdxstudio; |
| a62d533 | 2 | import java.io.IOException; |
| a62d533 | 3 | import java.io.InputStream; |
| a62d533 | 4 | import java.net.URL; |
| a62d533 | 5 | import java.util.HashMap; |
| a62d533 | 6 | |
| a62d533 | 7 | import javax.swing.ImageIcon; |
| a62d533 | 8 | |
| a62d533 | 9 | import org.fife.ui.rsyntaxtextarea.Theme; |
| a62d533 | 10 | |
| a9b2a64 | 11 | import scene2d.Asset; |
| a9b2a64 | 12 | |
| a62d533 | 13 | public class Icon {
|
| a62d533 | 14 | |
| a62d533 | 15 | static String[] iconsList = new String[]{
|
| a62d533 | 16 | "icon", "vs", "eclipse", "dark", "idea", |
| a62d533 | 17 | "trash", "help", "szoomout", "szoomin", |
| a9b2a64 | 18 | "sweblaf", "update", "stexturepacker", "sparticle", "snuke", |
| a62d533 | 19 | "slibGDX", "shierologo", "shiero", "search", "screen", "sabout", |
| a62d533 | 20 | "packer", "options", "newprj", "newpack", "newfile", "lib", "level", |
| a62d533 | 21 | "high", "font", "find", "esource", "epackage", |
| a62d533 | 22 | "eopen", "emusic", "empty", "eimage", "efile", "editor", "console", |
| a62d533 | 23 | "color", "up","down", |
| a62d533 | 24 | "resume", "pause", "go", "stop", "export","new","copy", "cut", "paste", "refresh", |
| a62d533 | 25 | "home", "properties", |
| a62d533 | 26 | "java", "warning", "error", "updown", "studio", "bookmark" |
| a62d533 | 27 | }; |
| a62d533 | 28 | |
| a62d533 | 29 | // Icons |
| a62d533 | 30 | private static HashMap<String, ImageIcon> iconMap = new HashMap<String, ImageIcon>(); |
| a62d533 | 31 | public static void loadIcons(){
|
| a62d533 | 32 | for(String f : iconsList){
|
| a62d533 | 33 | //SinkStudio.log(f); |
| a62d533 | 34 | iconMap.put(f, loadIcon(f+".png")); |
| a62d533 | 35 | } |
| a62d533 | 36 | } |
| a62d533 | 37 | |
| a62d533 | 38 | public static ImageIcon icon(String name){
|
| a62d533 | 39 | return iconMap.get(name); |
| a62d533 | 40 | } |
| a62d533 | 41 | |
| a62d533 | 42 | public static Theme loadTheme(String name){
|
| a62d533 | 43 | try{
|
| a62d533 | 44 | return Theme.load(getResourceAsStream(name+".xml")); |
| a62d533 | 45 | } |
| a62d533 | 46 | catch ( IOException e ){
|
| a62d533 | 47 | e.printStackTrace (); |
| a62d533 | 48 | } |
| a62d533 | 49 | return null; |
| a62d533 | 50 | } |
| a62d533 | 51 | |
| a62d533 | 52 | public static ImageIcon loadIcon(String path){
|
| a62d533 | 53 | return new ImageIcon(Icon.getResource(path)); |
| a62d533 | 54 | } |
| a62d533 | 55 | |
| a62d533 | 56 | public static InputStream getResourceAsStream(String path){
|
| a62d533 | 57 | return Asset.class.getClassLoader().getResourceAsStream(path); |
| a62d533 | 58 | } |
| a62d533 | 59 | |
| a62d533 | 60 | public static URL getResource(String path){
|
| a62d533 | 61 | return Asset.class.getClassLoader().getResource(path); |
| a62d533 | 62 | } |
| a62d533 | 63 | } |