diff options
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/pages')
4 files changed, 0 insertions, 290 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java deleted file mode 100644 index 9d71527..0000000 --- a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.polyfrost.oneconfig.gui.pages; - -import io.polyfrost.oneconfig.config.OneConfigConfig; -import io.polyfrost.oneconfig.gui.elements.BasicButton; -import io.polyfrost.oneconfig.lwjgl.RenderManager; -import io.polyfrost.oneconfig.lwjgl.font.Fonts; -import io.polyfrost.oneconfig.lwjgl.image.Images; - -public class HomePage extends Page { - private final BasicButton btn = new BasicButton(184, 36, "Socials", Images.SHARE, Images.LAUNCH, 1, BasicButton.ALIGNMENT_CENTER); - - public HomePage() { - super("Home Dashboard"); - } - - public void draw(long vg, int x, int y) { - RenderManager.drawRoundedRect(vg, x, y, 184, 36, -1, 12f); - RenderManager.drawString(vg, "This is a cool string to test pages", x + 32, y + 72, -1, 36f, Fonts.INTER_BOLD); - RenderManager.drawRoundedRect(vg, x + 350, y + 310, 300, 200, OneConfigConfig.BLUE_600, 14f); - //RenderManager.drawRoundedRect(vg); - btn.draw(vg, x + 432, y + 658); - } - - @Override - public boolean isBase() { - return true; - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java deleted file mode 100644 index 1287f67..0000000 --- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java +++ /dev/null @@ -1,152 +0,0 @@ -package io.polyfrost.oneconfig.gui.pages; - -import io.polyfrost.oneconfig.config.OneConfigConfig; -import io.polyfrost.oneconfig.config.data.OptionPage; -import io.polyfrost.oneconfig.config.interfaces.BasicOption; -import io.polyfrost.oneconfig.gui.elements.BasicButton; -import io.polyfrost.oneconfig.gui.elements.config.ConfigPageButton; -import io.polyfrost.oneconfig.lwjgl.RenderManager; -import io.polyfrost.oneconfig.lwjgl.font.Fonts; - -import java.util.ArrayList; - -public class ModConfigPage extends Page { - private final OptionPage page; - private final ArrayList<BasicButton> categories = new ArrayList<>(); - private String selectedCategory; - - public ModConfigPage(OptionPage page) { - super(page.name); - this.page = page; - if (page.categories.size() == 0) return; - for (String category : page.categories.keySet()) { - selectedCategory = category; - break; - } - if (page.categories.size() < 2) return; - for (String category : page.categories.keySet()) { - BasicButton button = new BasicButton(0, 32, category, null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> switchCategory(category)); - if (category.equals(selectedCategory)) button.setToggled(true); - categories.add(button); - } - } - - @Override - public void draw(long vg, int x, int y) { - if (page.categories.size() == 0) return; - int optionX = x + 30; - int optionY = y + (page.categories.size() == 1 ? 16 : 64); - - // Category buttons - int buttonX = x + 16; - for (BasicButton button : categories) { - if (button.getWidth() == 0) - button.setWidth((int) (Math.ceil(RenderManager.getTextWidth(vg, button.getText(), 14f, Fonts.INTER_MEDIUM) / 8f) * 8 + 16)); - button.draw(vg, buttonX, y + 16); - buttonX += button.getWidth() + 16; - } - - // Top page buttons - for (ConfigPageButton page : page.categories.get(selectedCategory).topPages) { - page.draw(vg, optionX, optionY); - optionY += page.getHeight() + 16; - } - - // Background - if (page.categories.get(selectedCategory).subcategories.keySet().size() > 0) { - int backgroundSize = 16; - for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) { - backgroundSize += 48; - for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) { - BasicOption option = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i); - if (i + 1 < page.categories.get(selectedCategory).subcategories.get(subCategory).size()) { - BasicOption nextOption = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i + 1); - if (option.size == 1 && option.hasHalfSize() && nextOption.size == 1 && nextOption.hasHalfSize()) { - backgroundSize += Math.max(option.getHeight(), nextOption.getHeight()) + 16; - i++; - continue; - } - } - backgroundSize += option.getHeight() + 16; - } - } - RenderManager.drawRoundedRect(vg, x + 14, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20); - } - - // draw options - int optionLastY = optionY + 16; - if (page.categories.get(selectedCategory).subcategories.keySet().size() > 0) { - optionY += 16; - for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) { - RenderManager.drawString(vg, subCategory, optionX, optionY + 16, OneConfigConfig.WHITE_90, 24f, Fonts.INTER_MEDIUM); - optionY += 48; - for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) { - BasicOption option = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i); - option.draw(vg, optionX, optionY); - if (i + 1 < page.categories.get(selectedCategory).subcategories.get(subCategory).size()) { - BasicOption nextOption = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i + 1); - if (option.size == 1 && option.hasHalfSize() && nextOption.size == 1 && nextOption.hasHalfSize()) { - nextOption.draw(vg, optionX + 512, optionY); - optionY += Math.max(option.getHeight(), nextOption.getHeight()) + 16; - i++; - continue; - } - } - optionY += option.getHeight() + 16; - } - } - optionY += 16; - } - - // Bottom page buttons - for (ConfigPageButton page : page.categories.get(selectedCategory).bottomPages) { - page.draw(vg, optionX, optionY); - optionY += page.getHeight() + 16; - } - - // Draw last options - if (page.categories.get(selectedCategory).subcategories.keySet().size() > 0) { - for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) { - optionLastY += 48; - for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) { - BasicOption option = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i); - option.drawLast(vg, optionX, optionLastY); - if (i + 1 < page.categories.get(selectedCategory).subcategories.get(subCategory).size()) { - BasicOption nextOption = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i + 1); - if (option.size == 1 && option.hasHalfSize() && nextOption.size == 1 && nextOption.hasHalfSize()) { - nextOption.drawLast(vg, optionX + 512, optionLastY); - optionLastY += Math.max(option.getHeight(), nextOption.getHeight()) + 16; - i++; - continue; - } - } - optionLastY += option.getHeight() + 16; - } - } - } - } - - @Override - public void finishUpAndClose() { - page.mod.config.save(); - } - - @Override - public void keyTyped(char key, int keyCode) { - if (page.categories.size() == 0) return; - for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) { - for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) { - page.categories.get(selectedCategory).subcategories.get(subCategory).get(i).keyTyped(key, keyCode); - } - } - } - - public void switchCategory(String newCategory) { - if (!page.categories.containsKey(newCategory)) return; - selectedCategory = newCategory; - for (BasicButton button : categories) { - if (button.getText().equals(newCategory)) continue; - button.setToggled(false); - } - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java deleted file mode 100644 index 2db82cc..0000000 --- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java +++ /dev/null @@ -1,76 +0,0 @@ -package io.polyfrost.oneconfig.gui.pages; - -import io.polyfrost.oneconfig.OneConfig; -import io.polyfrost.oneconfig.config.OneConfigConfig; -import io.polyfrost.oneconfig.config.data.Mod; -import io.polyfrost.oneconfig.config.data.ModType; -import io.polyfrost.oneconfig.gui.elements.BasicButton; -import io.polyfrost.oneconfig.gui.elements.ModCard; -import io.polyfrost.oneconfig.lwjgl.RenderManager; -import io.polyfrost.oneconfig.lwjgl.font.Fonts; - -import java.util.ArrayList; -import java.util.List; - -public class ModsPage extends Page { - - private final List<ModCard> modCards = new ArrayList<>(); - private final List<BasicButton> modCategories = new ArrayList<>(); - - public ModsPage() { - super("Mods"); - for (Mod modData : OneConfig.loadedMods) { - modCards.add(new ModCard(modData, null, true, false, false)); - } - for (ModCard card : modCards) { - if (card.isFavorite()) { - modCards.remove(card); - modCards.add(0, card); - } - } - modCategories.add(new BasicButton(64, 32, "All", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(0))); - modCategories.add(new BasicButton(80, 32, "Combat", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(1))); - modCategories.add(new BasicButton(64, 32, "HUD", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(2))); - modCategories.add(new BasicButton(104, 32, "Utility & QoL", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(3))); - modCategories.add(new BasicButton(80, 32, "Hypixel", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(4))); - modCategories.add(new BasicButton(80, 32, "Skyblock", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(5))); - modCategories.add(new BasicButton(88, 32, "3rd Party", null, null, 0, BasicButton.ALIGNMENT_CENTER, true, () -> unselect(6))); - modCategories.get(0).setToggled(true); - } - - public void draw(long vg, int x, int y) { - int iXCat = x + 16; - for (BasicButton btn : modCategories) { - btn.draw(vg, iXCat, y + 16); - iXCat += btn.getWidth() + 8; - } - - int iX = x + 16; - int iY = y + 72; - for (ModCard modCard : modCards) { - if (modCategories.get(0).isToggled() || (modCategories.get(1).isToggled() && modCard.getModData().modType == ModType.PVP) || (modCategories.get(2).isToggled() && modCard.getModData().modType == ModType.HUD) || (modCategories.get(3).isToggled() && modCard.getModData().modType == ModType.UTIL_QOL) || (modCategories.get(4).isToggled() && modCard.getModData().modType == ModType.HYPIXEL) || (modCategories.get(5).isToggled() && modCard.getModData().modType == ModType.SKYBLOCK) || (modCategories.get(6).isToggled() && modCard.getModData().modType == ModType.OTHER)) { - modCard.draw(vg, iX, iY); - iX += 260; - if (iX > x + 796) { - iX = x + 16; - iY += 135; - } - } - } - if (iX == x + 16 && iY == y + 72) { - RenderManager.drawString(vg, "Looks like there is nothing here. Try another category?", x + 16, y + 72, OneConfigConfig.WHITE_60, 14f, Fonts.INTER_MEDIUM); - } - } - - private void unselect(int index) { - for (int i = 0; i < modCategories.size(); i++) { - if (index == i) continue; - modCategories.get(i).setToggled(false); - } - } - - @Override - public boolean isBase() { - return true; - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java deleted file mode 100644 index 91d0efd..0000000 --- a/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.polyfrost.oneconfig.gui.pages; - -import io.polyfrost.oneconfig.lwjgl.RenderManager; -import io.polyfrost.oneconfig.lwjgl.font.Fonts; - -/** - * A page is a 1056x728 rectangle of the GUI. It is the main content of the gui, and can be switched back and forwards easily. All the content of OneConfig is in a page. - */ -public abstract class Page { - protected final String title; - - Page(String title) { - this.title = title; - } - - public abstract void draw(long vg, int x, int y); - - public void finishUpAndClose() { - } - - public String getTitle() { - return title; - } - - public void keyTyped(char key, int keyCode) { - } - - /** - * Overwrite this method and make it return true if you want this to always be the base in breadcrumbs - */ - public boolean isBase() { - return false; - } -} |