Exemple #1
0
        // private static final Logger log = LoggerFactory.getLogger(TestbedMain.class);
        public static void Main(string[] args)
        {
            // try {
            // UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
            // } catch (Exception e) {
            // log.warn("Could not set the look and feel to nimbus.  "
            // + "Hopefully you're on a mac so the window isn't ugly as crap.");
            // }
            TestbedModel model = new TestbedModel();
            TestbedController controller = new TestbedController(model, UpdateBehavior.UPDATE_CALLED,
                MouseBehavior.NORMAL, new MonoGameTestbedError());

            using (var game = new TestBedGame(model))
            {

                game.Run();
            }

            //        ;
            //        TestPanelJ2D panel = new TestPanelJ2D(model, controller);
            //        model.setPanel(panel);
            //        model.setDebugDraw(new DebugDrawJ2D(panel, true));
            //        TestList.populateModel(model);

            //        JFrame testbed = new JFrame();
            //        testbed.setTitle("JBox2D Testbed");
            //        testbed.setLayout(new BorderLayout());
            //        TestbedSidePanel side = new TestbedSidePanel(model, controller);
            //        testbed.add((Component) panel, "Center");
            //        testbed.add(new JScrollPane(side), "East");
            //        testbed.pack();
            //        testbed.setVisible(true);
            //        testbed.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //        System.out.
            //        println(System.getProperty("java.home"));

            //        SwingUtilities.invokeLater(new Runnable()
            //        {
            //            @Override
            //        public void run() {
            //controller.playTest(0);
            //controller.start();
            //        }
            //    }
            //    )
            //        ;
            //    }
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //spriteFont = Content.Load<SpriteFont>("font");
            basicEffect = new BasicEffect(GraphicsDevice);
            basicEffect.VertexColorEnabled = true;

            MonoGameDebugDraw._batch = spriteBatch;
            MonoGameDebugDraw._device = GraphicsDevice;
            MonoGameDebugDraw._font = spriteFont;

            oldState = Keyboard.GetState();
            oldGamePad = GamePad.GetState(PlayerIndex.One);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _model.setPanel(this);
            _controller = new TestbedController(_model, UpdateBehavior.UPDATE_CALLED, MouseBehavior.NORMAL, new MonoGameTestbedError());

            _debugDraw = new MonoGameDebugDraw();
            _model.setDebugDraw(_debugDraw);
            TestList.populateModel(_model);

            _controller.playTest(7);
            _controller.start();

            Resize(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
        }