Package com.jme.math

Examples of com.jme.math.Vector2f


    public void relayout(HUDComponent component) {
        int hudWidth = hud.getWidth();
        int hudHeight = hud.getHeight();

        HUDComponent2D component2D = (HUDComponent2D) component;
        Vector2f positionPercent = positionMap.get(component2D);
        if (positionPercent == null) {
            logger.warning("no position for component: " + component2D);
            return;
        }
        float compX = hud.getX() + positionPercent.x * hudWidth;
 
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public Vector2f getLocation(HUDComponent component) {
        Vector2f location = new Vector2f();

        if ((component != null) && (hudViewMap.containsKey(component))) {
            location.set((float) component.getLocation().getX(),
                    (float) component.getLocation().getY());
        }

        return location;
    }
View Full Code Here

        view.setOrtho(true, false);
        view.setPixelScaleOrtho(WonderlandHUD.HUD_SCALE, false);

        // position the component on the screen.
        if ((view.getType() == View2D.Type.PRIMARY) || (view.getType() == View2D.Type.UNKNOWN)) {
            Vector2f location = (layout != null) ? layout.getLocation(component) : new Vector2f(component.getX(), component.getY());
            component.setLocation((int) location.x, (int) location.y, false);
            view.setLocationOrtho(new Vector2f(location.x + view.getDisplayerLocalWidth() / 2, location.y + view.getDisplayerLocalHeight() / 2), false);
        }

        if (component.getPreferredTransparency() != 1.0f) {
            // component has a preferred transparency, so set it to that
            // transparency initially
View Full Code Here

        }

        HUDView2D view = state.getView();
        if (view != null) {
            // position the component on the screen
            Vector2f location = (layout != null) ? layout.getLocation(component) : new Vector2f(component.getX(), component.getY());
            view.setLocationOrtho(new Vector2f(location.x + view.getDisplayerLocalWidth() / 2, location.y + view.getDisplayerLocalHeight() / 2), true);
        }
    }
View Full Code Here

        }

        HUDView3D view = state.getWorldView();
        if (view != null) {
            Vector3f worldLocation = component.getWorldLocation();
            view.setOffset(new Vector2f(worldLocation.x, worldLocation.y));
            view.applyDeltaTranslationUser(worldLocation);
        }
    }
View Full Code Here

        }

        HUDView2D view = state.getView();
        if (component.getDisplayMode().equals(DisplayMode.HUD)) {
            // moving to HUD
            view.setLocationOrtho(new Vector2f(component.getX(), component.getY()), false);
            view.setOrtho(true);
        } else {
            // moving to world
            // position HUD in x, y
            Vector3f worldLocation = component.getWorldLocation();
            view.setOffset(new Vector2f(worldLocation.x, worldLocation.y));
            view.applyDeltaTranslationUser(worldLocation);
            view.setOrtho(false);
        }
    }
View Full Code Here

            // type UNKNOWN to type POPUP. The HUD component manager explicitly
            // positions views of type UNKNOWN, but must not position views
            // of type POPUP. Fortunately, View2DEntity can be made to
            // re-evaluate its view placement by resetting it's ortho position
            // like this:
            view.setLocationOrtho(new Vector2f());
        }
    }
View Full Code Here

        case DRAG_UPDATE:
            switch (configDragType) {
            case MOVING_PLANAR:
                App2D.invokeLater(new Runnable() {
                    public void run () {
                        view.userMovePlanarUpdate(new Vector2f(dragVectorLocal.x, dragVectorLocal.y));
                    }
                });
                break;
            }
            break;
View Full Code Here

            break;

        case DRAG_UPDATE:
            App2D.invokeLater(new Runnable() {
                public void run () {
                    ((View2DEntity)view).userResizeUpdate(new Vector2f(dragVectorLocal.x, dragVectorLocal.y));
                }
            });
            break;

        case DRAG_FINISH:
View Full Code Here

        this.app = app;
        this.size = new Dimension(width, height);
        this.decorated = decorated;
        if (pixelScale != null) {
            this.pixelScale = new Vector2f(pixelScale);
        }
        this.name = name;

        this.surface = surface;
        surface.setWindow(this);
View Full Code Here

TOP

Related Classes of com.jme.math.Vector2f

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.