Package transientlibs.preui.objects.gui.interfaces

Examples of transientlibs.preui.objects.gui.interfaces.IMarker


    }

    public IMarker spawnMarker(int byTypeCode, int setX, int setY, IFont setFont, int setImage, int setHoveredImage) {


        IMarker result = null;


        //Marker
        if (byTypeCode == MarkerType) {
           
            Log.info("Spawn marker");
           
            IImage assignImage = Detonator.INSTANCE.imageProvider.getImage(setImage);
            result = new Marker(assignImage, assignImage, setX, setY);
        }

        //AnimationMarker
        if (byTypeCode == AnimationMarkerType) {

            Log.notImplemented();
            //AnimationMarker preresult = new AnimationMarker(setX, setY, Animations.getAnimationByID(setImage));
            //preresult.animation = Animations.getAnimationByID(setImage).animation;
            //result = preresult;
        }


        //ButtonGroup
        if (byTypeCode == ButtonGroupType) {
            IImage assignImage;
            if (setImage != -1) {
                assignImage = Detonator.INSTANCE.imageProvider.getImage(setImage);
            } else {
                assignImage = null;
            }

        }


        //TextMarker
        if (byTypeCode == TextMarkerType) {

            Log.info("Spawn textmarker");
           
            IImage assignImage;
            if (setImage != -1) {
                assignImage = Detonator.INSTANCE.imageProvider.getImage(setImage);
            } else {
                assignImage = null;
            }

            IImage assignHoveredImage;
            if (setHoveredImage != -1) {
                assignHoveredImage = Detonator.INSTANCE.imageProvider.getImage(setHoveredImage);
            } else {
                assignHoveredImage = assignImage;
            }
           
            //if (assignImage == null) {
            //    Log.warn("Creating TextMarker with no image");
            //}
           
           
            result = new TextMarker(assignImage, assignHoveredImage, setX, setY, -1);


            ((TextMarker) result).originalImage = Detonator.INSTANCE.imageProvider.getImage(setImage);

            if (((TextMarker) result).originalImage == null) {
                ((TextMarker) result).maxWidth = 200;
            }
            ((TextMarker) result).setText("");

            if (setFont != null) {
                ((TextMarker) result).setFont(setFont);
                //((TextMarker) result).fontReference = setFont;
            } else {
                ((TextMarker) result).setFont(Detonator.INSTANCE.fontProvider.getDefaultFont());
                //((TextMarker) result).fontReference = Detonator.INSTANCE.fontProvider.defaultFont;

            }


        }


        //Text Info
        if (byTypeCode == TextInfoType) {
            if (setFont != null) {
                result = new TextInfo(setX, setY, "Text", -1, setFont);
                ((TextInfo) result).font = setFont;
                ((TextInfo) result).canBeClicked = true;
            } else {

                result = new TextInfo(setX, setY, "Text", -1, Detonator.INSTANCE.fontProvider.getDefaultFont());
                ((TextInfo) result).font = Detonator.INSTANCE.fontProvider.getDefaultFont();
                ((TextInfo) result).canBeClicked = true;
            }

        }



        if (byTypeCode == TextBoxType) {
            result = new TextBox(setX, setY, null, " ", setFont);
        }

        if (byTypeCode == ButtonGroupType) {
            result = new ButtonGroup(setX, setY, setFont, null);
            //Log.info("image: "+setImage);
            if (setImage != -1) {
                result.setImage(Detonator.INSTANCE.imageProvider.getImage(setImage));
            }
        }

        if (byTypeCode == InfoGroupType) {
            result = new InfoGroup(setX, setY, setFont, null);
            if (setImage != -1) {
                result.setImage(Detonator.INSTANCE.imageProvider.getImage(setImage));
            }
        }


        ((Marker) result).originalImage = Detonator.INSTANCE.imageProvider.getImage(setImage);
View Full Code Here


            //Log.info("Load element: "+analyst.fullStr);
            //1 Type
            int setType = Binding.readBinding(Binding.interfaceTypeBinding, analyst.getNextString());

            IMarker setMarker;

            //2 ID
            String markerCode = analyst.getNextString();
            Binding.getBinding(Binding.interfaceElementBinding, markerCode);

            //3 X
            int CoordsX = analyst.getNextNumber();
            //4 Y
            int CoordsY = analyst.getNextNumber();

            int fontID = -1;
            int SizeX = -1;
            int setImage;

            //67948999
            //5 image
            analyst.getNextString();
            if (!"-".equals(analyst.lastStr)) {

                if (setType != ElementFactory.AnimationMarkerType) {
                   
                    if (Detonator.INSTANCE.useGDXImages == false) {
                setImage = Binding.readBinding(Binding.transientImageBinding, analyst.lastStr);
                    } else {
                setImage = Binding.readBinding(Binding.transientImageBinding, analyst.lastStr);       
                    }
                   
                } else {
                setImage = Binding.readBinding(Binding.animationBinding, analyst.lastStr);
                }

                //Log.info("attached image " + analyst.lastStr);
            } else {
                setImage = -1;
            }


            //String markerText = "";

            if (setType != ElementFactory.MarkerType) {

                //6 font               
                String fontName = analyst.getNextString();
                //Log.info("read font: "+fontName);
                //fontID = Binding.readBinding(Binding.fontBinding, analyst.getNextString());
                        fontID = Binding.readBinding(Binding.fontBinding, fontName);
                //7 size
                //Log.info("read size");
                SizeX = analyst.getNextNumber();
               
               
                //markerText = analyst.restOfRow();
            }



            //if (setType == TextInfoType) {

            //}




            IMarker newMarker = Detonator.INSTANCE.elementFactory.spawnMarker
                    (setType, CoordsX, CoordsY, Detonator.INSTANCE.fontProvider.getFont(fontID), setImage);
           
            //if (setType != MarkerType) && () {
            Detonator.INSTANCE.bindGlobalInterfaceElement(markerCode, newMarker);
            //}


/*

            if (setType == TextBoxType) {
                setMarker = new TextBox(CoordsX, CoordsY, null, " ", Fonts.getFontByID(fontID).font);
            } else

                if (setType == ButtonGroupType) {
                setMarker = new ButtonGroup(CoordsX, CoordsY, Fonts.getFontByID(fontID).font, null);
                //Log.info("image: "+setImage);
                if (setImage != -1) {
                    setMarker.setImage(Images.getImageByID(setImage));
                }
            } else if (setType == InfoGroupType) {
                setMarker = new InfoGroup(CoordsX, CoordsY, Fonts.getFontByID(fontID).font, null);
                if (setImage != -1) {
                    setMarker.setImage(Images.getImageByID(setImage));
                }


            } else if (setType == TextInfoType) {
                setMarker = new TextInfo(CoordsX, CoordsY, " ", -1, Fonts.getFontByID(fontID).font);
                ((TextInfo) setMarker).fontReference = Fonts.getFontByID(setType);
                ((TextInfo) setMarker).canBeClicked = true;
                //((TextInfo)setMarker).setText(markerText);
            } else if (setType == MarkerType) {
                setMarker = new Marker(Images.getImageByID(setImage), Images.getImageByID(setImage), CoordsX, CoordsY);
                setMarker.originalImage = Images.getImagesByID(setImage);
            } else if (setType == TextMarkerType) {
                setMarker = new TextMarker(Images.getImageByID(setImage), Images.getImageByID(setImage), CoordsX, CoordsY, -1);
                setMarker.originalImage = Images.getImagesByID(setImage);
                ((TextMarker) setMarker).fontReference = Fonts.getFontByID(setType);
            } if (setType == AnimationMarkerType) {
                //setMarker = ElementFactory.GenericFactory.generateMarker(setType, CoordsX, CoordsY, Fonts.getFontByID(fontID), setImage);
                setMarker = newMarker;
            }

            else {
                setMarker = null;
            }
*/
            setMarker = newMarker;

            if (setImage == -1) {
                ((Marker)setMarker).imageWidth = SizeX;
                ((Marker)setMarker).maxWidth = SizeX;
            } else {
                ((Marker)setMarker).maxWidth = ((Marker)setMarker).imageWidth;
                //Log.info("max");
            }



            //Detonator.INSTANCE.interfaceElements.put(markerCode, setMarker);
            //Detonator.INSTANCE.interfaceElementList.add(setMarker);
            //setMarker.stringID = markerCode;

            Detonator.INSTANCE.interfaceElements.put(markerCode, newMarker);
            Detonator.INSTANCE.interfaceElementList.add(newMarker);
            newMarker.setStringID (markerCode);

            //Log.info("Element " + markerCode + " was added.");

            if (setImage == -1) {
                ((Marker)newMarker).imageWidth = SizeX;
View Full Code Here

TOP

Related Classes of transientlibs.preui.objects.gui.interfaces.IMarker

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.