Package net.sf.jiga.xtended.impl

Examples of net.sf.jiga.xtended.impl.Animation


    @Override
    protected void doLoadOnGL(RenderingScene context) {
        super.doLoadOnGL(context);
        RenderingScene._GLloadSprite((Sprite) gui.getCacheEntry("GFX_BACKGROUND_SCROLLING"), context);
        RenderingScene._GLloadSprite((Sprite) gui.getCacheEntry("GFX_CHARACTER_ICON"), context);
        Animation anim = (Animation) gui.getCacheEntry("GFX_VSLOGO");
        vsLogo = RenderingScene._GLloadAnim(anim, (RenderingScene) context, RenderingScene.PTY_ANIM);
        vsLogoBds = anim.getBounds();
    }
View Full Code Here


        panelPlay.add(sw_state);
        final AbstractAction action_play = new AbstractAction("(ALT+P)", UIMessage._getIcon(UIMessage.PLAYER_PLAY_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    if (animator instanceof javax.swing.Timer) {
                        if (!animator.isRunning()) {
                            animator.start();
                        }
                    } else {
                        animator = new javax.swing.Timer((int) character.getFrameRate(), new ActionListener() {

                            public void actionPerformed(ActionEvent e) {
                                if (modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD) instanceof JComponent) {
                                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                                    comp.paintImmediately(0, 0, comp.getWidth(), comp.getHeight());
                                }
                            }
                        });
                        animator.start();
                    }
                    anim.play();
                }

                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        };

        panelPlay.add(new JButton(action_play));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PAUSE_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        }));
        panelPlay.add(new JButton(modelPanel.action_playSfx));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PREVIOUS_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.stop();
                    anim.rewind();
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }
                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
                sw_state.repaint();
            }
        }));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FB_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    anim.position(Math.max(0, anim.getPosition() - 1));
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
                sw_state.repaint();
            }
        }));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FF_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    anim.position(Math.min(anim.length() - 1, anim.getPosition() + 1));
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        }));
        panelPlay.add(this.sw_refresh = new JButton("refresh", UIMessage._getIcon(UIMessage.REFRESH_TYPE, false)));
        sw_refresh.addActionListener(new ActionListener() {
View Full Code Here

    @Override
    protected void doLoad() {
        super.doLoad();
        RenderingScene rsc = getRenderingScene();
        Animation a = RenderingScene._getLogoAnimation(rsc, "/net/sf/jiga/xtended/impl/flame", 1, 16, "flame-", ".png", new Dimension(145, 256));
        a.setFrameRate(Math.round(1000. / 8.));
        tm.loadDefaults(rsc.isLWJGLAccel());
        tm.getImodel().loadResource();
        if (tm.getImodel() instanceof KeyEventDispatcher) {
            rsc.addKeyboardEventsDispatcher((KeyEventDispatcher) tm.getImodel());
        }
View Full Code Here

        rs.setDrawFPSEnabled(true);
        rs.setConsoleEnabled(false);
        rs.getPrintStream().println("WELCOME TO " + getClass().getPackage().getSpecificationTitle() + " v." + getClass().getPackage().getSpecificationVersion() + " !");
        rs.addActionOffscreen(TestGameActionLayer.this);

        final Animation anim = RenderingScene._getLogoAnimation(applet, "/net/sf/jiga/xtended/impl/opengl", 0, 29, "", ".png", new Dimension(64, 30));
        anim.setReverseEnabled(true);
        JComponent renderSettingsPreview = Animation._makeAnimationJComponent(anim);
        javax.swing.Timer animT = new javax.swing.Timer(10, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                anim.play();
            }
        });
        animT.start();
        final JPanel centerPanel = new JPanel(new GridBagLayout(), true);
        GridBagConstraints c = new GridBagConstraints();
        renderSettingsPreview.setPreferredSize(new Dimension(anim.getWidth() * 3, anim.getHeight() * 3));
        centerPanel.add(renderSettingsPreview, c);
        // TODO : splitpane
        applet.add(centerPanel, BorderLayout.CENTER);
        final JMenu menu = new JMenu("Scene");
        menu.addActionListener(new ActionListener() {
View Full Code Here

                if (DebugMap._getInstance().isDebuggerEnabled(RenderingSceneGL.class)) {
                        System.out.print(" ModelGLHandler size " + modelHdr.getGLcache().keySet().size() + "...");
                }
                synchronized (anims) {
                        for (final int a : anims.keySet()) {
                                final Animation anim = anims.get(a);
                                anim.setRenderingScene(scene);
                                if (anim != null) {
                                        List<LoadListener2> lls = Collections.synchronizedList(new ArrayList<LoadListener2>());
                                        lls.add(new LoadAdapter() {
                                                @Override
                                                public void loadIsComplete() {
                                                        super.loadIsComplete();
                                                        synchronized (loadlisteners) {
                                                                for (LoadListener2 ll : loadlisteners) {
                                                                        ll.loadProgress(a, anims.keySet().size() - 1);
                                                                        if (a == (anims.keySet().size() - 1)) {
                                                                                ll.loadIsComplete();
                                                                        }
                                                                }
                                                        }
                                                }

                                                @Override
                                                public int hashLinkToGLObject() {
                                                        return anim.hashCode();
                                                }

                                                @Override
                                                public void loadError(Object error) {
                                                        super.loadError(error);
View Full Code Here

     *
     * @param record the record key to select
     */
    private void setSelectedAnimation(int record) {
        SortedMap<Integer, Animation> c = model.accessSynchCache();
        Animation animation = c.get(record);
        if (animation instanceof Animation) {
            if (currentRecord.get(ModelAnimBrowser.CURRENTRECORD) instanceof JComponent) {
                currentRecord.get(ModelAnimBrowser.CURRENTRECORD).setBackground(getBackground());
                currentRecord.get(ModelAnimBrowser.CURRENTRECORD).setEnabled(false);
            }
            currentRecord.put(ModelAnimBrowser.CURRENTRECORD, records.get(record));
            records.get(record).setBackground(bgColor.get(ModelAnimBrowser.ATT_BGCOLOR));
            records.get(record).setEnabled(true);
            Animation oldSelection = c.get(currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
            currentRecordKey.put(ModelAnimBrowser.CURRENTRECORDKEY, record);
            JScrollBar h = modelPanelSp.getHorizontalScrollBar();
            JScrollBar v = modelPanelSp.getVerticalScrollBar();
            float targetX = (float) h.getMinimum() + (float) records.get(record).titlePanel.getX() / (float) getWidth() * (float) (h.getMaximum() - h.getMinimum());
            float targetY = (float) v.getMinimum() + (float) records.get(record).titlePanel.getY() / (float) getHeight() * (float) (v.getMaximum() - v.getMinimum());
View Full Code Here

        timePan.add(sw_position, BorderLayout.CENTER);
        sw_position.setPaintTrack(true);
        sw_position.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                Animation animRecord = animations.get(ModelAnimBrowser.this.record);
                if (animRecord.getState() != Animation.PLAYING) {
                    repaint();
                }

                if (JXAenvUtils._debug) {
                    System.out.println("position changed");
View Full Code Here

        Point translate = getCanvasOrigin();
        g.translate(translate.x, translate.y);
        if (JXAenvUtils._debug) {
            System.err.println("MODELPANEL PAINT");
        }
        Animation animRecord = animations.get(record);
        animRecord.setSize(model.getDisplaySize(browser.resolution.get(ATT_RESOLUTION)));
        animRecord.setDebugEnabled(model.isDebugEnabled());
        String names = "";
        for (String n : browser.animsID.get(ATT_ANIMSID)[record]) {
            names += n + " | ";
        }
        titlePanel.setTitle(names + " : " + animRecord.getStartingFrame() + " - " + (animRecord.getStartingFrame() + animRecord.length - 1) + " (" + animRecord.realTimeLength() + "ms)");
        Animation current = animations.get(browser.currentRecordKey.get(CURRENTRECORDKEY));
        if (current instanceof Animation) {
            sw_state.setText(animationState(current.getState()) + " [" + current.getPosition() + "]");
        }

        animRecord.setReverseEnabled(reverseSwitch.isSelected());
        /*
         * if (animRecord.getZoomValue() != browser.zoom.get(record)) {
View Full Code Here

     */
    public void mouseDragged(MouseEvent e) {
        if (JXAenvUtils._debug) {
            System.err.println(e);
        }
        Animation current = animations.get(record);
        Rectangle cursor = mouse_getCursorBounds(e);
        int animator = current.getPosition();
        Point drag = new Point((int) cursor.getCenterX() - dragLocX, (int) cursor.getCenterY() - dragLocY);
        if (JXAenvUtils.env.OS_MAC.isEnv() ? e.isMetaDown() : e.isControlDown()) {
            if (newLoc instanceof Point) {
                /**
                 * move the animation frame default location from model location
View Full Code Here

     */
    public void mouseMoved(MouseEvent e) {
        if (JXAenvUtils._debug) {
            System.err.println(e);
        }
        Animation animRecord = animations.get(record);
        if (!browser.isResourceLoaded()) {
            return;
        }
        if (e.isAltDown()) {
            mouse_updateCursor(mouse_computeOutcode(browser.collisionsAtk_map.get(record).get(animRecord.getPosition()), mouse_getCursorBounds(e)), e);
        } else if (JXAenvUtils.env.OS_MAC.isEnv() ? e.isMetaDown() : e.isControlDown()) {
            Point loc = browser.locations_map.get(record).get(animRecord.getPosition());
            mouse_updateCursor(new Point((int) Math.round(loc.getX() * browser.zoom.get(record)), (int) Math.round(loc.getY() * browser.zoom.get(record))), e);
        } else {
            mouse_updateCursor(mouse_computeOutcode(browser.collisionsDef_map.get(record).get(animRecord.getPosition()), mouse_getCursorBounds(e)), e);
        }
        if (JXAenvUtils.env.OS_MAC.isEnv() ? e.isMetaDown() : e.isControlDown()) {
            mouseDragged(e);
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.jiga.xtended.impl.Animation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.