Author Topic: New Library And Game  (Read 6514 times)

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #15 on: November 18, 2012, 01:18:08 am »
Looks very...tronish. I like it.

Thank you, that's what I was hoping for. Going to put up the first official version of the library soon, just need to do a tax test on it to see where I need to tweak some things. It's actually turning out better than I had expected, but the game and the library. Thanks to your input, I think I have something that other people may just find useful.
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Re: New Library And Game
« Reply #16 on: November 19, 2012, 10:43:55 pm »
I like it already :D It reminds me my first project for Android: Trace_On

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #17 on: November 20, 2012, 03:41:11 pm »
I like it already :D It reminds me my first project for Android: Trace_On

Cool. I have finally gotten the animation system refined, and the HUD style GUI can be interacted with the mouse and game controller, so the player can choose which they prefer. I just want to finish an animation system for the Canvas GUI before I release an official version of the library. The labels for the elements are actually a dynamic texture class I wrote, combining the TextureEffect interface and BufferedImage to create a "zone" label. That way a single texture can contain one label on top of multiple backgrounds, which can be switched out easily in the HUD elements without having to make too many calls to the hardware. The HUD elements are relatively simple, they're all buttons or dummies, using a parent system you can effect entire groups just by manipulating the parent. So both groups are actually parented to one element, to hide the entire group just hide the parent.

One thing I can't screenshot, the library even has a audio system as well, though it's dependent on Tritonus plugins because I'm too lazy to write my own.

For the actual game demo I will be making better models for the map, though Shiva was just a test model avatar, I'm going to keep it in the demo and likely the finished game because of how well it turned out. If I could save the animated version you'd see why I'm happy with the model.
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #18 on: November 22, 2012, 12:54:10 am »
Alright, I have added a movie player to the canvas GUI system, It's lightweight but effective. It operates by playing a sequence of images from a jar. Pretty simple really.
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #19 on: November 23, 2012, 12:46:11 am »
I know the wiki should be made after I actually test the library completely, but meh, the wiki is not just for this library anyway. Figure I may as well start making all my libraries available, under open source licensing, though really I'll just enforce a cc-By, since I prefer that license over all others. I call it honor-ware.  :P Basically, this is me taking my skill seriously finally, after so long.

Right now I am parking it on my other site, once I get some stuff added based on input from people who use the library, I'll purchase a new domain name for it.

http://digitalnoisegraffiti.com/wiki/
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #20 on: November 23, 2012, 07:24:31 am »
Check these out, other than one tiny mistake I just corrected, these are actual GUI's created by my CanvasGUI system using only a few images. The hex in the background is an image widget, the green symbols in the the second one are all icon images, the rest is pure code, and only one way to make the widgets look.


« Last Edit: November 23, 2012, 10:08:32 pm by KittenKoder »
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: New Library And Game
« Reply #21 on: November 23, 2012, 08:34:12 pm »
Nice. Is it still 3D based or more like 2D blits?

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #22 on: November 23, 2012, 10:04:33 pm »
Nice. Is it still 3D based or more like 2D blits?

Those screencaps are from the CanvasGUI, it's pure Java painting. Though the difference between that and the in game HUD system is minimal. The HUD system, which doesn't have default textures but I could easily write them into it and will be doing so soon, is 2D blitting, and the textures I use are almost identical to the images you see here but using a dynamic texture for printing text or painting onto. I used the regular Swing Canvas for most of the menus because of how light weight it is, but the beauty of it is that the canvas itself can have a backdrop, such as a shot from the GL rendering in some of the earlier screencaps.

It is all animated as well, menus "slide" into and out of view, on both the Canvas and the HUD, by only using a few lines of code, one single animation class, and animation "data" classes. I had to use ArrayLists for animation tracking, which ate up some memory, but there's no telling how many animations will be happening at any given moment so it was a necessary evil. That specific GUI is created with the following code, of course I have added more to it since I made those screencaps:

Code: [Select]
package app;

import java.awt.Color;

import kitt.com.jpct.tex.TextureStored;
import kitt.com.swing.canvas.CanvasButton;
import kitt.com.swing.canvas.CanvasGUI;
import kitt.com.swing.canvas.CanvasLabel;
import kitt.com.swing.canvas.CanvasVideo;
import kitt.com.swing.canvas.CanvasWidget;
import kitt.com.swing.canvas.anim.CanvasAnimationData;
import kitt.com.swing.canvas.data.CanvasImageFont;
import kitt.com.swing.canvas.kits.MenuKit;
import kitt.com.swing.canvas.kits.ToggleMenuKit;
import kitt.com.swing.canvas.kits.WidgetKits;

public class CanvasGUISystem {
    public static final int MODE_CLEAR = 0;
    public static final int MODE_VIDEO = 1;
    public static final int MODE_MAIN = 2;
    public static final int MODE_STATUS = 3;
    public static final int MODE_MODES = 4;
    public static final int MODE_AVATAR = 5;
    public static final int MODE_SYSTEM = 6;
    public static final int MODE_FILES = 6;
   
   
    public static final int STATUS_AVATAR = 0;
    public static final int STATUS_THREADS = 1;
    public static final int STATUS_RAM = 2;
    public static final int STATUS_STORAGE = 3;
    public static final int STATUS_HARDENING = 4;
    public static final int STATUS_SPEED = 5;

    public static final int STATUS_USED_RAM = 6;
    public static final int STATUS_USED_STORAGE = 7;
    public static final int STATUS_USED_HARDENING = 8;
   
    public static final int STATUS_COUNT = 9;
   
    protected CanvasGUI canvas = null;
   
    protected MenuKit mainmenu = null;
    protected CanvasAnimationData mainmenuappear = null;
   
    protected MenuKit statusmenu = null;
    protected CanvasAnimationData statusmenuappear = null;
   
    protected ToggleMenuKit modelist = null;
    protected CanvasAnimationData modelistappear = null;
   
    protected ToggleMenuKit programlist = null;
    protected CanvasAnimationData programlistappear = null;
   
    protected ToggleMenuKit filelist = null;
    protected CanvasAnimationData filelistappear = null;
   
    protected MenuKit filemenu = null;
    protected CanvasAnimationData filemenuappear = null;
   
    protected CanvasWidget statusparent = null;
    protected CanvasLabel[] statusfields = null;
    protected CanvasAnimationData statusappear = null;
   
    protected CanvasLabel logo = null;
    protected CanvasAnimationData logoappear = null;
   
    protected CanvasVideo video = null;
   
    protected TextureStored[] icons = null;
    protected boolean[][] modestates = null;
    protected int currentmode = -1;
   
    protected Color availableprogram = new Color(0,255,255);
    protected Color unavailableprogram = new Color(255,255,0);
    protected Color foreground = new Color(0,255,0);
           
    protected int guimode = 0;
   
    public CanvasGUISystem(CanvasGUI canvas, TextureStored[] icons) {
        this.canvas = canvas;
        this.icons = icons;
       
        CanvasGUI.DEFAULT_DISABLED = new Color(255,0,0,128);
        CanvasGUI.DEFAULT_HOVER = new Color(0,255,0,128);
        CanvasGUI.DEFAULT_PRESSED = new Color(0,0,255,128);
        CanvasGUI.DEFAULT_FOREGROUND = this.foreground;
        CanvasGUI.DEFAULT_BACKGROUND = CanvasGUI.HALFBLACK;

        this.createGUI();
    }
   
    protected void createGUI() {
        this.createLogo();
        this.createMainMenu();
        this.createModeList();
        this.createProgramList();
        this.createStatusMenu();
        this.createStatus();
        this.createFileMenu();
        this.createFileList();
        this.modestates = new boolean[this.modelist.options.length - 1][];
        for(int i = 0; i < this.modestates.length; i++)
            this.modestates[i] = new boolean[this.programlist.options.length];

        CanvasButton button = new CanvasButton(null, "Return\nTo\nGame", 920, 689, 100, 75);
        button.setID("Option-5");
        this.canvas.addWidget(button);

        this.video = new CanvasVideo(null, 50, 50, 924, 668);
        this.video.setFlags(CanvasGUI.IMAGE_STRETCH | CanvasGUI.IMAGE_CENTER);
        this.video.setVisible(false);
        this.canvas.addWidget(this.video);

        this.canvas.sortWidgets();
    }
   
    protected void createLogo() {
        this.logo = new CanvasLabel(null, null, 262, 134, 500, 500);
        this.logo.setFlags(CanvasGUI.SHOWTEXT | CanvasGUI.TEXT_CENTER | CanvasGUI.TEXT_MIDDLE | CanvasGUI.IMAGE_STRETCH);
        this.logo.setZOrder(-1);
        this.logo.setImageFont(new CanvasImageFont(CanvasGUI.IMAGEFONT, 1.5f));
        this.logo.setName("Loading ...");
        for(TextureStored image : this.icons)
            if(image.getName().equals("icon-logo-full"))
                this.logo.setImage(image.getImage());
        this.canvas.addWidget(this.logo);
    }
   
    protected void createMainMenu() {
        CanvasGUI.DEFAULT_FOREGROUND = this.foreground;
        String[][] options = {
                {"Game-Start", "Start"},
                {"Game-Load", "Load"},
                {"Game-Configure", "Settings"},
                {"Game-Delete", "Delete"},
                {"Game-Quit", "Quit"}
            };
        this.mainmenu = WidgetKits.makeMenu(this.canvas, "MainMenu",
                null, 150, 40,
                options, 5, -1);
        this.mainmenu.parent.setLocation(512 - (this.mainmenu.parent.getSize().width / 2), 900);
        this.mainmenu.parent.setVisible(false);
        this.mainmenuappear = CanvasAnimationData.Create(0.0f, -200.0f, 0.05f, true);
    }
   
    protected void createStatusMenu() {
        CanvasGUI.DEFAULT_FOREGROUND = this.foreground;
        String[][] options = {
                {"Status-Play", "Return"},
                {"Status-Avatar", "Avatar"},
                {"Status-Programs", "Programs"},
                {"Status-Files", "Files"},
                {"Status-System", "System"},
                {"Status-Main", "Main Menu"}
            };
        this.statusmenu = WidgetKits.makeMenu(this.canvas, "MainMenu",
                null, 175, 40,
                options, 1, -1);
        this.statusmenu.parent.setLocation(-this.statusmenu.parent.getSize().width, 50);
        this.statusmenu.parent.setVisible(false);
        this.statusmenuappear = CanvasAnimationData.Create(50 + this.statusmenu.parent.getSize().width, 0.0f, 0.05f, true);
    }
   
    protected void createStatus() {
        CanvasGUI.DEFAULT_FOREGROUND = this.availableprogram;
        this.statusparent = new CanvasWidget(null, 100 + this.statusmenu.parent.getSize().width, -500, 500, 500);
        this.statusparent.setFlags(CanvasGUI.BORDER | CanvasGUI.FILL);
        this.statusparent.setBackground(CanvasGUI.HALFBLACK);
        this.statusparent.setForeground(new Color(128,255,128,128));
        this.statusparent.setVisible(false);
        this.canvas.addWidget(this.statusparent);
        this.statusappear = CanvasAnimationData.Create(0.0f, 550.0f, 0.05f, true);
       
        CanvasImageFont font = new CanvasImageFont(CanvasGUI.IMAGEFONT, 1.0f);
       
        CanvasLabel label = new CanvasLabel(this.statusparent, "Avatar:", 10, 10, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "Threads:", 10, 90, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "RAM:", 10, 130, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "/", 340, 130, 20, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_CENTER | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "Storage:", 10, 170, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "/", 340, 170, 20, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_CENTER | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "Hardening:", 10, 210, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "/", 340, 210, 20, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_CENTER | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        label = new CanvasLabel(this.statusparent, "Speed:", 10, 250, 230, 40);
        label.setImageFont(font);
        label.setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
        this.canvas.addWidget(label);
       
        this.statusfields = new CanvasLabel[CanvasGUISystem.STATUS_COUNT];
        for(int i = 0; i < CanvasGUISystem.STATUS_COUNT; i++) {
            if(i == 0) {
                this.statusfields[i] = new CanvasLabel(this.statusparent, "Shiva", 100, 50, 360, 40);
                this.statusfields[i].setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_RIGHT | CanvasGUI.SHOWTEXT);
            } else if(i < CanvasGUISystem.STATUS_USED_RAM) {
                this.statusfields[i] = new CanvasLabel(this.statusparent, "000", 240, 50 + (i * 40), 100, 40);
                this.statusfields[i].setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_RIGHT | CanvasGUI.SHOWTEXT);
            } else {
                this.statusfields[i] = new CanvasLabel(this.statusparent, "000", 360, 130 + ((i - CanvasGUISystem.STATUS_USED_RAM) * 40), 100, 40);
                this.statusfields[i].setFlags(CanvasGUI.TEXT_MIDDLE | CanvasGUI.TEXT_LEFT | CanvasGUI.SHOWTEXT);
            }
            this.statusfields[i].setImageFont(font);
            this.canvas.addWidget(this.statusfields[i]);
        }
    }

    protected void createProgramList() {
        CanvasGUI.DEFAULT_FOREGROUND = this.availableprogram;
       
        String[][] options = {
                {"Program-0", "Buffer"},
                {"Program-1", "Clone"},
                {"Program-2", "Crash Bomb"},
                {"Program-3", "Decode"},
                {"Program-4", "Deflector"},
                {"Program-5", "Firewall"},
                {"Program-6", "Mask"},
                {"Program-7", "Slicer"},
                {"Program-8", "Spy Bot"},
                {"Program-9", "Torrent"}
            };
        String[] iconname = {
                "icon-buffer",
                "icon-clone",
                "icon-crash-bomb",
                "icon-decode",
                "icon-deflector",
                "icon-firewall",
                "icon-mask",
                "icon-slicer",
                "icon-spy-bot",
                "icon-torrent"
            };
        this.programlist = WidgetKits.makeToggleMenu(this.canvas, "ProgramList",
                null, 200, 40,
                options, 2, CanvasGUI.HEXAGONAL | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
                CanvasGUI.TEXT_RIGHT | CanvasGUI.TEXT_MIDDLE | CanvasGUI.FILL  | CanvasGUI.IMAGE_STRETCH);
        this.programlist.parent.setLocation(100 + this.modelist.parent.getSize().width, -this.programlist.parent.getSize().height);
        this.programlist.parent.setVisible(false);
        for (int i = 0; i < this.programlist.options.length; i++) {
            TextureStored icon = null;
            for(int ic = 0; ic < this.icons.length && icon == null; ic++)
                if(this.icons[ic].getName().equals(iconname[i]))
                    icon = this.icons[ic];
            if(icon != null)
                this.programlist.options[i].setImage(icon.getImage());
        }
        this.programlistappear = CanvasAnimationData.Create(0.0f, this.modelist.parent.getY() + this.programlist.parent.getSize().height, 0.05f, true);
    }
   
    protected void createFileList() {
        CanvasGUI.DEFAULT_FOREGROUND = this.availableprogram;
       
        String[][] options = new String[45][];
        for(int i = 0; i < options.length; i++) {
            options[i] = new String[2];
            options[i][0] = "File-" + i;
            options[i][1] = "File (" + (i * 10) + ")";
        }
        this.filelist = WidgetKits.makeToggleMenu(this.canvas, "FileList",
                null, 250, 40,
                options, 3, CanvasGUI.HEXAGONAL | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
                CanvasGUI.TEXT_RIGHT | CanvasGUI.TEXT_MIDDLE | CanvasGUI.FILL  | CanvasGUI.IMAGE_STRETCH);
        this.filelist.parent.setLocation(100 + this.filemenu.parent.getSize().width, -this.filelist.parent.getSize().height);
        this.filelist.parent.setVisible(false);
        this.filelist.parent.setSingleToggle(true);
        this.filelistappear = CanvasAnimationData.Create(0.0f, this.filemenu.parent.getY() + this.filelist.parent.getSize().height, 0.05f, true);
    }

    protected void createModeList() {
        CanvasGUI.DEFAULT_FOREGROUND = this.foreground;
       
        String[][] options = {
                {"Mode-0", "Attacker"},
                {"Mode-1", "Defender"},
                {"Mode-2", "Stealth"},
                {"Mode-3", "Interrogator"},
                {"Mode-4", "Ripper"},
                {"Mode-5", "Tank"},
                {"Mode-6", "Worm"},
                {"Mode-7", "Balance"},
                {"Mode-8", "Spy Bot"},
                {"Mode-9", "Back"}
            };
        this.modelist = WidgetKits.makeToggleMenu(this.canvas, "ModeList",
                null, 150, 40,
                options, 1, CanvasGUI.HEXAGONAL | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
                CanvasGUI.TEXT_CENTER | CanvasGUI.TEXT_MIDDLE | CanvasGUI.FILL  | CanvasGUI.IMAGE_STRETCH);
        this.modelist.parent.setLocation(-this.modelist.parent.getSize().width, 50);
        this.modelist.parent.setVisible(false);
        this.modelist.parent.setSingleToggle(true);
        this.modelistappear = CanvasAnimationData.Create(50.0f + this.modelist.parent.getSize().width, 0.0f, 0.05f, true);
    }
   
    protected void createFileMenu() {
        CanvasGUI.DEFAULT_FOREGROUND = this.foreground;
       
        String[][] options = {
                {"FileAct-PgUp", "< Page"},
                {"FileAct-PgDn", "Page >"},
                {"FileAct-View", "View"},
                {"FileAct-Delete", "Delete"},
                {"FileAct-Upload", "Upload"},
                {"FileAct-Back", "Back"}
            };
        this.filemenu = WidgetKits.makeMenu(this.canvas, "FileMenu",
                null, 150, 40,
                options, 1, CanvasGUI.HEXAGONAL | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
                CanvasGUI.TEXT_CENTER | CanvasGUI.TEXT_MIDDLE | CanvasGUI.FILL  | CanvasGUI.IMAGE_STRETCH);
        this.filemenu.parent.setLocation(-this.filemenu.parent.getSize().width, 50);
        this.filemenu.parent.setVisible(false);
        this.filemenuappear = CanvasAnimationData.Create(50.0f + this.filemenu.parent.getSize().width, 0.0f, 0.05f, true);
    }

    public void mainMenu(String comm) {
        if(comm.equals("Game-Start")) {
            this.changeGUI(CanvasGUISystem.MODE_STATUS);
        } else if(comm.equals("Game-Load")) {
        } else if(comm.equals("Game-Delete")) {
        }       
    }
   
    public void fileMenu(String comm) {
        if(comm.equals("FileAct-View")) {
        } else if(comm.equals("FileAct-PgUp")) {
        } else if(comm.equals("FileAct-PgDn")) {
        } else if(comm.equals("FileAct-Delete")) {
        } else if(comm.equals("FileAct-Upload")) {
        } else if(comm.equals("FileAct-Back")) {
            this.changeGUI(CanvasGUISystem.MODE_STATUS);
            this.filelist.parent.allOffExcept(null);
        }       
    }
   
    public void statusMenu(String comm) {
        if(comm.equals("Status-Avatar")) {
        } else if(comm.equals("Status-Programs")) {
            this.changeGUI(CanvasGUISystem.MODE_MODES);
        } else if(comm.equals("Status-System")) {
//            this.changeGUI(CanvasGUISystem.MODE_SYSTEM);
        } else if(comm.equals("Status-Files")) {
            this.changeGUI(CanvasGUISystem.MODE_FILES);
        } else if(comm.equals("Status-Main")) {
            this.changeGUI(CanvasGUISystem.MODE_MAIN);
        }
    }
   
    public void updateGUI() {
        this.logo.setVisible(
                (this.guimode != CanvasGUISystem.MODE_VIDEO)
            );
        this.video.setVisible(
                (this.guimode == CanvasGUISystem.MODE_VIDEO)
            );
        if(this.guimode== CanvasGUISystem.MODE_CLEAR || this.guimode == CanvasGUISystem.MODE_VIDEO) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);
           
        } else if(this.guimode == CanvasGUISystem.MODE_FILES) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
           
            if(!this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, false);
            if(!this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, false);

        } else if(this.guimode == CanvasGUISystem.MODE_SYSTEM) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);
           
        } else if(this.guimode == CanvasGUISystem.MODE_MAIN) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);

            if(!this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, false);
           
        } else if(this.guimode == CanvasGUISystem.MODE_STATUS) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);
           
            if(!this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, false);
            if(!this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, false);
           
        } else if(this.guimode == CanvasGUISystem.MODE_AVATAR) {
            if(this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, true);
            if(this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);
           
        } else if(this.guimode == CanvasGUISystem.MODE_MODES) {
            if(!this.modelist.parent.isVisible())
                this.canvas.animate(this.modelist.parent, this.modelistappear, false);
            if(!this.programlist.parent.isVisible())
                this.canvas.animate(this.programlist.parent, this.programlistappear, false);
           
            if(this.filelist.parent.isVisible())
                this.canvas.animate(this.filelist.parent, this.filelistappear, true);
            if(this.filemenu.parent.isVisible())
                this.canvas.animate(this.filemenu.parent, this.filemenuappear, true);
            if(this.mainmenu.parent.isVisible())
                this.canvas.animate(this.mainmenu.parent, this.mainmenuappear, true);
            if(this.statusmenu.parent.isVisible())
                this.canvas.animate(this.statusmenu.parent, this.statusmenuappear, true);
            if(this.statusparent.isVisible())
                this.canvas.animate(this.statusparent, this.statusappear, true);
        }
    }
   
    public void changeGUI(int mode) {
        this.guimode = mode;
        this.updateGUI();
    }
   
    public void setLogo(String label) {
        this.logo.setName(label);
    }
   
    public void synchModeList(HUDSystem hud) {
        for(int i = 0; i < this.modelist.options.length; i++) {
            hud.setModeLabel("ModeSet-" + i, this.modelist.options[i].getName());
        }
    }
   
    public boolean[][] getModeStates() {
        return this.modestates;
    }
   
    public void setMode() {
        int modeindex = -1;
        for(int i = 0; i < this.modelist.options.length && modeindex == -1; i++)
            if(this.modelist.options[i].isToggled())
                modeindex = i;
        this.currentmode = modeindex;
        if(modeindex != -1) {
            if(modeindex == 9) {
                this.modelist.options[9].setToggled(false);
                this.changeGUI(CanvasGUISystem.MODE_STATUS);
            } else
                for(int i = 0; i < this.programlist.options.length; i++)
                    this.programlist.options[i].setToggled(this.modestates[modeindex][i]);
        }
    }
   
    public void setProgram(String name) {
        if(this.currentmode != -1) {
            int progindex = -1;
            for(int i = 0; i < this.programlist.options.length && progindex == -1; i++)
                if(this.programlist.options[i].getID().equals(name))
                    progindex = i;
            if(progindex != -1) {
                this.modestates[this.currentmode][progindex] = this.programlist.options[progindex].isToggled();
            }
        }
    }
   
    public void playMovie(String movie) {
        this.video.playMovie(movie);
        this.changeGUI(CanvasGUISystem.MODE_VIDEO);
    }
    public boolean isMovieDone() {
        return this.video.isDone();
    }
    public void endMovie() {
        if(this.video.isPlaying()) {
            this.video.endPlaying();
            this.changeGUI(CanvasGUISystem.MODE_STATUS);
        }
    }
    public void setMoviePause(boolean pause) {
        this.video.setPause(pause);
    }
}

Also, if you sign up for the wiki I have, I'll make you a contributor immediately since my game library depends a lot on jPCT.

I also figured out how to add texture "melting" to objects using the polygon manager. It's a pretty nifty effect, considering working on more such effects. It switches to a texture one polygon at a time based on the time passage, I'll post that class after I submit this.
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #23 on: November 23, 2012, 10:06:20 pm »
The texture "melter" I mentioned, in case anyone wants a cool and simple idea for a special effect on models. The class it extends is first, then the actual melter.

Code: [Select]
package kitt.com.jpct.fx;

import kitt.com.jpct.ext.Object3DEx;

/**
 * Like the animator but more useful for special effect type animations that do not loop.
 * There is no management system for these, they are up to the program to manage. This
 * is due to their intended purpose of being simple effects on objects that do not require a
 * lot of updates.
 *
 * @author kitten
 *
 */
abstract public class ModelEffector {
    protected boolean animating = false;
    protected boolean done = false;
   
    /**
     * Should be set to null when finished animating to prevent holding a reference that may need to be removed.
     */
    protected Object3DEx object = null;
   
    /**
     * @return If there is a current animation in effect.
     */
    public boolean isAnimating() {
        return this.animating;
    }
   
    /**
     * This is a state check, once it's checked the state is cleared.
     *
     * @return If finished.
     */
    public boolean isDone() {
        if(this.done) {
            this.done = false;
            return true;
        }
        return false;
    }
   
    /**
     * @return the object
     */
    public Object3DEx getObject() {
        return object;
    }

    /**
     * @param object the object to set
     */
    public void setObject(Object3DEx object) {
        this.object = object;
    }

    /**
     * @param millis Time passed.
     * @return If still animating.
     */
    abstract public boolean tick(int millis);
}

Code: [Select]
package kitt.com.jpct.fx;

import kitt.com.jpct.ext.Object3DEx;

import com.threed.jpct.PolygonManager;

/**
 * Makes the model appear to melt between textures by changing one polygon at a time.
 *
 * @author kitten
 *
 */
public class ModelTextureMelt extends ModelEffector {
    protected int polys = 0;
    protected int textureid = 0;
    protected int index = 0;
    protected float speed = 4.0f;
    protected float step = 0.0f;
    protected PolygonManager manager = null;
   
    /**
     * @param textureid The texture ID to initialize with.
     */
    public ModelTextureMelt(int textureid) {
        this.textureid = textureid;
    }
   
    /**
     * @return the textureid
     */
    public int getTextureID() {
        return textureid;
    }

    /**
     * @param textureid the textureid to set
     */
    public void setTextureID(int textureid) {
        this.textureid = textureid;
    }

    /* (non-Javadoc)
     * @see kitt.com.jpct.fx.ModelEffector#setObject(kitt.com.jpct.ext.Object3DEx)
     */
    @Override
    public void setObject(Object3DEx object) {
        this.object = object;
        if(object != null) {
            this.manager = object.getPolygonManager();
            this.polys = this.manager.getMaxPolygonID();
            this.index = 0;
        }
    }
   
    /**
     * Triggers a repeat of the exact same animation if an object is set.
     */
    public void trigger() {
        if(this.object != null) {
            this.animating = true;
        }
    }
    /* (non-Javadoc)
     * @see kitt.com.jpct.fx.ModelEffector#tick(int)
     */
    @Override
    public boolean tick(int millis) {
        if(this.animating) {
            this.step += ((float)millis / 10.0f) * this.speed;
            while(this.step >= 1.0f && this.animating) {
                this.step -= 1.0f;
                this.manager.setPolygonTexture(this.index, this.textureid);
                this.index++;
                if(this.index >= this.polys) {
                    this.animating = false;
                    this.done = true;
                    this.index = 0;
                }
            }
        }
        return this.animating;
    }

}
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #24 on: November 27, 2012, 01:25:29 am »
I knew I was going to forget something important prior to an official version. Well, I forgot the all important loading thread, with callable interface. Plus a more simple animation for the canvas, figured I may as well add it into the library since lots of games us lots of looped animations for things. It's similar to the movie widget, it loads the sequence of images from a jar file then displays them, the difference is that instead of the images being loaded "as needed" to conserve memory at the expense of smoothness, it loads all the frames at once. Other than that the two widgets are almost identical, just lightweight image painters.
When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #25 on: November 28, 2012, 06:08:21 am »
It's a huge image, but I have to show off. Now I'm getting serious about the game models:

When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.

Offline KittenKoder

  • int
  • **
  • Posts: 66
  • I Am No One Else
    • View Profile
    • Kitt Games Wiki
Re: New Library And Game
« Reply #26 on: November 29, 2012, 01:35:19 am »
Two more:



When life throws you lemons, make lemon juice, then drop life into a pile of razors and pour the lemon juice over it.