예제 #1
0
 public static void Main(string[] args)
 {
     try
     {
         var minecraftserver = new MinecraftServer();
         if (!GraphicsEnvironment.isHeadless() &&
             ((args.Length <= 0) || !String.instancehelper_equals(args[0], "nogui")))
         {
             ServerGUI.initGui(minecraftserver);
         }
         new ThreadServerApplication("Server thread", minecraftserver).start();
     }
     catch (java.lang.Exception exception1)
     {
         var local1 = ByteCodeHelper.MapException <java.lang.Exception>(exception1, ByteCodeHelper.MapFlags.None);
         if (local1 == null)
         {
             throw;
         }
         java.lang.Exception exception  = local1;
         java.lang.Exception exception2 = exception;
         logger.log(Level.SEVERE, "Failed to start the minecraft server", exception2);
         return;
     }
 }
예제 #2
0
        /// <summary>Returns which Fonts on the system can display the sample string.</summary>
        /// <param name="language">the numerical code for the language to check</param>
        /// <returns>a list of Fonts which can display the sample String</returns>
        public static IList <Font> SupportedFonts(int language)
        {
            if (language < 0 || language > NumLanguages)
            {
                throw new ArgumentException();
            }
            IList <Font> fonts = new List <Font>();

            Font[] systemFonts = GraphicsEnvironment.GetLocalGraphicsEnvironment().GetAllFonts();
            foreach (Font systemFont in systemFonts)
            {
                bool canDisplay = true;
                for (int j = 0; j < unicodeRanges[language].Length; j++)
                {
                    if (systemFont.CanDisplayUpTo(unicodeRanges[language][j]) != -1)
                    {
                        canDisplay = false;
                        break;
                    }
                }
                if (canDisplay)
                {
                    fonts.Add(systemFont);
                }
            }
            return(fonts);
        }
예제 #3
0
        public Q2DataDialog() : base()
        {
            InitComponents();
            VideoMode mode = GraphicsEnvironment.GetLocalGraphicsEnvironment().GetDefaultScreenDevice().GetDisplayMode();
            int       x    = (mode.GetWidth() - GetWidth()) / 2;
            int       y    = (mode.GetHeight() - GetHeight()) / 2;

            SetLocation(x, y);
            dir = home + sep + "Jake2" + sep + "baseq2";
            jTextField1.SetText(dir);
        }
예제 #4
0
 public static bool HasFont(string fontName)
 {
     Font[] systemFonts = GraphicsEnvironment.GetLocalGraphicsEnvironment().GetAllFonts();
     foreach (Font systemFont in systemFonts)
     {
         if (Sharpen.Runtime.EqualsIgnoreCase(systemFont.GetName(), fontName))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
        public virtual int SetMode(Size dim, int mode, bool fullscreen)
        {
            VID.Printf(Defines.PRINT_ALL, "Initializing OpenGL display\\n");
            VID.Printf(Defines.PRINT_ALL, "...setting mode " + mode + ":");
            //if (Globals.appletMode && container == null)
            //{
            //    container = (Container)Globals.applet;
            //}

            if (device == null)
            {
                GraphicsEnvironment env = GraphicsEnvironment.GetLocalGraphicsEnvironment();
                device = env.GetDefaultScreenDevice();
            }

            if (oldDisplayMode == null)
            {
                oldDisplayMode = device.GetDisplayMode();
            }

            if (!VID.GetModeInfo(out var newDim, mode))
            {
                VID.Printf(Defines.PRINT_ALL, " invalid mode\\n");
                return(Base.rserr_invalid_mode);
            }

            VID.Printf(Defines.PRINT_ALL, " " + newDim.Width + " " + newDim.Height + '\\');
            if (!Globals.appletMode)
            {
                if (window != null)
                {
                    Shutdown();
                }
                window    = new Frame("Jake2 (jsr231)");
                container = window;
                ImageIcon icon = new ImageIcon(GetType().GetResource("/icon-small.png"));
                window.SetIconImage(icon.GetImage());
                window.SetLayout(new GridBagLayout());
                window.AddWindowListener(new AnonymousWindowAdapter(this));
            }

            if (Globals.appletMode)
            {
                Shutdown();
                fullscreen = false;
                JOGLKBD.Init(container);
            }

            Display canvas = new Display(new GLCapabilities());

            canvas.SetFocusTraversalKeysEnabled(false);
            canvas.SetSize(newDim.Width, newDim.Height);
            GridBagConstraints gbc = new GridBagConstraints();

            gbc.fill    = GridBagConstraints.BOTH;
            gbc.weightx = gbc.weighty = 1;
            container.AddComponentListener(JOGLKBD.listener);
            canvas.AddKeyListener(JOGLKBD.listener);
            canvas.AddMouseListener(JOGLKBD.listener);
            canvas.AddMouseMotionListener(JOGLKBD.listener);
            canvas.AddMouseWheelListener(JOGLKBD.listener);
            if (fullscreen)
            {
                container.Add(canvas, gbc);
                VideoMode VideoMode = FindDisplayMode(newDim);
                newDim.Width  = VideoMode.GetWidth();
                newDim.Height = VideoMode.GetHeight();
                window.SetUndecorated(true);
                window.SetResizable(false);
                device.SetFullScreenWindow(window);
                if (device.IsFullScreenSupported())
                {
                    device.SetDisplayMode(VideoMode);
                }
                window.SetLocation(0, 0);
                window.SetSize(VideoMode.GetWidth(), VideoMode.GetHeight());
                canvas.SetSize(VideoMode.GetWidth(), VideoMode.GetHeight());
                VID.Printf(Defines.PRINT_ALL, "...setting fullscreen " + GetModeString(VideoMode) + '\\');
            }
            else
            {
                if (!Globals.appletMode)
                {
                    container.Add(canvas, gbc);
                    Frame f2 = window;
                    try
                    {
                        EventQueue.InvokeAndWait(new AnonymousRunnable(this));
                    }
                    catch (Exception e)
                    {
                        e.PrintStackTrace();
                    }
                }
                else
                {
                    Display fd = canvas;
                    try
                    {
                        EventQueue.InvokeAndWait(new AnonymousRunnable1(this));
                    }
                    catch (Exception e)
                    {
                        e.PrintStackTrace();
                    }
                }
            }

            if (!Globals.appletMode)
            {
                while (!canvas.IsDisplayable() || !window.IsDisplayable())
                {
                    try
                    {
                        Thread.Sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                }
            }

            canvas.RequestFocus();
            this.display = canvas;
            SetGL(display.GetGL());
            Init(0, 0);
            return(Base.rserr_ok);
        }